Apache

How To Compile PHP-5.6 With Apache Worker Support

Apache uses one of the following Multi-Processing Module (MPM) for handling incoming requests and processes them. It modifies basic functionality of the Apache server related to multi-thread and multi-processes style of working. Only one MPM can be loaded into the server at any time.

What is Worker MPM?

Worker MPM uses multiple child processes and each child process can have many threads and each thread handles one connection at a time. It is good choise for high-traffic servers because it has smaller memory footprint than the prefork MPM and has higher performance. It is Apache 2.0 based. It does not provide the same level of isolation such as request-to-request, as a process based MPM does.

Read More about Apache MPM :- What is Apache MPM?

In this article I will show you how to compile PHP 5.6 with Apache Worker Support.

Download PHP 5.6

Download PHP 5.6 if not downloaded yet.

# wget http://us1.php.net/distributions/php-5.6.4.tar.xz

Extract xz File

Type below command to unpack the file.

# tar xJvf php-5.6.4.tar.xz

To Install Dependencies Download And Run The Script

Now download and run the below script to install dependencies:

# wget --no-check-certificate https://raw.githubusercontent.com/yoander/sysadmin/master/shscript/php-dev-install-dep.sh
# chmod a+x -c php-dev-install-dep.sh && 
# ./php-dev-install-dep.sh apache-worker

Download Script To Compile PHP

After installing dependencies now download the below script to compile PHP.

# wget --no-check-certificate https://raw.githubusercontent.com/yoander/sysadmin/master/shscript/php-build.sh
# chmod a+x -c php-build.sh

Compile PHP

# ./php-build.sh -at php-5.6.4

Where,
a : To support Apache
t : Support multithreading (thread safe)

Install PHP

Now install PHP.

# cd php-5.6.4
# make install

Create A PHP Configuration File

Now creare a PHP configuration file.

For Development Environment

# cp -v php.ini-development /etc/php/php.ini

For Production Environment

# cp -v php.ini /etc/php/php.ini

Restart Apache

Now restart Apache.

# service httpd restart

Verify

Now verify, is everything is file.

Open your browser and type the below URL:

http://Domain_name_or_IP_address/info.php
phpinfo-page

Thanks:)

Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.

About the author

mm

Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

1 Comment

  • Hello Santosh,

    Can you pls help us to execute php in html file. As we are using Apache 2.4 , php-fpm on centos 6.9(64 Bit).

    Thanks
    Raju Seervi

Leave a Comment