Home arrow Apache arrow Page 6 - Getting Started with Apache 2.0, Part 1

PHP 5.0.3 with Apache 2.0.52 - Apache

In this first article in a three-part series, Harish Kamath helps you download and configure the Apache Web server. If you've wanted to use PHP with Apache, look no further; that part of the setup is also covered here.

  1. Getting Started with Apache 2.0, Part 1
  2. Getting Off the Blocks
  3. Compiling Apache
  4. Configuration Options
  5. The "httpd.conf" Configuration File: a Quick Overview
  6. PHP 5.0.3 with Apache 2.0.52
  7. Conclusion
By: Harish Kamath
Rating: starstarstarstarstar / 28
March 07, 2005

print this article



At the onset, I promised that I would demonstrate how to configure PHP 5.0 with Apache 2.0  - and I always keep my promises!

Before I continue any further, I must highlight a warning by "The PHP Group" that the combination of PHP and Apache 2.0 is not recommended in a production environment. You can read the reasons behind this "stern" warning in the official PHP FAQ:

And if you are still not satisfied, read this interesting discussion at the following URL:

If you are still looking to get your hands dirty with this combination, despite all my warnings and caveats - welcome aboard.

This is where you must run a quick check on your existing Apache installation: did you build it to load modules dynamically by specifying the "--enable-so" option? If not, quickly fire the following commands to get moving:

$ cd /usr/local/src/httpd-2.0.52/

$ ./configure --prefix=/usr/local/apache --enable-so

$ make

$ make install

I'll also assume that you've already installed the following:

Next, you'll need to download the source code for the latest version of PHP (currently 5.0.3) from the following URL: http://www.php.net/downloads.php.

Unzip the PHP 5 source code on your server and run the "configure" command as shown below.

$ cd /usr/local/sac/

$ tar -xzvf /tmp/php-5.0.3.tar.gz

$ cd php-5.0.3/

$ ./configure --prefix=/usr/local/php5 --with-
apxs2=/usr/local/apache/bin/apes --with-
mysql=/usr/local/mysql --with-glib --with-dir-

Note that I have not enabled many PHP libraries in the above "configure" command. If you plan to use them extensively, it would be wise to review the options that are listed at this URL: http://in.php.net/manual/en/configure.php, before moving ahead. Note that these options have been listed for PHP 4 compilation; however, they should work for PHP 5 also.

Now, you'll have to run the "make" and "make install" commands.

$ make

$ make install

Ready to rock-n-roll? Not so fast. There is still one last bit of configuration of the Apache Web server that enables it to identify PHP files and pass them to the PHP module for interpretation. This is only possible by editing the ubiquitous "httpd.conf" Apache configuration file in your favorite text editor and adding the following line:

AddType application/x-httpd-php .php

Now, you can re-start Apache using the "apachectl" script and load the following "phpinfo.php" script (saved in the root folder of the Web server) in a browser:




Instead of getting a screen full of cryptic error messages or warnings, if you get the following screen, rest assured that you have successfully installed PHP 5.0 with Apache 2.0.

Finally, you can visit the following URL if you wish to learn more about installing PHP with Apache 2.0:

>>> More Apache Articles          >>> More By Harish Kamath

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Apache Unveils Cassandra 1.2
- Apache on ARM Chips? Dell and Calxeda Help M...
- The Down Side of Open Source Software
- VMware Unveils Serengeti for Apache Hadoop
- SAP Takes Steps to Improve Hadoop Integration
- Looking to Hone Apache Hadoop Skills?
- How to Install Joomla on WAMPP
- Working with XAMPP and Wordpress
- GUI Available for Apache Camel
- Reduce Server Load for Apache and PHP Websit...
- Creating a VAMP (Vista, Apache, MySQL, PHP) ...
- Putting Apache in Jail
- Containing Intrusions in Apache
- Server Limits for Apache Security
- Setting Permissions in Apache

Developer Shed Affiliates


Dev Shed Tutorial Topics: