Troubleshooting

This section describes some common problems encountered with the installation of PHP.

Unable to Change PHP Settings
Displays Error Message: Undefined Function
MySQL Functions Not Activated
Displays a Blank Page or HTML Code Only

Unable to Change PHP settings

If you change settings in your php.ini file but the changes don’t seem to have the expected effect on PHP operations, one of two things is probably the cause--you did not restart the Web server after making changes or you may be editing the wrong php.ini file.

First, you must restart the Web server before the changes go into effect.

Second, you may not be editing the php.ini file in the location where PHP is reading it. You can check which php.ini file PHP is reading. You may have more than one php.ini file or you may have it stored in the wrong location. When you test PHP using the phpinfo() statement, as shown in Testing PHP, PHP outputs many variable values and settings. One of the settings close to the top is Configuration File Path, which shows the path to the location where PHP is looking for the configuration file. If the path ends in a filename, that’s the file PHP is using for its configurations. If the path ends in a directory name, PHP is looking in the directory for the configuration file but can’t find it, so PHP is using its default configurations.

Displays Error Message: Undefined Function

You might see an error message stating that you called an undefined function. This message means that you are calling a function that PHP doesn't recognize. You may have misspelled the function name or you may be calling a function in an extension that is not activated.

You may see an error message complaining of a mysqli function, similar to the following:

   Fatal error: Call to undefined function mysqli_connect()
This means that MySQL support is not activated for the mysqli functions. Either you did not activate any MySQL support or you activated the mysql extension, rather than the mysqli function.

If MySQL support is not activated, either the extension line in php.ini is not activated or PHP cannot find the necessary files. Check the extension line in php.ini to be sure the semicolon is removed from the beginning of the mysqli extension line. If php.ini looks correct, you may have forgotten to restart the Web server after making the change. You can also try stopping the Web server completely and then starting it, rather than restarting it. And finally, you may be editing the wrong php.ini file. Make sure the php.ini file you are editing is in the location where PHP is looking for it, as shown in the output from phpinfo().

Check that the directory where php_mysql.dll and libmysql.dll are located is in your system path. You can check your path in the output from phpinfo(). The Environment section toward the end of the output shows the path. However, the path shown is not the path that is currently in effect unless you restarted the system after changing the path. When you change the path, the new path is displayed, but doesn't actually become active until the system is restarted.

See how to set the system path

MySQL Functions not Activated

When you look at the output from phpinfo(), you do not see a section for the mysql or mysqli extension. However, in your php.ini file, one or both of the extensions are activated. Some possible causes are:

Displays a Blank Page or HTML Output Only

When you look a Web page in your browser and a blank page displays or only the HTML output displays, the Web server is not sending the PHP code to PHP for processing.

You may not be viewing the Web page through the Web server. You cannot open the Web page by selecting File->Open Page in your browser menu. You must type the URL to the page, such as localhost/test.php, in the browser address window.

You may not have your Web server configured correctly for PHP. Check the section on Configuring your Web Server. Double check that the Apache directives are typed correctly and in the correct location. Be sure to restart the Web server after making any changes.