{"id":3703,"date":"2015-06-29T15:20:49","date_gmt":"2015-06-29T22:20:49","guid":{"rendered":"https:\/\/bryanhadaway.com\/?p=3703"},"modified":"2025-05-22T15:20:21","modified_gmt":"2025-05-22T22:20:21","slug":"how-to-cleanup-a-php-ini-file","status":"publish","type":"post","link":"https:\/\/webguy.io\/blog\/how-to-cleanup-a-php-ini-file\/","title":{"rendered":"How to Cleanup a php.ini File"},"content":{"rendered":"<p>If like me, you hate programmer comments and like to keep your files super clean and straight to the point when you&#8217;re working on personal projects or projects only you manage and you also manage your PHP settings from a <a href=\"https:\/\/www.php.net\/manual\/en\/configuration.file.php\">php.ini<\/a> file, this how-to may be for you.<\/p>\n<p>Using an advanced text editor like <a href=\"http:\/\/www.barebones.com\/products\/textwrangler\/\">TextWrangler<\/a> (for Mac) or <a href=\"https:\/\/notepad-plus-plus.org\/\">Notepad++<\/a> (for Windows) we can do a lot of very powerful things, very quickly, with regex (<a href=\"https:\/\/wikipedia.org\/wiki\/Regular_expression\">regular expression<\/a> \u2014 a search pattern language).<\/p>\n<p>In many advanced text editors you can simply hit <strong><em>Command+F<\/em><\/strong> or <strong><em>Control+F<\/em><\/strong> and you&#8217;ll be able to do some find and replace operations. You should see an option to search by <a href=\"https:\/\/wikipedia.org\/wiki\/Grep\">grep<\/a> (a command-line tool to run regex), regex, or similar.<\/p>\n<p>With php.ini open, run the following find and replace:<\/p>\n<p><strong>Find:<\/strong><\/p>\n<pre><code>^\\;.*$<\/code><\/pre>\n<p><strong>Replace With:<\/strong><\/p>\n<p><em>leave blank<\/em><\/p>\n<p>This will remove all comments from the file. Then, to cleanup all the empty space, run another regex:<\/p>\n<p><strong>Find:<\/strong><\/p>\n<pre><code>^\\s*<\/code><\/pre>\n<p><strong>Replace With:<\/strong><\/p>\n<p><em>leave blank<\/em><\/p>\n<p>That&#8217;s it. You&#8217;ll now have a super clean, easy to manage php.ini file.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If like me, you hate programmer comments and like to keep your files super clean and straight to the point when you&#8217;re working on personal projects or projects only you manage and you also manage your PHP settings from a php.ini file, this how-to may be for you. Using an advanced text editor like TextWrangler <a href=\"https:\/\/webguy.io\/blog\/how-to-cleanup-a-php-ini-file\/\" class=\"more-link\">&#8230;<span class=\"screen-reader-text\">  How to Cleanup a php.ini File<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":3704,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39,17,47,71],"tags":[239,199,218,197,247,198,266],"class_list":["post-3703","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-code","category-how-to","category-programming","category-tools","tag-code","tag-grep","tag-how-to","tag-php","tag-programming","tag-regex","tag-tools"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/webguy.io\/blog\/wp-json\/wp\/v2\/posts\/3703","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webguy.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webguy.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webguy.io\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/webguy.io\/blog\/wp-json\/wp\/v2\/comments?post=3703"}],"version-history":[{"count":0,"href":"https:\/\/webguy.io\/blog\/wp-json\/wp\/v2\/posts\/3703\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webguy.io\/blog\/wp-json\/wp\/v2\/media\/3704"}],"wp:attachment":[{"href":"https:\/\/webguy.io\/blog\/wp-json\/wp\/v2\/media?parent=3703"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webguy.io\/blog\/wp-json\/wp\/v2\/categories?post=3703"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webguy.io\/blog\/wp-json\/wp\/v2\/tags?post=3703"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}