If you are using Linux, you can easily find an RPM for Apache and PHP, but this installation may not include every PHP feature you want. I recommend this route as a very quick start. You can always pursue compiling Apache and PHP from scratch later. PHP will compile on most versions of UNIX-like operating systems, including Solaris and Linux. If you have ever compiled software you've found on the Net, you will have little trouble with this installation. If you don't have experience extracting files from a tar archive and executing make files, you may wish to rely on your sysadmin or someone else more experienced. You will need to have root privileges to completely install PHP.
The first step is to download the tar files and unpack them. After unpacking the tar file, the first step is to configure Apache. This is done by running the configure script inside the Apache directory:./configure -prefix=/www
The script will examine your system and prepare a make file for Apache. The prefix directive will cause a directory to be created in the root of your file system.
Next, configure and compile PHP:./configure -with-apache=/usr/local/src/apache_1.3.9 -enable-track-vars
This is done within the PHP directory. The -with-apache and -enable-track-vars options are minimal. You might add -with-mysql if you have the MySQL database installed. PHP can usually find the MySQL libraries on its own. Running make will create the PHP library, and make install will prepare Apache for including the PHP module. Notice that the call to configure includes a path to your Apache source code directory. This can be a relative path, as you may have put the Apache source code parallel to the PHP source code. However, do not make the mistake of using relative paths for any of the other directives.
Next, you will need to reconfigure Apache and run make. Return to the Apache source code directory and run configure again, this time with an option that tells Apache to include the PHP module:./configure -prefix=/www -activate-module=src/modules/php4/libphp4.a
This will create a new make file and then run it. The new httpd binary will be installed in
the /www/bin directory, or wherever you specified the files should be installed.
To supply additional configuration options PHP uses a file called php.ini. This file should reside in /usr/local/lib, so copy it from the PHP source directory:
cp php.ini-dist /usr/local/lib/php.ini
It is not likely you will need to edit this file, but if you do, there are instructive comments inside.
The last step is to associate a file extension with PHP. This is done by editing the httpd.conf file. It can be found in Apache's conf directory, /www/conf/httpd.conf, for example. Add the following line:AddType application/x-httpd-php .php
This causes all files with the extension .php to be executed as PHP scripts. You may choose another, such as phtml. You may also wish to insert index.php as a default document. When the Apache server is started, it will process PHP scripts. The documentation for Apache has hints for starting Apache automatically. If you have been running Apache previously, you will need to restart it, not just use a kill -HUP command.
PHP Related Interview Questions
|PHP Interview Questions||MySQL Interview Questions|
|PHP+MySQL Interview Questions||Drupal Interview Questions|
|MYSQL DBA Interview Questions||PHP5 Interview Questions|
|WordPress Interview Questions||Joomla Interview Questions|
|CakePHP Interview Questions||CodeIgniter Interview Questions|
|PHP7 Interview Questions|
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.