It is quite usual that you may sometime need to view your PHP settings set by your web hosting provider, especially if you are running WordPress website. Here is a complete guide on How to View PHP settings of your web hosting server. We will be showing in depth that how you can check the PHP settings very easily by creating a phpinfo page. And this will only take 5 minutes.
PHP is very versatile language and has many environmental variables that you can update as per your requirement. This is especially true if you are running WordPress, as the WordPress framework completely depends on PHP and may of the times it needs some PHP value to be changed to work properly.
For example, to properly run a plugin you may need to update your PHP memory_limit to prevent it from running out of memory, or to update the max_execution_time to prevent any application from stopping prematurely.
In order to change PHP values, you must first know how to check the current values of PHP variables. For that, all you need to do is to create a phpinfo page. Later, by accessing that page you can view and check all of your PHP environment settings.
How to Create a phpinfo Page?
Creating a phpinfo file is very easy; it can be done by writing the following code in a text file and save it as .php file.
<? phpinfo(); ?>
Step 1: Open any text editor like Notepad, Wordpad, Notepad++ etc.
Step 2: Paste the following code into the editor
<? phpinfo(); ?>
Step 3: Save that file as anyname.php (without any .txt extension), where “anyname” equals to any arbitrary name. [Caution: Don’t give any common file name such as phpinfo.php, as anyone accessing this file will be able to view your server settings]
Step 4: Open your favorite FTP client, and connect to your web hosting server.
Step 5: Browse to “public_html” or “htdocs” depending on your server.
Step 6: upload the newly created anyname.php file.
Step 7: Access and view the PHP settings of your server by typing the below URL to any web browser. http://yoursite.com/anyname.php
Caution: Please note that your phpinfo page will display many php settings that you don't want to share with any outsider. Don't use any common name such as phpinfo.php. Bots and hackers on the web generally search for files named phpinfo.php. When you don't require the file anymore, be sure to delete it. Alternatively, instead of deleting it you can rename the file with any arbitrary file name that is not at all common. Renaming the file to something like 6248971204adjnuirskc.php would never be guessed by any bots or hackers (so no one would ever find it). However it may also be difficult for you to remember this type of name, so write it down somewhere.
How to Find and View PHP Settings?
As told earlier you can access the page from your browser. If you have uploaded the phpinfo file in your "public_html" or "htdocs" folder, then you can view php settings by visiting http://yoursite.com/filename.php. Then you can see a page similar to the one shown below:
This is a large list showing each and every settings of your PHP enabled server. To find the value of any specific setting, you can either scroll to that section or can search the page to find what you're looking for. To find a particular php setting, you can use your browser's search feature (Ctrl + f or Command+f) and searched for any settings. Here we have to search for max_execution_time, which stops any scripts to run more than the time set, thus restricts any poorly written script to run infinitely. An Image is shown below.
The value in the second column is what is set for the current directory (local value), and the value in the third column is the master value set globally by the server. The local value (2nd column) is the actual setting in effect and is the important value because the local values override the master value in default server configuration.
If you want to know that how to change any of these values, please refer to our article: How to change PHP settings in WordPress using .htaccess & php.ini?
We hope that you have enjoyed the above article about How to view PHP settings of web servers. Be with us to explore free training on Leading Technologies and Certifications.
Leave us some comments if you have any question or facing issues while viewing PHP settings.