Install PHP
i will try to gather information from the net how to install php on windows or linux
LINUX
i get this tutorial from http://www.developertutorials.com/tutorials/php/how-to-install-php-5-on-linux-7-12-19-961/
download source
Get the source from http://www.php.net/downloads.php . At the time of writing this tutorial the best available version was 5.1.5 ( php-5.1.5.tar.gz ).
unpack, configure, compile
Go to the directory whith the downloaded file and enter:
tar -xzf php-5.2.1.tar.gz
cd php-5.2.1
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql
The configuration options ought to be self-explaining; –prefix specifies the location where PHP is to be installed, –with-apxs2 with correct path pointing to bin/apxs
in the Apache installation directory is mandatory for the installator
to work. Since PHP 5, you need to explicitly bundle PHP with MySQL by –with-mysql directive (make sure you specified path to where MySQL is installed on your system).
There
are many other options which turn on additional features. For all
available configuration options and their default values type ./configure –help.
Tip: If you are performing an upgrade, you may want to copy config.nice from the old PHP installation directory (if available) to where you unpacked the new PHP tarball file. Run ./config.nice instead of ./configure. This way all the previous configure options will be applied to the new installation effortlessly.
Once you entered ./configure with all the options you need, compile and install the software:
make
make install
edit httpd.conf
All
necessary changes to httpd.conf (Apache configuration file) should have
already been made automatically during the installation, so usually you
need not do anything. Anyways, check that following lines were added to
your httpd.conf file:
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
If not, add them manually.
create php.ini file
Importanly, you have to create php.ini configuration file. Choose one of the pre-made files (preferably php.ini-recommended) residing inside the php-5.2.1/ directory (it’s the folder to which the downloaded archive was extracted). Copy the file to the lib/ directory in the PHP installation directory.
cp php-5.2.1/php.ini-recommended /usr/local/php/lib/php.ini
If you need to, edit the php.ini file:
vi /usr/local/php/lib/php.ini
However, the default settings should work for everyone in most cases.
restart apache server
After everything is set up, restart Apache:
/usr/local/bin/apachectl stop
/usr/local/bin/apachectl start
Alternatively, simply enter:
/usr/local/bin/apachectl restart
Windows
i get this tutorial from http://www.ricocheting.com/how-to-install-on-windows/php
-
Download & Unpack
Download and install PHP from http://windows.php.net/download/, you should grab the newest VC6 x86 Thread Safe zip package (VC6 is on the bottom half of the page).
My file was named: php-5.2.7-Win32-VC6-x86.zipWarning against PHP Installer I would NOT use the "PHP Installer" version. The Installer version (even though it's larger) is missing some of the library/extension files you need for MySQL and it seems to have other random problems every time I try it. After multiple tries over several versions, my conclusion it is NOT worth the tiny bit of time it saves. So I highly recommend you use the PHP Zip Package version. Warning VC6 -vs- VC9 (PHP 5.2 -vs- PHP 5.3) PHP 5.3 is no longer available in a VC6 and you have to use old PHP 5.2 to get an officially Apache supported Window's version (there's warnings all down the left side of that download page). However, VC9 did work for me on Apache 2.2.17 with Windows7. However, I could not get VC9 (so PHP 5.3) to work on Windows XP. - Unzip php. In my case, I unzipped to C:\php\
- Rename C:\php\php.ini-development to php.ini
-
Edit your php.ini
Open php.ini in a text editor and scroll down about halfway through the file and look for doc_root then change it to point to whatever your Apache DocumentRoot is set to. In my case: doc_root = "C:\public_html"
Scroll down about 7 more lines and change the extension_dir from ;extension_dir = "ext" to the location of the ext directory after you unzipped PHP. in my case: extension_dir = "C:\php\ext" (remove the ; from in front of it also) -
Editing Apache Conf File
Using Notepad open httpd.conf (should be start-menu shortcut "Apache HTTP Server 2.2 > Configure Apache Server > Edit the Apache httpd.conf Configuration File"). Either at the very beginning or end of the file add the following lines: (NOTE: be sure to change BOTH C:/php parts to the directory you installed your php to)LoadModule php5_module "C:/php/php5apache2_2.dll" AddType application/x-httpd-php .php PHPIniDir "C:/php"
Note: If you installed the older Apache 2.0, instead of the above lines, you will need to use the lines listed on the bottom step of the Apache 2.0 tutorial. -
[OPTIONAL] Editing Apache Conf File (part 2)
To get Apache to automatically look for an index.php, search httpd.conf for DirectoryIndex (about line 212) and add the files you want apache to look for when a directory is loaded (if it doesn't find any of these files, it displays folder contents). Mine looks like:<IfModule dir_module> DirectoryIndex index.php index.html default.html </IfModule>
-
Testing
Restart Apache if it is already running (if it doesn't start or you get errors, use your Apache "Test Configuration" shortcut in the Start Menu to see why).
To test your PHP simply create a test.php file in your Apache "DocumentRoot" folder (C:\public_html\ in my case). In your test.php file, type these 3 lines and then load the file in your browser like http://localhost/test.php (you should get a whole long list of php variables, settings, etc):<?php phpinfo(); ?>