Monday, February 25, 2008

How to test whether PHP is working?

To test whether PHP is installed and working, follow these steps:
  • Find the directory in which your PHP programs need to be saved. This directory and the subdirectories under it are your Web space. Apache calls this directory the document root. The default Web space for Apache is htdocs in the directory where Apache is installed. For IIS, it’s Inetpub\wwwroot. In Linux, it might be /var/www/html. The Web space can be set to a different directory by configuring the Web server (see Appendix C). If you’re using a Web hosting company, the staff will supply the directory name.
  • Create the following file somewhere in your Web space with the name test.php. Download the PHP file in http://mihd.net/4edokm

The file must be saved in your Web space for the Web server to find it.
    • Point your browser at the test.php file created in Step 1. That is, type the name of your Web server into the browser address window, followed by the name of the file (for example, www.myfinecompany.com/test.php). If your Web server, PHP, and the test.php file are on the same computer that you’re testing from, you can type localhost/test.hp. For the file to be processed by PHP, you need to access the file through the Web server — not by choosing FileOpen from your Web browser menu.
You should see the following in the Web browser:

This is an HTML line
This is a PHP line

Below these lines, you should see a large table that shows all the information associated with PHP on your system. It shows PHP information, pathnames and filenames, variable values, and the status of various options. The table is produced by the phpinfo() line in the test script. Anytime that you have a question about the settings for PHP, you can use the phpinfo() statement to display this table and check a setting.
  • Check the PHP values for the settings you need. For instance, you need MySQL support enabled. Looking through the listing, find the section for MySQL and make sure that MySQL support is On. PHP has many settings that can be changed. Various PHP settings are discussed throughout the book in the appropriate sections.
  • Change values if necessary. The general settings for PHP are stored in a file named php.ini. If you installed PHP yourself, you can edit php.ini and change settings. If your Web site is located on a company computer or a Web hosting company computer, you may not have access to php.ini to change settings. You can request the PHP administrator to change settings. For some settings, you can temporarily change a setting with a statement in your PHP program, but not all settings can be changed in a program.

No comments:

 
breast-cancer diabetes-informa... weight-losse lung-mesotheliom... eating-disorders medical-billing php-and-mysql skin-cancer medical-health astronomy-guide cancer-diseases health insurance seo-news-2008 forex3003 lawyer-lookingforalawyer earnmoneyonline-earn forexautotrading-forex forex-trade forextrading forex-trading-forex-trading-08 searchingforcancertreatment adsense jiankang8008 beauty-girl forex5005