How to Install PHP on Unix Or Linux


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.

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/local directory 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
# make
# make install

Here x is the Version of your PHP and Apache Distribution Source File

  • 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  /usr/local/apache/conf.
  • Look for a file httpd.conf and open it with your favorite text editor.

PHP Tutorial PHP Tutorial Index

Related Post

Posted in