Just a few minutes ago I posted the first blog post of this series: Troubleshooting PHP timeouts in GoDaddy Windows hosted Wordpress blogs – Part 1. It basically talked about how shared hosting environments are black boxes and that if you need more resources (a bigger share) on your shared server, you need to complain about the ridiculous response times to the shared hosting provider.
This blog post is a little bit more technical and is the first step of shedding light into the black box of a shared hosting server.
Figure 1: Going down a black hole
PHP System Info
Before you start troubleshooting anything try to get a picture of the environment your application is running in. Here is how you can go about it.
Create a text file called phpinfo.php.
This file has the following php snippet in it:
Copy the file to the root directory
Use a FTP client and copy the file to the root directory of your php application that performs poorly.
Figure 2: phpinfo.php in root directory of application
Navigate your browser
Open your browser and navigate to http://yourdomain/phpinfo.php
When you call this script it will call the phpinfo() function and provide you with all kinds of valuable information about the computer that is hosting your application.
Here is a short except:
Figure 3: phpinfo() output
The important pieces of information are the debug and logging settings, the timeout configuration and the memory limits:
Figure 4: Important configuration settings
Further down you will find some information about the windows computer in the _SERVER variable.
Delete the phpinfo.php script
Don’t forget to delete the script file after you gathered the information.
The phpinfo.php script can be downloaded here: phpinfo.zip
This is just the start. The big question that I would like to get answered in upcoming posts is how to configure the critical PHP settings and how to profile PHP on a shared hosting server.