{"id":751,"date":"2021-07-08T06:24:50","date_gmt":"2021-07-08T11:24:50","guid":{"rendered":"https:\/\/www.knownhost.com\/kb\/?p=751"},"modified":"2021-10-18T06:40:58","modified_gmt":"2021-10-18T11:40:58","slug":"enable-php-error-logging-for-debug-testing","status":"publish","type":"post","link":"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/","title":{"rendered":"Enable PHP Error Logging for Debug Testing"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-right counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #212121;color:#212121\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #212121;color:#212121\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/#planning_what_settings_to_use\" >Planning What Settings To Use<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/#creating_the_error_log\" >Creating the Error Log<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/#root_access\" >Root Access<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/#cpanel_user_access\" >cPanel User Access<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/#how_to_enable_php_error_logging\" >How to Enable PHP Error Logging<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/#suphp\" >suPHP<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/#dso\" >DSO<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/#testing_your_changes\" >Testing Your Changes<\/a><\/li><\/ul><\/nav><\/div>\n\n<p>PHP error logging for your site is an optional level of logging that can be <a href=\"https:\/\/www.knownhost.com\/kb\/wordpress-debug-troubleshooting\/\">enabled<\/a> to log errors that occur with PHP code. There are several reasons you may choose to enable PHP error logging. You may want to enable PHP error logging if you&#8217;re actively developing your site to aid in troubleshooting. If you have encountered the dreaded &#8216;white page of death&#8217; error (that error that loads a blank page and tells you nothing regarding what is wrong). Or a &#8220;500 error&#8221; that doesn&#8217;t log to the Apache error log as &#8216;real&#8217; 500 level errors do, then you will need to enable PHP error logging for your site to find the script error. Doing so will cause PHP errors to be logged in the location you choose so that you can determine what is causing the error and work to fix it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"planning_what_settings_to_use\"><\/span>Planning What Settings To Use<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>You should decide what log settings you need to set before enabling. Most of the time, you will simply choose to have PHP errors logged to a private log in a location that you specify. If the site is&nbsp;<em>not<\/em>&nbsp;live, then you may also choose to have the errors displayed on the site in the browser.&nbsp;<strong>NOTE:<\/strong>&nbsp;Displaying PHP errors on a live site is a security issue so do&nbsp;<em>not<\/em>&nbsp;enable this setting on a live site! Here are the recommended settings for a live site:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  log_errors = on\n  error_log = \/path\/to\/docroot\/error_log\n  display_errors = off<\/code><\/pre>\n\n\n\n<p>The recommended settings for a development site that is&nbsp;<em>not<\/em>&nbsp;live are below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  log_errors = on\n  error_log = \/path\/to\/docroot\/error_log\n  display_errors = on<\/code><\/pre>\n\n\n\n<p>Both of the examples shown above do not include an actual path. You may have to create the error_log file, replacing &#8216;\/path\/to\/docroot\/error_log&#8217; with the exact path to the file. I typically place these in the public_html, and then also make a .htaccess rule to prevent unauthorized access to this log. Go ahead and determine what settings you will be using.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"creating_the_error_log\"><\/span>Creating the Error Log<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"root_access\"><\/span>Root Access<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>To create the file under the cPanel user &#8216;cp_user&#8217;, you would do the following as the user root via SSH (the document root for most cPanel-hosted main domains is the public_html):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  cd \/home\/cp_user\/public_html\n  touch error_log\n  chown cp_user: error_log<\/code><\/pre>\n\n\n\n<p>Also, be sure that the log can be written to by the user (permissions of 644 should be fine for most KnownHost systems). Do the following to view the file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  ls -lah \/home\/cp_user\/public_html\/error_log<\/code><\/pre>\n\n\n\n<p>The permissions should read as follows if set to 644:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  -rw-r--r--<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"cpanel_user_access\"><\/span>cPanel User Access<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>If you do not have root access and need to make these changes as the cPanel user, there are a few ways you can do this. You can use cPanel&#8217;s File Manager,&nbsp;FTP, or SSH if the cPanel user has SSH access. Let&#8217;s use the File Manager.<\/p>\n\n\n\n<p>Log into your user&#8217;s cPanel account at the following&nbsp;URL&nbsp;(replacing&nbsp;<em>yourdomain.tld<\/em>&nbsp;with your actual domain):<\/p>\n\n\n\n<p><strong>https:\/\/yourdomain.tld\/cpanel<\/strong><\/p>\n\n\n\n<p>Navigate as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  cPanel &gt;&gt; Files &gt;&gt; File Manager<\/code><\/pre>\n\n\n\n<p>Click the File Manager Icon<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"150\" height=\"56\" src=\"https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/fmicon.png\" alt=\"\" class=\"wp-image-752\"\/><\/figure>\n\n\n\n<p>A new window will open showing the file system. In the top left corner, you will see icons to add files and directories:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"303\" src=\"https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/fileman2-1024x303.png\" alt=\"\" class=\"wp-image-753\" srcset=\"https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/fileman2-1024x303.png 1024w, https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/fileman2-300x89.png 300w, https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/fileman2-768x227.png 768w, https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/fileman2.png 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Click the &#8220;+ File&#8221; button to create a new file. A new dialog box will open. You will input the details of the file to be created here:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"500\" height=\"249\" src=\"https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/new_file1.png\" alt=\"\" class=\"wp-image-754\" srcset=\"https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/new_file1.png 500w, https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/new_file1-300x149.png 300w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/figure>\n\n\n\n<p>Click the button to create the file.<\/p>\n\n\n\n<p>Next, you can use the navigation on the far left to change into the directory that should contain the file to confirm that it was in fact created and has the appropriate permissions.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"197\" src=\"https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/file-created-1024x197.png\" alt=\"\" class=\"wp-image-755\" srcset=\"https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/file-created-1024x197.png 1024w, https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/file-created-300x58.png 300w, https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/file-created-768x148.png 768w, https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/file-created.png 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"how_to_enable_php_error_logging\"><\/span>How to Enable PHP Error Logging<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>First, you need to decide whether you should enable PHP error logging via a php.ini file or via .htaccess. This will depend on what PHP Handler you are using. To find out what PHP Handler you are using with a cPanel server, run the following as the root user via SSH:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  \/usr\/local\/cpanel\/bin\/rebuild_phpconf --current<\/code><\/pre>\n\n\n\n<p>If you are using multiple versions of PHP, you may need to determine what version of PHP your site is using to determine the correct PHP handler.<\/p>\n\n\n\n<p>If you lack root access, you can upload a phpinfo file to your site, and then check it to determine your current PHP Handler. To do so, log into cPanel, navigate to the File Manager, click the button to add a file, name the file phpinfo.php, and add the following content:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  &lt;?php phpinfo(); ?&gt;<\/code><\/pre>\n\n\n\n<p>Now, visit your site&#8217;s phpinfo.php page in the browser:<\/p>\n\n\n\n<p><strong>https:\/\/yoursite.tld\/phpinfo.php<\/strong><\/p>\n\n\n\n<p>Look for &#8220;Server&nbsp;API&#8221;. If you see &#8220;Apache 2.0 Handler&#8221;, then you are using DSO. If you see &#8220;CGI\/FastCGI&#8221; or &#8220;CGI&#8221;, then you are likely using suPHP, CGI, or FastCGI.<\/p>\n\n\n\n<p>Example: suPHP, CGI, FastCGI will be shown. The &#8220;Server&nbsp;API&#8221; is near the top of the phpinfo page:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"600\" height=\"204\" src=\"https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/phpino-cgi.png\" alt=\"\" class=\"wp-image-756\" srcset=\"https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/phpino-cgi.png 600w, https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/phpino-cgi-300x102.png 300w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/figure>\n\n\n\n<p>Example: DSO is in use when &#8220;Apache 2.0 Handler&#8221; is shown next to the &#8220;Server&nbsp;API&#8221; in the phpinfo page:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"600\" height=\"29\" src=\"https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/phpinfo-dso.png\" alt=\"\" class=\"wp-image-757\" srcset=\"https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/phpinfo-dso.png 600w, https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/phpinfo-dso-300x15.png 300w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"suphp\"><\/span>suPHP<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>If you are using suPHP, then you will want to enable logging via the php.ini as shown below (note that you will want to edit&nbsp;<em>display_errors<\/em>&nbsp;accordingly):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  log_errors = on\n  error_log = \/path\/to\/docroot\/error_log\n  display_errors = off<\/code><\/pre>\n\n\n\n<p>If the php.ini and error log files do not exist, you will want to create both and make sure to change the ownership of both to the user. The php.ini can be created in the same way as the error_log was as shown in the previous section. If both of these files already exist, then you should make a backup of each before you make any changes. You can make a backup of these files using the&nbsp;<em>cp<\/em>&nbsp;command as the root user as shown below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  cp -a \/path\/to\/file \/path\/to\/file.backup<\/code><\/pre>\n\n\n\n<p>This command makes a copy of the file with its current ownership and permissions with the &#8216;.backup&#8217; extension.<\/p>\n\n\n\n<p>You can accomplish this in cPanel&#8217;s File Manager by first selecting the file to make a backup of, and then click the &#8220;Copy&#8221; icon in the toolbar. Enter the name of the file followed by &#8216;.bak&#8217; when prompted for the location to copy the file to:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"500\" height=\"215\" src=\"https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/fm-copy-file.png\" alt=\"\" class=\"wp-image-758\" srcset=\"https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/fm-copy-file.png 500w, https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/fm-copy-file-300x129.png 300w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/figure>\n\n\n\n<p>Click &#8220;Copy File(s)&#8221; and the file will be copied with the new name in the location specified.<\/p>\n\n\n\n<p>After making copies of any existing error_log files and php.ini files, you can proceed to edit them as needed. Since you have a backup of the error_log, you may decide to clear it before you start writing to it again. If so, you can do so with the following command as the root user:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  &gt; error_log<\/code><\/pre>\n\n\n\n<p>If you are using File Manager, just delete and recreate the file.<\/p>\n\n\n\n<p>After you edit the php.ini file with the details above accordingly and create the error log, you should start seeing errors written to the file as soon as they are triggered.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"dso\"><\/span>DSO<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>If you are using DSO, then you will want to enable logging via the .htaccess as shown below using the php_flag and php_value directives:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  php_flag  log_errors on\n  php_value error_log  \/path\/to\/docroot\/error_log\n  php_flag display_errors off<\/code><\/pre>\n\n\n\n<p>It is also a good idea to make a backup of the .htaccess if one exists before making any changes! You can make a backup of the file using the cp command as the root user as shown below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  cp -a \/path\/to\/file \/path\/to\/file.backup<\/code><\/pre>\n\n\n\n<p>This command makes a copy of the file with its current ownership and permissions with the &#8216;.backup&#8217; extension.<\/p>\n\n\n\n<p>You can accomplish this also in cPanel&#8217;s File Manager by first selecting the file to make a backup of, and then click the \u201cCopy\u201d icon in the toolbar. Enter the name of the file followed by &#8216;.bak&#8217; when prompted for the location to copy the file to. Click \u201cCopy File(s)\u201d and the file will be copied with the new name in the location specified. Then you can proceed to edit the .htaccess with the error logging directives noted.<\/p>\n\n\n\n<p>If an error_log already exists, you can make a backup of it as well, then delete it and recreate it with the correct permissions and ownership so that it is empty. To empty the error_log as root, you could just run this command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  &gt; error_log<\/code><\/pre>\n\n\n\n<p>Immediately after making such changes, I always watch the Apache error log and reload the site (just to make sure I didn&#8217;t break the site due to a typo or other mistake). To watch the Apache error log, use the following command via SSH as the root user:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  tail -f \/usr\/local\/apache\/logs\/error_log<\/code><\/pre>\n\n\n\n<p>If any mistakes were made that would adversely affect the site, they would be logged here upon reloading the site (this isn&#8217;t a common occurrence, but it is always good to check).<\/p>\n\n\n\n<p>If you don&#8217;t have root access, go ahead and just reload the site anyway to ensure it isn&#8217;t broken after making these changes. Remember to either clear your browser cache or use a new browser so that browser caching doesn&#8217;t affect the results.<\/p>\n\n\n\n<p>Finally, to disable access to your error logs, you can add the following to your .htaccess:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  # prevent access to PHP error log\n  &lt;Files error_log&gt;\n   Order allow,deny\n   Deny from all\n  &lt;\/Files&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"testing_your_changes\"><\/span>Testing Your Changes<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>You may want to test and ensure that your error log is working as desired, especially if you are troubleshooting an error that only occurs intermittently and you are unable to trigger it on demand. You will want to be sure the error log is effectively logging errors so that you can capture the error when it occurs next. First, create a new PHP script as the root user and give it the correct ownership (change &#8216;cp_user&#8217; to your cPanel user):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  touch error_logging_test.php\n  chown cp_user: error_logging_test.php<\/code><\/pre>\n\n\n\n<p>Edit the file with the following content:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n   error_log(\"This is a custom error message constructed to test the php error logging functionality of this site.\\n\");\n?&gt;<\/code><\/pre>\n\n\n\n<p>Now, watch the error log and load your script in the browser:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  tail -f \/path\/to\/docroot\/error_log<\/code><\/pre>\n\n\n\n<p>If your site is my-site.tld, then you will visit my-site.tld\/error_logging_test.php in the browser. This should trigger the error defined within the script to be written to the error log that we&#8217;ve enabled. You should now see the error appear in the error log if error logging is working properly.<\/p>\n\n\n\n<p>You can do the same as the <a href=\"https:\/\/docs.cpanel.net\/cpanel\/files\/file-manager\/\">cPanel user using File Manager<\/a>. You would create the new file named &#8220;error_logging_test.php&#8221;, add the content above, and save. You would then test the script by visiting my-site.tld\/error_logging_test.php in the browser (replacing my-site.tld with your actual domain). You should now be able to check the error_log and see if the error generated by visiting the script is present. If so, then error logging is working as expected. If not, please open a support ticket and we&#8217;ll be glad to help.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP error logging for your site is an optional level of logging that can be enabled to log errors that occur with PHP code. There are several reasons you may choose to enable PHP error logging. You may want to enable PHP error logging if you&#8217;re actively developing your site to aid in troubleshooting. If [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[94],"tags":[109,155,128,123,198],"class_list":["post-751","post","type-post","status-publish","format-standard","hentry","category-common-issues","tag-cpanel","tag-debug","tag-directadmin","tag-linux","tag-php"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Enable PHP Error Logging for Debug Testing - KnownHost<\/title>\n<meta name=\"description\" content=\"Having issues with your WordPress website? In this guide we will show you how to enable error logging so you can test your websites issues.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Enable PHP Error Logging for Debug Testing - KnownHost\" \/>\n<meta property=\"og:description\" content=\"Having issues with your WordPress website? In this guide we will show you how to enable error logging so you can test your websites issues.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/\" \/>\n<meta property=\"og:site_name\" content=\"KnownHost\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-08T11:24:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-10-18T11:40:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/fmicon.png\" \/>\n<meta name=\"author\" content=\"Jonathan K. W.\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jonathan K. W.\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/enable-php-error-logging-for-debug-testing\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/enable-php-error-logging-for-debug-testing\\\/\"},\"author\":{\"name\":\"Jonathan K. W.\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/3db6e20d1f33519cd68fe0ba1230a48b\"},\"headline\":\"Enable PHP Error Logging for Debug Testing\",\"datePublished\":\"2021-07-08T11:24:50+00:00\",\"dateModified\":\"2021-10-18T11:40:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/enable-php-error-logging-for-debug-testing\\\/\"},\"wordCount\":1716,\"image\":{\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/enable-php-error-logging-for-debug-testing\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/fmicon.png\",\"keywords\":[\"cpanel\",\"debug\",\"directadmin\",\"linux\",\"php\"],\"articleSection\":[\"Common Issues\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/enable-php-error-logging-for-debug-testing\\\/\",\"url\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/enable-php-error-logging-for-debug-testing\\\/\",\"name\":\"Enable PHP Error Logging for Debug Testing - KnownHost\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/enable-php-error-logging-for-debug-testing\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/enable-php-error-logging-for-debug-testing\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/fmicon.png\",\"datePublished\":\"2021-07-08T11:24:50+00:00\",\"dateModified\":\"2021-10-18T11:40:58+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/3db6e20d1f33519cd68fe0ba1230a48b\"},\"description\":\"Having issues with your WordPress website? In this guide we will show you how to enable error logging so you can test your websites issues.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/enable-php-error-logging-for-debug-testing\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/enable-php-error-logging-for-debug-testing\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/enable-php-error-logging-for-debug-testing\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/fmicon.png\",\"contentUrl\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/fmicon.png\",\"width\":150,\"height\":56},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/enable-php-error-logging-for-debug-testing\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Enable PHP Error Logging for Debug Testing\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/#website\",\"url\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/\",\"name\":\"KnownHost\",\"description\":\"KnownHost provides a comprehensive webhosting knowledge base to help answer many of your common webhosting and linux questions.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/3db6e20d1f33519cd68fe0ba1230a48b\",\"name\":\"Jonathan K. W.\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f432b99e6651fe8d1deb57a285bd84e806f1c9ae8b4c6c585d7e3a0b33789ad9?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f432b99e6651fe8d1deb57a285bd84e806f1c9ae8b4c6c585d7e3a0b33789ad9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f432b99e6651fe8d1deb57a285bd84e806f1c9ae8b4c6c585d7e3a0b33789ad9?s=96&d=mm&r=g\",\"caption\":\"Jonathan K. W.\"},\"sameAs\":[\"https:\\\/\\\/www.knownhost.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Enable PHP Error Logging for Debug Testing - KnownHost","description":"Having issues with your WordPress website? In this guide we will show you how to enable error logging so you can test your websites issues.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/","og_locale":"en_US","og_type":"article","og_title":"Enable PHP Error Logging for Debug Testing - KnownHost","og_description":"Having issues with your WordPress website? In this guide we will show you how to enable error logging so you can test your websites issues.","og_url":"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/","og_site_name":"KnownHost","article_published_time":"2021-07-08T11:24:50+00:00","article_modified_time":"2021-10-18T11:40:58+00:00","og_image":[{"url":"https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/fmicon.png","type":"","width":"","height":""}],"author":"Jonathan K. W.","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Jonathan K. W.","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/#article","isPartOf":{"@id":"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/"},"author":{"name":"Jonathan K. W.","@id":"https:\/\/www.knownhost.com\/kb\/#\/schema\/person\/3db6e20d1f33519cd68fe0ba1230a48b"},"headline":"Enable PHP Error Logging for Debug Testing","datePublished":"2021-07-08T11:24:50+00:00","dateModified":"2021-10-18T11:40:58+00:00","mainEntityOfPage":{"@id":"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/"},"wordCount":1716,"image":{"@id":"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/#primaryimage"},"thumbnailUrl":"https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/fmicon.png","keywords":["cpanel","debug","directadmin","linux","php"],"articleSection":["Common Issues"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/","url":"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/","name":"Enable PHP Error Logging for Debug Testing - KnownHost","isPartOf":{"@id":"https:\/\/www.knownhost.com\/kb\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/#primaryimage"},"image":{"@id":"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/#primaryimage"},"thumbnailUrl":"https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/fmicon.png","datePublished":"2021-07-08T11:24:50+00:00","dateModified":"2021-10-18T11:40:58+00:00","author":{"@id":"https:\/\/www.knownhost.com\/kb\/#\/schema\/person\/3db6e20d1f33519cd68fe0ba1230a48b"},"description":"Having issues with your WordPress website? In this guide we will show you how to enable error logging so you can test your websites issues.","breadcrumb":{"@id":"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/#primaryimage","url":"https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/fmicon.png","contentUrl":"https:\/\/www.knownhost.com\/kb\/wp-content\/uploads\/2021\/07\/fmicon.png","width":150,"height":56},{"@type":"BreadcrumbList","@id":"https:\/\/www.knownhost.com\/kb\/enable-php-error-logging-for-debug-testing\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.knownhost.com\/kb\/"},{"@type":"ListItem","position":2,"name":"Enable PHP Error Logging for Debug Testing"}]},{"@type":"WebSite","@id":"https:\/\/www.knownhost.com\/kb\/#website","url":"https:\/\/www.knownhost.com\/kb\/","name":"KnownHost","description":"KnownHost provides a comprehensive webhosting knowledge base to help answer many of your common webhosting and linux questions.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.knownhost.com\/kb\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.knownhost.com\/kb\/#\/schema\/person\/3db6e20d1f33519cd68fe0ba1230a48b","name":"Jonathan K. W.","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f432b99e6651fe8d1deb57a285bd84e806f1c9ae8b4c6c585d7e3a0b33789ad9?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f432b99e6651fe8d1deb57a285bd84e806f1c9ae8b4c6c585d7e3a0b33789ad9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f432b99e6651fe8d1deb57a285bd84e806f1c9ae8b4c6c585d7e3a0b33789ad9?s=96&d=mm&r=g","caption":"Jonathan K. W."},"sameAs":["https:\/\/www.knownhost.com"]}]}},"_links":{"self":[{"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/posts\/751","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/comments?post=751"}],"version-history":[{"count":0,"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/posts\/751\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/media?parent=751"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/categories?post=751"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/tags?post=751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}