Install PHP 5, хостинг php 5.6.

How do I install PHP 5.6 and Apache in RHEL 7.2?

How do I install PHP 5.6 and Apache in RHEL 7.2?

Resolution

By default, RHEL 7.2 includes only php5.4 and php5.5. In order to use php5.6, use the RHSCL repos and manually configure httpd.conf to use them.

Because RHEL does not support mod_php with php5.6, you must use php-fpm and run it though mod_proxy_fcgi.

1. Enable the RHSCL repository as a source and install the httpd and php56 packages by running the following commands:

To install other modules (for example, the php-mysql module), you can search and install them by using commands similar to the following:

2. Start and check rh-php56-php-fpm using the following commands:

3. Modify httpd conf to enable mod_proxy_fcgi to work with php-fpm by running the following command:

Add the following before IncludeOptional conf.d/*.conf:

Use the :wq command to save your configuration.

PHP-FPM runs under 127.0.0.1:9000 by default. To process all php files in your root web folder, use an address similar to the following:

4. Restart Apache and check its status by running the following commands:

5. Create a test file by running the following command:

Add the following content to the new file:

Use the :wq command to save your configuration.

Verify your configuration

To verify that your configuration was loaded successfully, locate your instance’s public IP address in the EC2 management console. Open a browser on the instance, and navigate to http://<public ip address of the instance>/info.php.

When you’ve verified it is working, you can set Apache and php-fpm to start on boot by running the following commands:

PHP, RHEL, Apache, php56, httpd, RHSCL, RHEL7

Related Information

Did this page help you? Yes | No

Amazon Web Services is Hiring.

Amazon Web Services (AWS) is a dynamic, growing business unit within Amazon.com. We are currently hiring Software Development Engineers, Product Managers, Account Managers, Solutions Architects, Support Engineers, System Engineers, Designers and more. Visit our Careers page or our Developer-specific Careers page to learn more.

Amazon Web Services is an Equal Opportunity Employer.