PHP Setup


PHP resides on the web server. For most web servers, PHP support is active; however, for some stand-alone systems, especially Windows, you might need to activate or install the PHP support. Activation of PHP on Linux systems is usually taken care of during installation. Refer to the documentation for your specific version of Linux for details regarding PHP installation.

Checking for PHP Activation

On Windows systems, you can check to see if PHP is activated as follows :

  1. Select the Add/Remove Programs icon in the Control Panel.

  2. Select Add/Remove Windows Components .

  3. PHP is included in the list of Windows components that appears. If its check box is checked, the PHP component is already installed. If IIS is checked, IIS is already active.

  4. If the IIS check box isn t selected, choose it and continue with its installation, inserting the Windows operating system CD if requested .

In addition to many other functions, IIS will recognize files with the .php extension as being files that contain PHP code.

Verifying PHP Installation

If you want to verify whether a specific server has PHP installed in its configuration, you can run a simple PHP command, embedded in an HTML page, and the resulting web page will print information if PHP is installed. This simple verification works with any operating system.

Open a word processing program and type in the following code:

 <?php    phpinfo(); ?> 

Save the text as a .php file into your Internet directory. The Internet directory on Linux is public_html. On Windows, if you are using Apache for a web server, the Internet directory is C:\Program Files\Apache Group\Apache2\htdocs. If you are using IIS as the web server, the directory is C:\Inetpub\ wwwroot , which you can access by entering localhost into the browser.

Now, look at your .php file in a web browser. If PHP is installed on your operating system and your web server is activated, you will see a list of information about PHP on your machine, as shown in the example in Figure C-1. If PHP is not installed, you will see the code from the .php file displayed in the browser window.


Figure C-1: If PHP is installed, you ll see a page of information similar to this.



MySQL(c) Essential Skills
MySQL: Essential Skills
ISBN: 0072255137
EAN: 2147483647
Year: 2006
Pages: 109

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net