KNOWNHOST WIKI

User Tools

Site Tools


developmental:phpinfo

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
developmental:phpinfo [2016/10/26 10:21]
mscherf [Getting or Creating the File] Removed reference to nonfunctional downloadable code block.
developmental:phpinfo [2020/06/03 08:25] (current)
Karson N. [Getting or Creating the File]
Line 1: Line 1:
 ====== Phpinfo ====== ====== Phpinfo ======
  
-Occasionally, while troubleshooting issues with a site, it can be useful to see all in one place all the current configuration for php affecting a particular folder or file. This can be done with the php function [[http://php.net/manual/en/function.phpinfo.php|phpinfo]]. Among other things, this function can tell you the currently loaded php modules, the currently loaded php settings, and predefined and environment variables.+Occasionally, while troubleshooting issues with a site, it can be useful to see all in one place all the current configuration for php affecting a particular folder or file. This can be done with the php function ((http://php.net/manual/en/function.phpinfo.php))[[http://php.net/manual/en/function.phpinfo.php|phpinfo]]. Among other things, this function can tell you the currently loaded php modules, the currently loaded php settings, and predefined and environment variables.
  
 +\\
 ===== Getting or Creating the File ===== ===== Getting or Creating the File =====
  
Line 18: Line 19:
 Here, we add a comment((the line starting with ''%%//%%'')) and a couple of blank lines to help make it easier to read. You will need to copy and paste this text into a plain text file. Here, we add a comment((the line starting with ''%%//%%'')) and a couple of blank lines to help make it easier to read. You will need to copy and paste this text into a plain text file.
  
-If creating the file yourself, make sure the whole file contains only the exact text in the code box above. Make sure there are no extra invisible characters. Sometimes text editors such as Notepad might include extra characters in files. If you are using a Windows machine to create the file, you may want to use a different text editor such as [[https://notepad-plus-plus.org/|Notepad++]]. It is also very important that the filename end in ''%%.php%%'' and not ''%%.php.txt%%''. Depending on your operating system, you may need to check if your file manager is configured to show file extensions, in order to check this.+If creating the file yourself, make sure the whole file contains only the exact text in the code box above. Make sure there are no extra invisible characters. Sometimes text editors such as Notepad might include extra characters in files. If you are using a Windows machine to create the file, you may want to use a different text editor such as ((https://notepad-plus-plus.org/))[[https://notepad-plus-plus.org/|Notepad++]]. It is also very important that the filename end in ''%%.php%%'' and not ''%%.php.txt%%''. Depending on your operating system, you may need to check if your file manager is configured to show file extensions, in order to check this.
  
 +\\
 ===== Uploading the File ===== ===== Uploading the File =====
  
-Once the file has been created, it can be uploaded to somewhere within the documentroot of the site. For cPanel servers, the cPanel [[https://documentation.cpanel.net/display/ALD/File+Manager|File Manager]] is probably one of the easiest ways to do this. If you are more comfortable with [[software:how-can-i-configure-filezilla-to-upload-files-via-sftp|FTP]] or [[https://documentation.cpanel.net/display/ALD/Web+Disk|Web Disk]] for example, those should also work. Make sure the file has the user and group ownership both set to the cPanel user, and that the file permissions are 644. How to check and adjust this will vary depending on the method used to upload the file.+Once the file has been created, it can be uploaded to somewhere within the documentroot of the site. For cPanel servers, the cPanel ((https://documentation.cpanel.net/display/ALD/File+Manager))[[https://documentation.cpanel.net/display/ALD/File+Manager|File Manager]] is probably one of the easiest ways to do this. If you are more comfortable with [[software:how-can-i-configure-filezilla-to-upload-files-via-sftp|FTP]] or ((https://documentation.cpanel.net/display/ALD/Web+Disk))[[https://documentation.cpanel.net/display/ALD/Web+Disk|Web Disk]] for example, those should also work. Make sure the file has the user and group ownership both set to the cPanel user, and that the file permissions are 644. How to check and adjust this will vary depending on the method used to upload the file.
  
 +\\
 ===== Accessing the File ===== ===== Accessing the File =====
  
 Once the file has been uploaded with the correct permissions and ownership, you can view your new phpinfo page with your web browser. For example, if the file was placed at ''%%/home/cpuser/public_html/phpinfo.php%%'' within the server, then its url might be ''%%http://domain.tld/phpinfo.php%%''. If it was uploaded correctly, it should look like several tables, with setting/variable names in the left column, and values in the right one or two columns. If there is a specific setting you are looking for, you can use your web browser's search function((usually Ctrl+F)) to help you find it. Once the file has been uploaded with the correct permissions and ownership, you can view your new phpinfo page with your web browser. For example, if the file was placed at ''%%/home/cpuser/public_html/phpinfo.php%%'' within the server, then its url might be ''%%http://domain.tld/phpinfo.php%%''. If it was uploaded correctly, it should look like several tables, with setting/variable names in the left column, and values in the right one or two columns. If there is a specific setting you are looking for, you can use your web browser's search function((usually Ctrl+F)) to help you find it.
  
 +\\
 ===== Removing the File ===== ===== Removing the File =====
  
-It is very important not to leave the phpinfo file active any longer than necessary. The information it provides can be very useful to you during troubleshooting, but it can also be very useful to potential attackers who may be trying to get information from your server about what versions or modules might be installed, which could give them clues for what types of attacks to try. Using a phpinfo file for a short period of time to get php environment information during the troubleshooting process is usually safe, but it is important to remove it((or block access to it)) as soon as you are finished using it. There are [[https://documentation.cpanel.net/display/ALD/File+Manager|a]] [[software:how-can-i-configure-filezilla-to-upload-files-via-sftp|variety]] [[https://documentation.cpanel.net/display/ALD/Web+Disk|of]] [[software:how-can-i-use-putty-software-to-ssh-to-my-cpanel-server|ways]] to accomplish this.+It is very important not to leave the phpinfo file active any longer than necessary. The information it provides can be very useful to you during troubleshooting, but it can also be very useful to potential attackers who may be trying to get information from your server about what versions or modules might be installed, which could give them clues for what types of attacks to try. Using a phpinfo file for a short period of time to get php environment information during the troubleshooting process is usually safe, but it is important to remove it((or block access to it)) as soon as you are finished using it. There are ((https://documentation.cpanel.net/display/ALD/File+Manager))[[https://documentation.cpanel.net/display/ALD/File+Manager|a]] [[software:how-can-i-configure-filezilla-to-upload-files-via-sftp|variety]] ((https://documentation.cpanel.net/display/ALD/Web+Disk))[[https://documentation.cpanel.net/display/ALD/Web+Disk|of]] [[software:how-can-i-use-putty-software-to-ssh-to-my-cpanel-server|ways]] to accomplish this.
  
 +\\
 ===== Advanced Usage ===== ===== Advanced Usage =====
  
-Advanced users may wish to instruct the phpinfo function to only print some of the information. The function has a parameter for this which you can read more details about in the [[http://php.net/manual/en/function.phpinfo.php|php documentation]]. For most users, the default((showing all information)) should work fine.+Advanced users may wish to instruct the phpinfo function to only print some of the information. The function has a parameter for this which you can read more details about in the ((http://php.net/manual/en/function.phpinfo.php))[[http://php.net/manual/en/function.phpinfo.php|php documentation]]. For most users, the default((showing all information)) should work fine.
  
 Another thing advanced users may occasionally have cause to try, is using the phpinfo function within existing scripts. Because php scripts can sometimes change some of the php functions, it might be useful while debugging specific scripts to add phpinfo lines inside those specific scripts, to check if the environment still has the same settings and variable values as expected, at the specific places within the script where the debugging is needed. If doing this, make sure to remove these extra debugging function calls when you are finished with them. Another thing advanced users may occasionally have cause to try, is using the phpinfo function within existing scripts. Because php scripts can sometimes change some of the php functions, it might be useful while debugging specific scripts to add phpinfo lines inside those specific scripts, to check if the environment still has the same settings and variable values as expected, at the specific places within the script where the debugging is needed. If doing this, make sure to remove these extra debugging function calls when you are finished with them.
developmental/phpinfo.1477495264.txt.gz · Last modified: 2016/10/26 10:21 by mscherf