To Install PHP on your Linux or Unix Based Computer you will need some file and apps that available on the Web. You can Simply download them before the install steps.
- First of all, you will need the PHP source Distribution that can be downloaded from here – http://www.php.net/downloads.php
- Then the latest Apache Source file. Download from here – http://httpd.apache.org/download.cgi
- Database software that supports PHP. You can use MySQL or Oracle
- An ANSI C Compiler
- At last, GNU make Utility that can be downloaded from here – http://www.gnu.org
All done! Now It is time to install PHP and Apache on your Computer.
Install PHP on Unix
- Unzip and Untar the Apache Source file in the
/user/localdirectory as a Standard place.
gunzip -c apache_1.3.x.tar.gz tar -xvf apache_1.3.x.tar
- Build the Apache Server as follows
cd apache_1.3.x ./configure --prefix=/usr/local/apache --enable-so make make install
- Then Unzip and Untar the PHP source file in the same directory. Then run cmd as follows
gunzip -c php-5.x.tar.gz tar -xvf php-5.x.tar cd php-5.x
- Now it is time to configure and build your Apache and PHP and bind with the database. I am assuming you are using MySQL here.
./configure --with-apxs=/usr/sbin/apxs \ --with-mysql=/usr/bin/mysql make make install
- Now Install the php.ini file. Edit this file to get configuration directives.
cd ../../php-5.x cp php.ini-dist /usr/local/lib/php.ini
- Now Tell your Apache server where you want to serve files from, and what extension(s) you want to identify PHP files .php is the standard, but you can also use .html, .phtml, as you want.
- To do that go to your HTTP configuration files. By default, it will be
- Look for a file httpd.conf and open it with your favorite text editor.