Install API Portal without dependencies

The standard API Portal installation script is configured to install specific dependencies (such as PHP, Apache) that are required by API Portal. In some cases, for example, if your environment only allows installing components from a curated local repository, you might need to install these dependencies yourself. API Portal provides an alternative installation script that does not install any dependencies for this purpose.

The process is as follows:

  1. Install the dependencies API Portal requires on your environment.
  2. Install API Portal. See Install API Portal using "no dependencies" installer.
  3. Configure php.ini for API Portal. See Configure PHP for API Portal.
  4. If you installed Apache from the official RHEL repository, move the apiportal.conf and security.conf files. See Move API Portal configuration files (Apache from official RHEL repository).

RHEL – Install dependencies from official RHEL repository

On a RHEL7 installation, the default PHP version available in the official repository is 5.4. It is best to install PHP 7.x.

To install PHP 7.x, you can use an additional official RHEL repository. By default, RHEL uses packages from Red Hat Enterprise Linux 7 base channel but RHEL provides additional repositories under the Red Hat Software Collections channel.

Enable the official RHEL repository

  1. Add an official RHEL repository that contains PHP version 7.x:
  2. $ sudo subscription-manager repos --enable rhel-server-rhscl-7-rpms
  3. Clear the cache:
  4. $ sudo yum clean all
  5. Run the update:
  6. $ sudo yum update

Install PHP from official RHEL repository

Note   At the time of writing, the latest available PHP version in the RHEL repository is PHP 7.1.x, but the official latest PHP version is 7.2.x. It is best to install the latest 7.x version available.
  1. To find the latest PHP7 version, enter the following command:
  2. $ sudo yum search php7
  3. Install all required packages, for example:
  4. $ sudo yum install rh-php71 rh-php71-php rh-php71-php-cli rh-php71-php-common 
    rh-php71-php-gd rh-php71-php-json rh-php71-php-intl rh-php71-php-mbstring 
    rh-php71-php-mysqlnd rh-php71-php-pdo rh-php71-php-xml rh-php71-php-zip

After installation, create a symbolic link to use PHP directly in a terminal:

  1. Check that PHP is located in the directory /opt/rh/rh-php71/root/usr/bin/php and execute the following command to verify the PHP version:
  2. $ /opt/rh/rh-php71/root/usr/bin/php -v
    
    PHP 7.1.8 (cli) (built: Nov 7 2018 18:12:07) (NTS)
  3. To create a symbolic link, enter the command:
  4. $ ln -s /opt/rh/rh-php71/root/usr/bin/php /usr/bin/php
  5. Run the following to validate the symbolic link was created successfully:
  6. $ php –v
    
    PHP 7.1.8 (cli) (built: Nov 7 2018 18:12:07) (NTS)

Upgrade PHP

If you already have PHP 5.4 or earlier and API Portal 7.6.2 or earlier installed, you cannot uninstall the old PHP version due to a dependency in API Portal. Perform the steps in Install PHP from official RHEL repository and leave the old PHP version installed. If there is already a symbolic link to the old PHP version, update it with the new location of PHP (for example, using ln -sf instead of ln-s).

Configure existing Apache

If Apache is not already installed, skip this section and follow the steps in Install Apache and PHP from official RHEL repository.

Depending on your existing Apache installation, you might need to configure Apache. Use the following command to check your existing Apache package:

$ rpm -qa | grep httpd

Follow the appropriate steps for your version (httpd-2.4.* or httpd24-httpd-2.4.*).

Configure existing Apache (httpd-2.4.*)

