{"id":3191,"date":"2018-01-19T22:01:44","date_gmt":"2018-01-19T22:01:44","guid":{"rendered":"http:\/\/pariswells.com\/blog\/?p=3191"},"modified":"2018-04-20T13:18:42","modified_gmt":"2018-04-20T13:18:42","slug":"debugging-and-slowness-with-php","status":"publish","type":"post","link":"https:\/\/pariswells.com\/blog\/code\/debugging-and-slowness-with-php","title":{"rendered":"Debugging and Slowness with Php"},"content":{"rendered":"<ol><li>Install :\u00a0<a href=\"https:\/\/xdebug.org\/\">Xdebug<\/a>\u00a0<\/li><\/ol><p>Can be done by install then entering the following :\u00a0\u00a0<strong>\/etc\/php\/7.1\/fpm\/php.ini<\/strong>:<\/p><div class=\"highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code>zend_extension = \/usr\/lib\/php\/20160303\/xdebug.so\r\nxdebug.profiler_enable = 0\r\nxdebug.profiler_output_name = cachegrind.out.%t\r\nxdebug.profiler_enable_trigger = 1\r\nxdebug.profiler_output_dir = \/tmp\r\nxdebug.profiler_enable_trigger_value = \"&lt;super secret key&gt;\"\r\n<\/code><\/pre><\/div><\/div><p>In order, the configuration goes as follows: load the module, disable profiling be default, set the filename, enable triggering via GET\/POST parameter, output in \/tmp and only profile when given the key.<\/p><p>Restart php-fpm and you should be good to go.<\/p><p>2) Use the\u00a0?XDEBUG_PROFILE=&lt;super secret key&gt; appended to any page you want to debug and the debug file will be put in\u00a0\/tmp.<\/p><p>3) Open the debug file using something like :\u00a0<a href=\"https:\/\/github.com\/jokkedk\/webgrind\">https:\/\/github.com\/jokkedk\/webgrind<\/a>\u00a0 For Analysis specifically for reducing\u00a0<\/p><p><strong>Invocation Count<\/strong>\u00a0is how many times that function was called. A simple tip for reducing this is to pull out any repetitive function calls from a for-loop into a single variable.<\/p><p>\u00a0<strong>Total Self Cost is<\/strong>\u00a0the total percentage or time that the function is responsible for. You can improve this by reducing code complexity, using built-in native functions or removing unused variables.<\/p>","protected":false},"excerpt":{"rendered":"<p>Install :\u00a0Xdebug\u00a0Can be done by install then entering the following :\u00a0\u00a0\/etc\/php\/7.1\/fpm\/php.ini:zend_extension = \/usr\/lib\/php\/20160303\/xdebug.so xdebug.profiler_enable = 0 xdebug.profiler_output_name = cachegrind.out.%t xdebug.profiler_enable_trigger = 1 xdebug.profiler_output_dir = \/tmp xdebug.profiler_enable_trigger_value = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[1391,698,2397,2396,2398],"class_list":["post-3191","post","type-post","status-publish","format-standard","hentry","category-code","tag-debug","tag-php","tag-profile","tag-slowness","tag-xdebug"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.8 - aioseo.com -->\n\t<meta name=\"description\" content=\"Install : Xdebug Can be done by install then entering the following : \/etc\/php\/7.1\/fpm\/php.ini:zend_extension = \/usr\/lib\/php\/20160303\/xdebug.so xdebug.profiler_enable = 0 xdebug.profiler_output_name = cachegrind.out.%t xdebug.profiler_enable_trigger = 1 xdebug.profiler_output_dir = \/tmp xdebug.profiler_enable_trigger_value = &quot;&quot; In order, the configuration goes as follows: load the module, disable profiling be default, set the filename, enable triggering via GET\/POST parameter, output in \/tmp\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"paris\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/pariswells.com\/blog\/code\/debugging-and-slowness-with-php\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.8\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Welcome to Pariswells.com |\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Debugging and Slowness with Php | Welcome to Pariswells.com\" \/>\n\t\t<meta property=\"og:description\" content=\"Install : Xdebug Can be done by install then entering the following : \/etc\/php\/7.1\/fpm\/php.ini:zend_extension = \/usr\/lib\/php\/20160303\/xdebug.so xdebug.profiler_enable = 0 xdebug.profiler_output_name = cachegrind.out.%t xdebug.profiler_enable_trigger = 1 xdebug.profiler_output_dir = \/tmp xdebug.profiler_enable_trigger_value = &quot;&quot; In order, the configuration goes as follows: load the module, disable profiling be default, set the filename, enable triggering via GET\/POST parameter, output in \/tmp\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/pariswells.com\/blog\/code\/debugging-and-slowness-with-php\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2018-01-19T22:01:44+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2018-04-20T13:18:42+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Debugging and Slowness with Php | Welcome to Pariswells.com\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Install : Xdebug Can be done by install then entering the following : \/etc\/php\/7.1\/fpm\/php.ini:zend_extension = \/usr\/lib\/php\/20160303\/xdebug.so xdebug.profiler_enable = 0 xdebug.profiler_output_name = cachegrind.out.%t xdebug.profiler_enable_trigger = 1 xdebug.profiler_output_dir = \/tmp xdebug.profiler_enable_trigger_value = &quot;&quot; In order, the configuration goes as follows: load the module, disable profiling be default, set the filename, enable triggering via GET\/POST parameter, output in \/tmp\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/code\\\/debugging-and-slowness-with-php#article\",\"name\":\"Debugging and Slowness with Php | Welcome to Pariswells.com\",\"headline\":\"Debugging and Slowness with Php\",\"author\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/author\\\/paris#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/#organization\"},\"datePublished\":\"2018-01-19T22:01:44+00:00\",\"dateModified\":\"2018-04-20T13:18:42+00:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/code\\\/debugging-and-slowness-with-php#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/code\\\/debugging-and-slowness-with-php#webpage\"},\"articleSection\":\"Code, debug, PHP, profile, slowness, xdebug\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/code\\\/debugging-and-slowness-with-php#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/pariswells.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/category\\\/code#listItem\",\"name\":\"Code\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/category\\\/code#listItem\",\"position\":2,\"name\":\"Code\",\"item\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/category\\\/code\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/code\\\/debugging-and-slowness-with-php#listItem\",\"name\":\"Debugging and Slowness with Php\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/code\\\/debugging-and-slowness-with-php#listItem\",\"position\":3,\"name\":\"Debugging and Slowness with Php\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/category\\\/code#listItem\",\"name\":\"Code\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/#organization\",\"name\":\"Welcome to Pariswells.com\",\"url\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/author\\\/paris#author\",\"url\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/author\\\/paris\",\"name\":\"paris\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/code\\\/debugging-and-slowness-with-php#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/93b8ee3f592ac401167f870452bd82d43de80152cd3524e2853403658ada9984?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"paris\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/code\\\/debugging-and-slowness-with-php#webpage\",\"url\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/code\\\/debugging-and-slowness-with-php\",\"name\":\"Debugging and Slowness with Php | Welcome to Pariswells.com\",\"description\":\"Install : Xdebug Can be done by install then entering the following : \\\/etc\\\/php\\\/7.1\\\/fpm\\\/php.ini:zend_extension = \\\/usr\\\/lib\\\/php\\\/20160303\\\/xdebug.so xdebug.profiler_enable = 0 xdebug.profiler_output_name = cachegrind.out.%t xdebug.profiler_enable_trigger = 1 xdebug.profiler_output_dir = \\\/tmp xdebug.profiler_enable_trigger_value = \\\"\\\" In order, the configuration goes as follows: load the module, disable profiling be default, set the filename, enable triggering via GET\\\/POST parameter, output in \\\/tmp\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/code\\\/debugging-and-slowness-with-php#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/author\\\/paris#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/author\\\/paris#author\"},\"datePublished\":\"2018-01-19T22:01:44+00:00\",\"dateModified\":\"2018-04-20T13:18:42+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/\",\"name\":\"Welcome to Pariswells.com\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Debugging and Slowness with Php | Welcome to Pariswells.com","description":"Install : Xdebug Can be done by install then entering the following : \/etc\/php\/7.1\/fpm\/php.ini:zend_extension = \/usr\/lib\/php\/20160303\/xdebug.so xdebug.profiler_enable = 0 xdebug.profiler_output_name = cachegrind.out.%t xdebug.profiler_enable_trigger = 1 xdebug.profiler_output_dir = \/tmp xdebug.profiler_enable_trigger_value = \"\" In order, the configuration goes as follows: load the module, disable profiling be default, set the filename, enable triggering via GET\/POST parameter, output in \/tmp","canonical_url":"https:\/\/pariswells.com\/blog\/code\/debugging-and-slowness-with-php","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/pariswells.com\/blog\/code\/debugging-and-slowness-with-php#article","name":"Debugging and Slowness with Php | Welcome to Pariswells.com","headline":"Debugging and Slowness with Php","author":{"@id":"https:\/\/pariswells.com\/blog\/author\/paris#author"},"publisher":{"@id":"https:\/\/pariswells.com\/blog\/#organization"},"datePublished":"2018-01-19T22:01:44+00:00","dateModified":"2018-04-20T13:18:42+00:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/pariswells.com\/blog\/code\/debugging-and-slowness-with-php#webpage"},"isPartOf":{"@id":"https:\/\/pariswells.com\/blog\/code\/debugging-and-slowness-with-php#webpage"},"articleSection":"Code, debug, PHP, profile, slowness, xdebug"},{"@type":"BreadcrumbList","@id":"https:\/\/pariswells.com\/blog\/code\/debugging-and-slowness-with-php#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/pariswells.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/pariswells.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/pariswells.com\/blog\/category\/code#listItem","name":"Code"}},{"@type":"ListItem","@id":"https:\/\/pariswells.com\/blog\/category\/code#listItem","position":2,"name":"Code","item":"https:\/\/pariswells.com\/blog\/category\/code","nextItem":{"@type":"ListItem","@id":"https:\/\/pariswells.com\/blog\/code\/debugging-and-slowness-with-php#listItem","name":"Debugging and Slowness with Php"},"previousItem":{"@type":"ListItem","@id":"https:\/\/pariswells.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/pariswells.com\/blog\/code\/debugging-and-slowness-with-php#listItem","position":3,"name":"Debugging and Slowness with Php","previousItem":{"@type":"ListItem","@id":"https:\/\/pariswells.com\/blog\/category\/code#listItem","name":"Code"}}]},{"@type":"Organization","@id":"https:\/\/pariswells.com\/blog\/#organization","name":"Welcome to Pariswells.com","url":"https:\/\/pariswells.com\/blog\/"},{"@type":"Person","@id":"https:\/\/pariswells.com\/blog\/author\/paris#author","url":"https:\/\/pariswells.com\/blog\/author\/paris","name":"paris","image":{"@type":"ImageObject","@id":"https:\/\/pariswells.com\/blog\/code\/debugging-and-slowness-with-php#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/93b8ee3f592ac401167f870452bd82d43de80152cd3524e2853403658ada9984?s=96&d=mm&r=g","width":96,"height":96,"caption":"paris"}},{"@type":"WebPage","@id":"https:\/\/pariswells.com\/blog\/code\/debugging-and-slowness-with-php#webpage","url":"https:\/\/pariswells.com\/blog\/code\/debugging-and-slowness-with-php","name":"Debugging and Slowness with Php | Welcome to Pariswells.com","description":"Install : Xdebug Can be done by install then entering the following : \/etc\/php\/7.1\/fpm\/php.ini:zend_extension = \/usr\/lib\/php\/20160303\/xdebug.so xdebug.profiler_enable = 0 xdebug.profiler_output_name = cachegrind.out.%t xdebug.profiler_enable_trigger = 1 xdebug.profiler_output_dir = \/tmp xdebug.profiler_enable_trigger_value = \"\" In order, the configuration goes as follows: load the module, disable profiling be default, set the filename, enable triggering via GET\/POST parameter, output in \/tmp","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/pariswells.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/pariswells.com\/blog\/code\/debugging-and-slowness-with-php#breadcrumblist"},"author":{"@id":"https:\/\/pariswells.com\/blog\/author\/paris#author"},"creator":{"@id":"https:\/\/pariswells.com\/blog\/author\/paris#author"},"datePublished":"2018-01-19T22:01:44+00:00","dateModified":"2018-04-20T13:18:42+00:00"},{"@type":"WebSite","@id":"https:\/\/pariswells.com\/blog\/#website","url":"https:\/\/pariswells.com\/blog\/","name":"Welcome to Pariswells.com","inLanguage":"en-US","publisher":{"@id":"https:\/\/pariswells.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"Welcome to Pariswells.com |","og:type":"article","og:title":"Debugging and Slowness with Php | Welcome to Pariswells.com","og:description":"Install : Xdebug Can be done by install then entering the following : \/etc\/php\/7.1\/fpm\/php.ini:zend_extension = \/usr\/lib\/php\/20160303\/xdebug.so xdebug.profiler_enable = 0 xdebug.profiler_output_name = cachegrind.out.%t xdebug.profiler_enable_trigger = 1 xdebug.profiler_output_dir = \/tmp xdebug.profiler_enable_trigger_value = &quot;&quot; In order, the configuration goes as follows: load the module, disable profiling be default, set the filename, enable triggering via GET\/POST parameter, output in \/tmp","og:url":"https:\/\/pariswells.com\/blog\/code\/debugging-and-slowness-with-php","article:published_time":"2018-01-19T22:01:44+00:00","article:modified_time":"2018-04-20T13:18:42+00:00","twitter:card":"summary","twitter:title":"Debugging and Slowness with Php | Welcome to Pariswells.com","twitter:description":"Install : Xdebug Can be done by install then entering the following : \/etc\/php\/7.1\/fpm\/php.ini:zend_extension = \/usr\/lib\/php\/20160303\/xdebug.so xdebug.profiler_enable = 0 xdebug.profiler_output_name = cachegrind.out.%t xdebug.profiler_enable_trigger = 1 xdebug.profiler_output_dir = \/tmp xdebug.profiler_enable_trigger_value = &quot;&quot; In order, the configuration goes as follows: load the module, disable profiling be default, set the filename, enable triggering via GET\/POST parameter, output in \/tmp"},"aioseo_meta_data":{"post_id":"3191","title":null,"description":null,"keywords":null,"keyphrases":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[],"defaultGraph":"","defaultPostTypeGraph":""},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2020-12-21 05:36:23","updated":"2022-09-22 17:32:17","primary_term":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/pariswells.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/pariswells.com\/blog\/category\/code\" title=\"Code\">Code<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tDebugging and Slowness with Php\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/pariswells.com\/blog"},{"label":"Code","link":"https:\/\/pariswells.com\/blog\/category\/code"},{"label":"Debugging and Slowness with Php","link":"https:\/\/pariswells.com\/blog\/code\/debugging-and-slowness-with-php"}],"_links":{"self":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/3191","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/comments?post=3191"}],"version-history":[{"count":1,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/3191\/revisions"}],"predecessor-version":[{"id":3192,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/3191\/revisions\/3192"}],"wp:attachment":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/media?parent=3191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/categories?post=3191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/tags?post=3191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}