{"id":615,"date":"2021-07-23T12:34:03","date_gmt":"2021-07-23T12:34:03","guid":{"rendered":"https:\/\/ssdsunucum.com\/blog\/create-custom-php-directives\/"},"modified":"2021-07-23T12:34:03","modified_gmt":"2021-07-23T12:34:03","slug":"create-custom-php-directives","status":"publish","type":"post","link":"https:\/\/ssdsunucum.com\/blog\/create-custom-php-directives\/","title":{"rendered":"Create Custom PHP Directives"},"content":{"rendered":"<\/p>\n<div class=\"col-md-9\">\n<div class=\"flex-column flex-md-row article-header\"><\/div>\n<hr>\n<h2 id=\"overview\">Overview<\/h2>\n<div class=\"callout callout-warning\">\n<div class=\"callout-heading\">Important:<\/div>\n<div class=\"callout-content\">\n        This document <strong>only<\/strong> applies to systems that run EasyApache 4.\n    <\/div>\n<\/div>\n<p>This document explains how to add custom PHP INI directives to your system\u2019s PHP configuration. This ensures that you can manage them in the <em>Editor Mode<\/em> of WHM\u2019s <em>MultiPHP INI Editor<\/em>  interface (<em>WHM &gt;&gt; Home &gt;&gt; Software &gt;&gt; MultiPHP INI Editor<\/em>).<\/p>\n<p>If your system requires extra PHP configuration, you may wish to create custom PHP directives. If you want the system to validate your custom directives, you <strong>must<\/strong> add them to the <code>\/etc\/cpanel\/ea4\/phpini_directives<\/code> directory.<\/p>\n<h2 id=\"how-to-add-a-custom-php-directive\">How to add a custom PHP directive<\/h2>\n<p>To add a custom PHP directive, perform the following steps:<\/p>\n<ol>\n<li>\n<p>Create the <code>\/etc\/cpanel\/ea4\/phpini_directives<\/code> directory if it does not already exist.<\/p>\n<\/li>\n<li>\n<p>Inside the directory, create a <code>.yaml<\/code> file that contains a hash of the directives that you wish to add <strong>inside<\/strong> the directives key. <\/p>\n<div class=\"callout callout-warning\">\n<div class=\"callout-heading\">Important:<\/div>\n<div class=\"callout-content\">\n        The hash inside your <code>.yaml<\/code> file\u2019s directives key must use the same format as the <code>\/usr\/local\/cpanel\/whostmgr\/etc\/phpini_directives.yaml<\/code> file.\n    <\/div>\n<\/div>\n<\/li>\n<\/ol>\n<p>Your file might resemble the following example:<\/p>\n<div class=\"highlight\">\n<div style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\">\n<table style=\"border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;\">\n<tr>\n<td style=\"vertical-align:top;padding:0;margin:0;border:0;\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-go\" data-lang=\"go\"><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 1\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 2\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 3\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 4\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 5\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 6\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 7\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 8\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\"> 9\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\">10\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\">11\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\">12\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\">13\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\">14\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\">15\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\">16\n<\/span><\/code><\/pre>\n<\/td>\n<td style=\"vertical-align:top;padding:0;margin:0;border:0;;width:100%\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-go\" data-lang=\"go\"><span style=\"color:#a6e22e\">directives<\/span>:\n  <span style=\"color:#a6e22e\">directive_foo<\/span>:\n    <span style=\"color:#a6e22e\">changeable<\/span>: <span style=\"color:#a6e22e\">PHP_INI_ALL<\/span>\n    <span style=\"color:#66d9ef\">default<\/span>: <span style=\"color:#a6e22e\">foo<\/span>\n    <span style=\"color:#a6e22e\">multiple<\/span>: <span style=\"color:#ae81ff\">0<\/span>\n    <span style=\"color:#a6e22e\">note<\/span>: <span style=\"color:#960050;background-color:#1e0010\">'<\/span><span style=\"color:#f92672\">...<\/span><span style=\"color:#960050;background-color:#1e0010\">'<\/span>\n    <span style=\"color:#a6e22e\">section<\/span>: <span style=\"color:#960050;background-color:#1e0010\">'<\/span><span style=\"color:#f92672\">...<\/span><span style=\"color:#960050;background-color:#1e0010\">'<\/span>\n    <span style=\"color:#66d9ef\">type<\/span>: <span style=\"color:#66d9ef\">string<\/span>\n  <span style=\"color:#a6e22e\">directive_bar<\/span>:\n    <span style=\"color:#a6e22e\">changeable<\/span>: <span style=\"color:#a6e22e\">PHP_INI_PERDIR<\/span>\n    <span style=\"color:#66d9ef\">default<\/span>: <span style=\"color:#ae81ff\">1<\/span>\n    <span style=\"color:#a6e22e\">multiple<\/span>: <span style=\"color:#ae81ff\">0<\/span>\n    <span style=\"color:#a6e22e\">note<\/span>: <span style=\"color:#960050;background-color:#1e0010\">'<\/span><span style=\"color:#f92672\">...<\/span><span style=\"color:#960050;background-color:#1e0010\">'<\/span>\n    <span style=\"color:#a6e22e\">deprecated<\/span>: <span style=\"color:#ae81ff\">5.4.0<\/span>\n    <span style=\"color:#a6e22e\">section<\/span>: <span style=\"color:#960050;background-color:#1e0010\">'<\/span><span style=\"color:#f92672\">...<\/span><span style=\"color:#960050;background-color:#1e0010\">'<\/span>\n    <span style=\"color:#66d9ef\">type<\/span>: <span style=\"color:#a6e22e\">boolean<\/span><\/code><\/pre>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<\/div>\n<div class=\"callout callout-info\">\n<div class=\"callout-heading\">Note:<\/div>\n<div class=\"callout-content\">\n<ul>\n<li>If your new directive already exists, the system ignores it.<\/li>\n<li>The system reads the <code>\/usr\/local\/cpanel\/whostmgr\/etc\/phpini_directives.yaml<\/code> file first, and then reads the files in the <code>\/etc\/cpanel\/ea4\/phpini_directives<\/code> directory in ASCII order. It will use the first occurrence of any directive that it reads from a <code>.yaml<\/code> file.<\/li>\n<\/ul><\/div>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Overview Important: This document only applies to systems that run EasyApache 4. This document explains how to add custom PHP INI directives to your system\u2019s PHP configuration. This ensures that you can manage them in the Editor Mode of WHM\u2019s MultiPHP INI Editor interface (WHM &gt;&gt; Home &gt;&gt; Software &gt;&gt; MultiPHP INI Editor). If your &hellip;<\/p>\n","protected":false},"author":1,"featured_media":616,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts\/615"}],"collection":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/comments?post=615"}],"version-history":[{"count":0,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts\/615\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/media\/616"}],"wp:attachment":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/media?parent=615"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/categories?post=615"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/tags?post=615"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}