By default, Apache does not use the newly installed PHP, so you must perform some additional configuration steps. The following steps apply to the default Apache 2.4 (for example, yum install httpd) only.

  1. Open the file /etc/httpd/conf/httpd.conf.
  2. Above the line Include conf.modules.d/*, remove any existing entry for PHP and add the line:
  3. LoadModule php7_module /opt/rh/httpd24/root/usr/lib64/httpd/modules/librh-php71-php7.so
  4. Add index.php to the <IfModule dir_module> directive. For example, change:
  5. <IfModule dir_module>
        DirectoryIndex index.html
    </IfModule>
    
  6. to:
  7. <IfModule dir_module>
        DirectoryIndex index.php index.html 
    </IfModule>
    
  8. Add the following after the <IfModule dir_module> directive:
  9. # Allow php to handle Multiviews
    AddType text/html .php
    # mod_php options
    <IfModule  mod_php7.c>
        # Cause the PHP interpreter to handle files with a .php extension.
        <FilesMatch \.php$>
            SetHandler application/x-httpd-php
        </FilesMatch>
        # Uncomment the following lines to allow PHP to pretty-print .phps
        # files as PHP source code:
        #<FilesMatch \.phps$>
        #    SetHandler application/x-httpd-php-source
        #</FilesMatch>
        # Apache specific PHP configuration options
        # those can be override in each configured vhost
        #
        php_value session.save_handler "files"
        php_value session.save_path    "/var/opt/rh/rh-php71/lib/php/session"
        php_value soap.wsdl_cache_dir  "/var/opt/rh/rh-php71/lib/php/wsdlcache"
        #php_value opcache.file_cache   "/var/opt/rh/rh-php71/lib/php/opcache"
    </IfModule>
    
  10. Save the file and restart Apache:
  11. $ systemctl restart httpd

Configure existing Apache (httpd24-httpd-2.4.*)

This package does not require any additional configuration for PHP.

  • You do not have to perform any additional steps if you have installed httpd24-httpd (and httpd24-mod_ssl) and want to use rh-php71.
  • If you are using the newer Apache (for example, yum install httpd24-httpd) its configuration files are usually located in /opt/rh/httpd24/root/etc/httpd/.

Install Apache and PHP from official RHEL repository

RHEL offers a newer version of Apache that is also available in the additional repository you enabled for PHP.

Follow these steps to install Apache and PHP from the Red Hat Software Collections channel:

  1. Enable the additional repository as detailed in Enable the official RHEL repository.
  2. If you have Apache already, remove it:
  3. $ yum remove httpd
  4. Install the packages:
  5. $ yum install httpd24-httpd httpd24-httpd-tools httpd24-mod_ssl
  6. Verify you have the package httpd24-httpd with the command:
  7. $ rpm -qa  grep httpd24-httpd
  8. Create a symbolic link:
  9. $ ln -sf /opt/rh/httpd24/root/sbin/httpd /usr/bin/httpd 
  10. Restart the terminal to enable the symbolic link.
  11. Verify:
  12. $ httpd -v
  13. Perform the steps in Install PHP from official RHEL repository.
  14. Restart Apache:
  15. $ systemctl restart httpd24-httpd

No additional PHP configuration is required.

RHEL – Install dependencies from community repository EPEL with Remi

EPEL (Extra Packages for Enterprise Linux) is an open source repository which provides add-on software packages for Linux distributions including RHEL, CentOS, and Scientific Linux. Using this repository allows you to install the latest available PHP. For example, at the time of writing, you can install PHP 7.2.* from this repository, whereas only PHP 7.1.* is available in the official RHEL repository.

Install PHP from EPEL repository

  1. Turn on the EPEL repository and search for PHP:
  2. $ yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    $ yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
    $ yum install yum-utils
    $ subscription-manager repos --enable=rhel-7-server-optional-rpms
    $ yum-config-manager --enable remi-php72
    $ yum update
    $ yum search php72
    
  3. All available PHP packages are listed.
  4. Install PHP:
  5. $ yum install php72 php72-php php72-php-cli php72-php-gd php72-php-json 
    php72-php-mbstring php72-php-mysqlnd php72-php-xml php72-php-zip 
    php72-php-pdo php72-php-intl
  6. After PHP is installed, create a symbolic link:
  7. $ ln -sf /opt/remi/php72/root/bin/php /usr/bin/php
  8. Reopen the terminal if you cannot verify with php -v and try again.
  9. Configure Apache. Follow the steps in Configure existing Apache.
  10. Because the location of the PHP .so file is different, use the following when setting the PHP module in the Apache configuration:
  11. LoadModule php7_module /opt/remi/php72/root/lib64/httpd/modules/libphp7.so.

Upgrade PHP

Follow the steps in Upgrade PHP.

CentOS – Install dependencies from community repository EPEL with Remi

CentOS also does not offer the latest PHP version in the default repositories. To install the latest PHP, it is best to use the EPEL repository.

Install PHP from community repository EPEL with Remi

  1. Install the EPEL repository:
  2. $ yum install epel-release
  3. Install the Remi repository:
  4. $ yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
  5. Install yum-utils packages (if not already installed):
  6. $ yum install yum-utils
  7. Enable the Remi repository:
  8. $ yum-config-manager --enable remi-php72
    $ yum update
  9. Verify the repository is enabled:
  10. $ yum search php72
  11. Install PHP:
  12. $ yum install php72 php72-php php72-php-cli php72-php-gd php72-php-json 
    php72-php-mbstring php72-php-mysqlnd php72-php-xml php72-php-zip 
    php72-php-pdo php72-php-intl
  13. Configure Apache. Use the steps in Configure existing Apache (httpd-2.4.*) as a reference, but because the location of the PHP .so file is different, search for the location of a file similar to libphp72.so and use that path when setting the PHP module in the Apache configuration.
  14. Note   You do not need to configure Apache if you have already installed it through the package manager.
  15. Restart Apache:
  16. $ systemctl restart httpd

Upgrade PHP

Follow the steps in Install PHP from community repository EPEL with Remi. The installed version should be automatically set and you can remove the old version of PHP. Verify using php -v and if the result is not the newly installed version, modify the PHP symbolic link with the path to the new version (/opt/remi/php72/root/bin/php).

Install Apache from community repository EPEL with Remi

  1. To install Apache, enter the following command:
  2. $ yum install httpd httpd-tools mod_ssl
  3. To start Apache, enter the following command:
  4. $ systemctl start httpd

Install API Portal using "no dependencies" installer

After you have installed all of the required dependencies, follow these steps to install API Portal:

  1. Download the "no dependencies" installation package (for example, APIPortal_7.6.2_InstallerPatch_linux-x86-64_BN25.zip) from Axway Support at https://support.axway.com, and upload it to your host machine.
  2. Log in to the host machine as the root user.
  3. Unzip the package.
  4. Run the install script:
  5. # sh apiportal_install_patched.sh
  6. Enter the required information when prompted by the installer. For more details, see Install API Portal software.

Configure PHP for API Portal

To configure PHP, edit your php.ini file:

  1. To find the path to your php.ini file:
  2. $ php –i | grep php.ini
  3. Open the file for editing, and change the following directives:
  4. upload_max_filesize = 20M
    post_max_size = 20M
    expose_php = off
    output_buffering = off
    upload_tmp_dir = /opt/axway/apiportal/htdoc/tmp
    

Move API Portal configuration files (Apache from official RHEL repository)

Note   This section applies only if you installed Apache from the official RHEL repository.

When you install Apache from the official RHEL repository, the Apache configuration files are located in /opt/rh/httpd24/root/etc/httpd instead of the usual location of /etc/httpd.

When you install API Portal the installation script puts the apiportal.conf file (the one with the v-host) and the security.conf file in the location /etc/httpd.conf.d by default, and when you access API Portal from a browser it shows the default Apache web page.

To resolve this issue, follow these steps:

  1. Move the apiportal.conf and the security.conf files from the location /etc/httpd.conf.d to the location /opt/rh/httpd24/root/etc/httpd/conf.d.
  2. Restart Apache:
  3. $ systemctl restart httpd24-httpd

Related Links