INSTALLING PHP _______________________________________________________
Table of Contents 1. General Installation Considances 2. Installation on Windows Systems
Windows Installer Manual Installation Steps ActiveScript Microsoft IIS / PWS Apache 1.3.x on Microsft Windows Apache 2.0.x on Microsoft Windows Sun, iPlanet and Netscape servers on Microsoft Windows OmniHTTPd Server Sambar Server on Microsoft Windows Xitami on Microsoft Windows Installation of extensions on Windows
3. Problems?
Read The FAQ Other Problems Bug Reports
4. Runtime Configuration
The Configuration File How To Change Configuration Settings_______________________________________________________________________________________________________________________________________________________________________
Chapter 1. General Installation Considances
Before Starting The Installation, First You NEED TO KNOW What Do You Want To Use PHP for. There Are Three Main Fields You Can Use PHP, AS DESCRIBED in The What CAN PHP DO? Section:
* Server-Side Scripting * Command Line Scripting * Client-Side GUI Applications
For the first and most common form, you need three things: PHP itself, a web server and a web browser You probably already have a web browser, and depending on your operating system setup, you may also have a web server (eg Apache. On Linux and Macos X; IIS On Windows). You May Also Rent Webspace At a Company. this Way, you don't need to set up anything on your owne, online t t t s s u u u, And See The Results in your browser.
While setting up the server and PHP on your own, you have two choices for the method of connecting PHP to the server. For many servers PHP has a direct module interface (also called SAPI). These servers include Apache, Microsoft Internet Information Server, Netscape and iPlanet servers. Many other servers have support for ISAPI, the Microsoft module interface (OmniHTTPd for example). If PHP has no module support for your web server, you can always use it as a CGI or FastCGI processor. This means you set up your server to use the CGI executable of PHP to process all PHP file requests on the server.If you are also interested to use PHP for command line scripting (eg write scripts autogenerating some images for you offline, or processing text files depending on some ARGUMENTS YOUT WREMAND LINE EXECUTABLE. For More Information, Read The Section About Writing Command Line PHP Applications. In this case, you need no server and no Browser.
With PHP you can also write desktop GUI applications using the PHP-GTK extension. This is a completely different approach than writing web pages, as you do not output any HTML, but manage windows and objects within them. For more information about PHP-GTK Please Visit The Site Dedicated to this extension. PHP-GTK IS NOT INCLUDED IN The OFFICIAL PHP Distribution.
From now on, this section deals with setting up PHP for web servers on Unix and Windows with server module interfaces and CGI executables. You will also find information on the command line executable in the following sections.
PHP source code and binary distributions for Windows can be found at http://www.php.net/downloads.php. We recommend you to choose a mirror nearest to you for downloading the distributions. _________________________________________________________________Chapter 2. Installation on Windows systems
This section applies to Windows 98 / Me and Windows NT / 2000 / XP / 2003. PHP will not work on 16 bit platforms such as Windows 3.1 and sometimes we refer to the supported Windows platforms as Win32. Windows 95 is no longer supported as of PHP 4.3.0.
............... ..
IF you have microsoft visual studio, you can also build php from the original source code.
Once You Have PHP Installed On Your Windows System, You May Also Want To Load Various Extensions for Added Functionality.
Warning
There are several all-in-one installers over the Internet, but none of those are endorsed by PHP.net, as we believe that the manual installation is the best choice to have your system secure and optimised. _________________________________________________________________
Windows Installer
The Windows PHP installer is available from the downloads page at http://www.php.net/downloads.php. This installs the CGI version of PHP and for IIS, PWS, and Xitami, it configures the web server as well. The Installer Does NOT INCLUDE ANY Extra External PHP Extensions (PHP_ *. DLL) As You'll Only Find Those In The Windows Zip Package and Pecl Downloads.
Note: While the Windows installer is an easy way to make PHP work, it is restricted in many aspects as, for example, the automatic setup of extensions is not supported Use of the installer is not the preferred method for installing PHP.First. Install Your SELECTED HTTP (Web) Server ON Your System, And make Sure That IT Works.
Run the executable installer and follow the instructions provided by the installation wizard Two types of installation are supported -. Standard, which provides sensible defaults for all the settings it can, and advanced, which asks questions as it goes along.
The installation wizard gathers enough information to set up the php.ini file, and configure certain web servers to use PHP. With IIS or PWS on a NT Workstation, a list of all the nodes on the server with script map settings is displayed, and You can choise those nodes to which you wish to add the php script mappings. One of the Web Servers The PHP Installer Does Not Configure for Is Apache, So You'll Need To Configure It Manually.
Once The Installation Has Completed, The Installer Will Inform You If You Need To Restart Your System, Restart The Server, or Just Start Using PHP.
Warning
Be aware, that this setup of PHP is not secure. If you would like to have a secure PHP setup, you'd better go on the manual way, and set every option carefully. This automatically working setup gives you an instantly working PHP installation But it is not meant to be used on online servers. _______________________________________________________________________________________________________________________________________________________________________________________________
Manual Installation Steps
This install guide will help you manually install and configure PHP with a web server on Microsoft Windows. To get started you'll need to download the zip binary distribution from the downloads page at http://www.php.net/downloads.php .Although there are many all-in-one installation kits, and we also distribute a PHP installer for Microsoft Windows, we recommend you take the time to setup PHP yourself as this will provide you with a better understanding of the system, and enables you To Install PHP Extensions Easily When Needed.
Upgrading from a previous PHP version: Previous editions of the manual suggest moving various ini and DLL files into your SYSTEM (ie C: / WINDOWS) folder and while this simplifies the installation procedure it makes upgrading difficult We advise you remove all of these files. (like php.ini and PHP related DLLs from the Windows SYSTEM folder) before moving on with a new PHP installation. Be sure to backup these files as you might break the entire system. The old php.ini might be useful in setting up the NEW PHP As Well. And as You'll Soon Learn, The Preferred Method for Installing PHP IS To Keep All PHP Related Files in One Directory and Have this Directory Available To your systems path.
MDAC requirements:. If you use Microsoft Windows 98 / NT4 download the latest version of the Microsoft Data Access Components (MDAC) for your platform MDAC is available at http://msdn.microsoft.com/data/ This requirement exists because ODBC. Is Built Into The Distributed Windows Binaries.
The Following Steps Should Be Completed On All Installations Before Any Server Specific Instructions Are Performed:
Extract the distribution file into a directory of your choice If you are installing PHP 4, extract to C:.. /, As the zip file expands to a foldername like php-4.3.7-Win32 If you are installing PHP 5, extract to C: / PHP as the zip file doesn't expand as in PHP 4. You May Choose a Different Location But Do Not Have Spaces in The Path (Like C: / Program Files / PHP) AS Some Web Servers Will Crash if you do .The Directory Structure Extracted from the zip is Different for PHP Versions 4 and 5 and Look Like As Follows:
Example 2-1. PHP 4 Package Structurec: / PHP | - CLI | | | | -Php.exe - Cli Executable - Only for CommandLine Scripting | - DLLS - Support Dlls Required By Some Extensions | | -EXPAT.DLL | | | | | | -... | - EXTENSIONS - EXTENSION DLLS for php | | | | -php_bz2.dll | | | | -php_cpdf.dll | | | | - .. | - MIBS - Support Files for SNMP | - OpenSSL - Support Files for OpenSSL | - PDF-Related - Support Files for PDF | - SAPI - SAPI (Server Module Support) DLLS | | | | | | | --PHP4APACHE.DLL | | | | | - .. | - Pear - Initial Copy of Pear | | Go-pear.bat - Pear setup script | | - .. | -Php.exe - cgi executable | | - .. | | -php.ini-dist - default php.ini settings | | -php. INI-RECO Mmended - Recommended PHP.INI Settings | | -Php4tsts.dll - Core PHP DLL | | -...
OR:
Example 2-2. PHP 5 Package Structurec: / PHP | - DEV | | | | -PHP5TS.LIB | - EXT - EXTENSION DLLS for php | | | | | -php_cpdf .dll | | | - .. | - EXTRAS | | | - MIBS - Support files for snmp | | | - openssl - support files for openssl | | | - pdf-related - - Support files for pdf | | | | | | - | - initial copy of pear | | | -go-pear.bat - pear setup script | | -fdftk.dll | | - .. | | -PHP-CGI.EXE - CGI EXECUTABLE | | -PHP-WIN.EXE - EXECUTES Scripts without An Opened Command Prompt | | -Php.exe - Cli Executable - Only for Command Line Scripting | | - - .. | -Php.ini-dist - default php.ini settings | | -Php.ini-recommented - recommended php.ini settings | | -php5activescript.dll | | -php5apache.dll | | -php5apache2.dll | | .. | | -php5ts. dll - core PHP DLL |. | -... Notice the differences and similarities Both PHP 4 and PHP 5 have a CGI executable, a CLI executable, and server modules, but they are located in different folders and / or have different names . While PHP 4 packages have the server modules in the sapi folder, PHP 5 distributions have no such directory and instead they're in the PHP folder root. The supporting DLLs for the PHP 5 extensions are also not in a seperate directory.
Note: In PHP 4, you Should Move All Files Located in The DLL AND SAPI Folders to the Main Folder (E.g. C: / PHP).
Here Is A List of Server Modules Shipped with PHP 4 and PHP 5:
* Sapi / php4activescript.dll (php5activescript.dll) - ActiveScript engine, allowing you to embed PHP in your Windows applications * sapi / php4apache.dll (php5apache.dll) -.. Apache 1.3.x module * sapi / php4apache2.dll ( php5apache2.dll) - Apache 2.0.x module * sapi / php4isapi.dll (php5isapi.dll) -. ISAPI Module for ISAPI compliant web servers like IIS 4.0 / PWS 4.0 or newer * sapi / php4nsapi.dll (php5nsapi.dll). - Sun / iPlanet / Netscape server module * sapi / php4pi3web.dll (no equivalent in PHP 5) -. Pi3Web server module.Server modules provide significantly better performance and additional functionality compared to the CGI binary The CLI version is designed to let you. Use PHP for Command Line Scripting. More Information About CLI Is Available In The Chapter About Using PHP from The Command Line.
Warning
The Sapi Modules Have Been Significantly Improved As of The 4.1 Release, HoWever, In Older Systems You May Encounter Server Errors or Other Server Modules Failing, Such as ASP.
The CGI and CLI binaries, and the web server modules all require the php4ts.dll (php5ts.dll) file to be available to them. You have to make sure that this file can be found by your PHP installation. The search order for this DLL IS AS FOLLOWS:
* The same directory from where php.exe is called, or in case you use a SAPI module, the web server's directory (eg C: / Program Files / Apache Group / Apache2 / bin) * Any directory in your Windows PATH environment variable. .
To make php4ts.dll / php5ts.dll available you have three options: copy the file to the Windows system directory, copy the file to the web server's directory, or add your PHP directory, C: / php to the PATH For better maintenance. , we advise you to follow the last option, add C:. / php to the PATH, because it will be simpler to upgrade PHP in the future Read more about how to add your PHP directory to PATH in the corresponding FAQ entry.The next Step is to set up a valid configuration file for php, php.ini. There is the zip file, php.ini-dist and php.ini-recommented. we advise you to use php.ini-recomment, because we optimized the default settings in this file for performance, and security. Read this well documented file carefully because it has changes from php.ini-dist that will drastically affect your setup. Some examples are display_errors being off and magic_quotes_gpc being off. in Addition to reading these, study the ini set tings and set every element manually yourself. If you would like to achieve the best security, then this is the way for you, although PHP works fine with these default ini files. Copy your chosen ini-file to a directory that PHP is able to Find and rename it to php.ini. PHP Searches for php.ini in The Following Locations (in ORDER):
* PHPIniDir directive (Apache 2 module only) * HKEY_LOCAL_MACHINE / SOFTWARE / PHP / IniFilePath * The PHPRC environment variable * Directory of PHP (for CLI), or the web server's directory (for SAPI modules) * Windows directory (C: / windows or C: / winnt)
If you are running Apache 2, the simpler option is to use the PHPIniDir directive (read the installation on Apache 2 page), otherwise your best option is to set the PHPRC environment variable This process is explained in the following FAQ entry.Note.: If You're Using NTFS ON Windows NT, 2000, XP OR 2003, Make Sure That The User Running The Web Server Has Read Permissions to your php.ini (EG Make It Readable by Everyone).
The Following Steps Are Optional:
* Edit your new php.ini file. If you plan to use omnihttpd, do not follow the next step. Set the doc_root to point to your web servers document_root. For example:
DOC_ROOT = C: / inetpub // for IIS / PWS
DOC_ROOT = C: / Apache / HTDOCS // for Apache
* Choose the extensions you would like to load when PHP starts. See the section about Windows extensions, about how to set up one, and what is already built in. Note that on a new installation it is advisable to first get PHP working and tested WITHOUT ANY EXTENSIONBI. * ON PWS AND IIS, You CAN Set The Browscap Configuration Setting To Point To: C: /Windows/System/inetsrv/Browscap.ini on Windows 9x / ME, C: / Winnt /system32/inetsrv/browscap.ini on nt / 2000, and c: /windows/system32/inetsrv/browscap.ini on xp. for an up-to-date browscap.ini, read the folload faq.
PHP is now setup on your system. The next step is to choose a web server, and enable it to run PHP. Choose a webserver from the table of contents. _________________________________________________________________
Activescript
This Section Contains Notes Specific To The ActiveScript Installation.
ActiveScript is a windows only SAPI that enables you to use PHP script in any ActiveScript compliant host, like Windows Script Host, ASP / ASP.NET, Windows Script Components or Microsoft Scriptlet control.As of PHP 5.0.1, ActiveScript has been moved to OR at http://snaps.php.net/.
NOTE: You Should Read The Manual Installation Steps First!
After Installing PHP, You Should Download The Activescript DLL (PHP5ACTIVEScript.dll) And Place It in The Main PHP Folder (E.G. C: / PHP).
After having all the files needed, you must register the DLL on your system To achieve this, open a Command Prompt window (located in the Start Menu) Then go to your PHP directory by typing something like cd C:.. / Php To. Register The DLL Just Type Regsvr32 PHP5Activescript.dll.
Test if Activescript is working, create a new file, named test.wsf (the extension is very important) and type: