Results 1 to 1 of 1
-
15th Jun 2014, 02:46 PM #1
Apache 2 and PHP 4 and 5 Installation Guide
This tutorial is designed to help those who would like to install Apache 2 and PHP as mod_php or a DSO module on a UNIX/Linux based system. This tutorial has been tested on Redhat 9 and Redhat 8, as well as FreeBSD. The installation should work fairly similar on each variation of UNIX/Linux. This tutorial will be demonstrated using FreeBSD.
Tip: Don't forget to remove (or at least disable) any rpm or other installed versions of apache.
Since Apache 2.0.42 the API for apache will be kept stable, which means you should be able to upgrade apache without having to upgrade your modules as well.
The following is how to install Apache as a DSO module.
For this tutorial we will be using PHP 4.3.8 and httpd 2.0.51.
TIP: Read the whole tutorial before you start, as some steps make go back or forwards.
1. Download apache from Welcome! - The Apache HTTP Server Project
Code:wget ftp://ftp.planetmirror.com/pub/apache/dist/httpd/httpd-2.0.51.tar.gz
Code:wget http://au2.php.net/get/php-4.3.8.tar.gz/from/www.php.net/mirror
Code:tar zxvf httpd-2.0.51.tar.gz tar zxvf php-4.3.8.tar.gz
Installation Directory Options:
--prefix=PREFIX install architecture-independent files in PREFIX - default is: /usr/local/apache2
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX]
Other Installation Options:
(Where FEATURE is a feature in httpd)
Here is the command we are running:
./configure \
--prefix=/usr/local/apache2 \
--enable-cgi \
--enable-ssl \
--enable-so \
--enable-rewrite \
--enable-mime-magic \
--enable-suexec \
--enable-static-rotatelogs \
--enable-speling
For the most part you should not have any problems, you will get the script checking to see if your system is compatible and has all the requirements to run.
5. The following command will compile the source into binaries based on the configuration you created in step 4. You can go back to step 4 if you did something wrong and redo the configuration.
Code:make
6. The following command will move the binaries from the build directory into the locations they need to go on your system.
Code:make install
Code:/usr/local/apache2/bin/apachectl start
Code:/usr/local/apache2/bin/apachectl restart
Code:/usr/local/apache2/bin/apachectl stop
Code:telnet localhost 80
9. Have apache 2 start up automatically:
For FreeBSD add the following line to /etc/rc.local
Code:/usr/local/apache2/bin/apachectl start
Copy the apache startup script (apachectl) from the apache directory to the startup directory.
Code:cp /usr/local/apache2/bin/apachectl /etc/init.d/
Code:# chkconfig: - 85 15 # description: Apache is a Web server used to serve HTML files and CGI.
Code:/sbin/chkconfig --add apachectl
Installing PHP 4.3.8 or 5.0.1 with Apache2
1. Change directory into the PHP source directory (php-4.3.8).
2. Configure PHP using the ./configure command, options are as follows:
Directory and file names:
--with-pear=DIR Install PEAR in DIR (default PREFIX/lib/php)
--without-pear Do not install PEAR
--enable-experimental-zts
This will most likely break your build
--disable-inline-optimization
If building zend_execute.lo fails, try this switch.
--enable-memory-limit Compile with memory limit support.
--enable-zend-multibyte Compile with zend multibyte support.
--with-tsrm-pth[=pth-config]
Use GNU Pth.
--with-tsrm-st Use SGI's State Threads
--with-tsrm-pthreads Use POSIX threads (default)
--enable-shared[=PKGS] build shared libraries [default=yes]
--enable-static[=PKGS] build static libraries [default=yes]
--enable-fast-install[=PKGS] optimize for fast installation [default=yes]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
--disable-libtool-lock avoid locking (might break parallel builds)
--with-pic try to use only PIC/non-PIC objects [default=use both]
To compile PHP in with the apache2 use the following settings.
Code:make
Code:make install
Code:cp -p .libs/libphp4.so /usr/local/apache2/modules
cp -p php.ini-recommended /usr/local/apache2/php/php.ini
7. Open the apache2 logfile and make sure that the following lines exist:
Code:LoadModule php4_module modules/libphp4.so DirectoryIndex index.html index.php AddType application/x-httpd-php php AddType application/x-httpd-php-source phps
If these do not exist in your apache config files (/usr/local/apache2/conf/httpd.conf) then add then so as to allow PHP to function correctly.
8. Restart apache:
Code:/usr/local/apache2/bin/apachectl restart
info.php
Code:<?php echo phpinfo(); ?>
PHP 5 and Apache 2 installation coming soon!
1. Download PHP5.0.1:Code:wget http://www.php.net/get/php-5.0.1.tar.gz/from/www.php.net/mirror
2. Untar and un gzip: tar zxvf php-5.0.1.tar.gz
3. cd php-5.0.1/
4. check out the install options using ./configure --help
The next step was the configuration we used to install apache on a standard FreeBSD installation.
5.Code:./configure --prefix=/usr/local/apache2/php5 --with-apxs2=/usr/local/apache2bin/apxs --disable-cgi --enable-force-cgi-redirect --disable-libxml --libexecdir=/usr/local/apache2/modules --exec-prefix=/usr/local/apache2/php5 --with-config-file-path=/usr/local/apache2/php5
5. make
6. make install
7. Open up your apache config file
Code:vi /usr/local/apache2/conf/httpd.conf
Code:LoadModule php5_module modules/libphp5.so AddType application/x-httpd-php php AddType application/x-httpd-php-source phps
Code:/usr/local/apache2/bin/apachectl restart
Code:vi /usr/local/apache2/htdocs/phpinfo.php <?php phpinfo(); ?>
Code:http://yoursite/phpinfo.php
If you have problems during your Apache 2 and PHP 5 or 4 installation. Try removing the source directory, untaring it again, and trying a different set of configuration options.Areon Reviewed by Areon on . Apache 2 and PHP 4 and 5 Installation Guide This tutorial is designed to help those who would like to install Apache 2 and PHP as mod_php or a DSO module on a UNIX/Linux based system. This tutorial has been tested on Redhat 9 and Redhat 8, as well as FreeBSD. The installation should work fairly similar on each variation of UNIX/Linux. This tutorial will be demonstrated using FreeBSD. Tip: Don't forget to remove (or at least disable) any rpm or other installed versions of apache. Since Apache 2.0.42 the API for apache will be kept Rating: 5
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Need help regarding Apache Linux PHP and Perl?
By Mind Trainer in forum Web Application/Script SupportReplies: 0Last Post: 11th Apr 2012, 02:28 AM -
How To Install Apache with MySQL and PHP on Linux CentOS
By enetcloud in forum Tutorials and GuidesReplies: 3Last Post: 21st Aug 2011, 01:11 PM -
Installing Apache, MySQL and PHP using Yum on a Linux Server
By JacksonWeb in forum Tutorials and GuidesReplies: 6Last Post: 11th Feb 2011, 06:43 AM -
Install Apache and PHP
By VAHID in forum Server ManagementReplies: 3Last Post: 10th Jan 2011, 08:46 AM -
Apache and PHP under windows
By The Coon in forum Technical Help Desk SupportReplies: 9Last Post: 30th Oct 2009, 01:43 PM
themaLeecher - leech and manage...
Version 5.03 released. Open older version (or...