{"id":119,"date":"2011-12-24T14:41:40","date_gmt":"2011-12-24T14:41:40","guid":{"rendered":"https:\/\/ibex.tech\/cloud\/?p=119"},"modified":"2024-02-29T10:26:00","modified_gmt":"2024-02-29T10:26:00","slug":"debugging-php","status":"publish","type":"post","link":"https:\/\/ibex.tech\/cloud\/php\/debugging\/debugging-php","title":{"rendered":"Debugging PHP"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Useful debugging things<\/h4>\n\n\n\n<p><a href=\"https:\/\/ibex.tech\/cloud\/php\/memory\/arrays\/debugging-array\">Debugging arrays<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/Echo a bool value:\n  echo($MyBoolVariable ? 'true' : 'false');<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Display errors<\/h4>\n\n\n\n<p>Add &#8220;display_errors = On&#8221; in your PHP configuration file to cause errors to be displayed. &nbsp;This is a really useful debugging feature and is often the best first step of debuigging to determin why something isn&#8217;t working. <\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Turning on in a file <\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>error_reporting(E_ALL); ini_set('display_errors', 'On');     \/\/SHOW PHP ERRORS<\/code><\/pre>\n\n\n\n<p>Tip: Look for a error_log file created on the remote server in the files directory<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Displaying An Error <\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>Try\n{\n}\ncatch (Exception $e)\n{\n    echo $e-&gt;getMessage();\n}\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Show full PHP install information<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>  \/\/Display PHP install full information\n  phpinfo();<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Useful debugging things Debugging arrays Display errors Add &#8220;display_errors = On&#8221; in your PHP configuration file to cause errors to be displayed. &nbsp;This is a really useful debugging feature and is often the best first step of debuigging to determin why something isn&#8217;t working. Turning on in a file Tip: Look for a error_log file [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18,38],"tags":[],"class_list":["post-119","post","type-post","status-publish","format-standard","hentry","category-debugging","category-errors"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/119","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/comments?post=119"}],"version-history":[{"count":9,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/119\/revisions"}],"predecessor-version":[{"id":4592,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/119\/revisions\/4592"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/media?parent=119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/categories?post=119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/tags?post=119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}