{"id":497,"date":"2024-06-25T15:18:41","date_gmt":"2024-06-25T15:18:41","guid":{"rendered":"https:\/\/fatreseller.in\/blog\/?p=497"},"modified":"2024-06-25T15:19:22","modified_gmt":"2024-06-25T15:19:22","slug":"customize-php-disable-functions-in-directadmin","status":"publish","type":"post","link":"https:\/\/fatreseller.in\/blog\/customize-php-disable-functions-in-directadmin\/","title":{"rendered":"How to easy customize PHP disable_functions in DirectAdmin"},"content":{"rendered":"\n<p>Customize PHP disable_functions in DirectAdmin involves modifying the PHP configuration files. This can be done globally or per user. <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"484\" height=\"139\" src=\"https:\/\/fatreseller.in\/blog\/wp-content\/uploads\/2024\/06\/image-28.png\" alt=\"\" class=\"wp-image-504\" srcset=\"https:\/\/fatreseller.in\/blog\/wp-content\/uploads\/2024\/06\/image-28.png 484w, https:\/\/fatreseller.in\/blog\/wp-content\/uploads\/2024\/06\/image-28-300x86.png 300w\" sizes=\"(max-width: 484px) 100vw, 484px\" \/><\/figure><\/div>\n\n\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\"><h2>Here\u2019s how you can do it:<\/h2><nav><ul><li class=\"\"><a href=\"#log-in-to-direct-admin-as-admin\">Log in to DirectAdmin as Admin:<\/a><\/li><li class=\"\"><a href=\"#navigate-to-system-info-files\">Navigate to System info &amp; files:<\/a><\/li><li class=\"\"><a href=\"#edit-the-php-ini-file\">Edit the php.ini File:<\/a><\/li><li class=\"\"><a href=\"#restart-web-server-to-apply-customize-php-disable-functions-in-direct-admin\">Restart Web Server to apply customize PHP disable_functions in DirectAdmin:<\/a><ul><li class=\"\"><a href=\"#using-custom-build\">Using CustomBuild<\/a><\/li><li class=\"\"><a href=\"#important-considerations\">Important Considerations<\/a><\/li><li class=\"\"><a href=\"#security\">Security<\/a><\/li><li class=\"\"><a href=\"#performance\">Performance<\/a><\/li><li class=\"\"><a href=\"#functionality\">Functionality<\/a><\/li><li class=\"\"><a href=\"#multi-user-environments\">Multi-User Environments<\/a><\/li><li class=\"\"><a href=\"#troubleshooting-and-maintenance\">Troubleshooting and Maintenance<\/a><\/li><li class=\"\"><a href=\"#how-to-customize\">How to Customize<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"log-in-to-direct-admin-as-admin\"><strong>Log in to DirectAdmin as Admin:<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Access the DirectAdmin panel by navigating to your server&#8217;s DirectAdmin URL.<\/li>\n\n\n\n<li>Log in using your admin credentials.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"703\" src=\"https:\/\/fatreseller.in\/blog\/wp-content\/uploads\/2024\/05\/DirectAdmin-Login-Page-1024x703.png\" alt=\"customize PHP disable_functions in DirectAdmin\" class=\"wp-image-406\" style=\"width:470px;height:auto\" srcset=\"https:\/\/fatreseller.in\/blog\/wp-content\/uploads\/2024\/05\/DirectAdmin-Login-Page-1024x703.png 1024w, https:\/\/fatreseller.in\/blog\/wp-content\/uploads\/2024\/05\/DirectAdmin-Login-Page-300x206.png 300w, https:\/\/fatreseller.in\/blog\/wp-content\/uploads\/2024\/05\/DirectAdmin-Login-Page-768x528.png 768w, https:\/\/fatreseller.in\/blog\/wp-content\/uploads\/2024\/05\/DirectAdmin-Login-Page.png 1198w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"navigate-to-system-info-files\"><strong>Navigate to System info &amp; files:<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Go to <code>Admin Tools<\/code> -><strong>Navigate to System info &amp; files<\/strong><code> Settings<\/code>.<\/li>\n\n\n\n<li>Click on <code>File editor option<\/code>.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"901\" height=\"215\" src=\"https:\/\/fatreseller.in\/blog\/wp-content\/uploads\/2024\/06\/Screenshot-2024-06-25-195819.png\" alt=\"\" class=\"wp-image-499\" srcset=\"https:\/\/fatreseller.in\/blog\/wp-content\/uploads\/2024\/06\/Screenshot-2024-06-25-195819.png 901w, https:\/\/fatreseller.in\/blog\/wp-content\/uploads\/2024\/06\/Screenshot-2024-06-25-195819-300x72.png 300w, https:\/\/fatreseller.in\/blog\/wp-content\/uploads\/2024\/06\/Screenshot-2024-06-25-195819-768x183.png 768w\" sizes=\"(max-width: 901px) 100vw, 901px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"edit-the-php-ini-file\"><strong>Edit the <code>php.ini<\/code> File:<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Locate the <code>php.ini<\/code> file for the PHP version you want to customize.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"431\" height=\"65\" src=\"https:\/\/fatreseller.in\/blog\/wp-content\/uploads\/2024\/06\/image-26.png\" alt=\"\" class=\"wp-image-500\" srcset=\"https:\/\/fatreseller.in\/blog\/wp-content\/uploads\/2024\/06\/image-26.png 431w, https:\/\/fatreseller.in\/blog\/wp-content\/uploads\/2024\/06\/image-26-300x45.png 300w\" sizes=\"(max-width: 431px) 100vw, 431px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Edit the file and find the <code>disable_functions<\/code> directive.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">disable_functions = exec,passthru,shell_exec,system<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">Add or remove functions as needed. For example:<br><br><code>disable_functions = exec,passthru,shell_exec,system<\/code><\/pre>\n\n\n\n<p>Save the changes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"restart-web-server-to-apply-customize-php-disable-functions-in-direct-admin\"><strong>Restart Web Server to apply customize PHP disable_functions in DirectAdmin:<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>After saving the changes, you may need to restart <a href=\"https:\/\/fatreseller.in\/vps-hosting.html\">your web server<\/a> to apply the new configuration. This can be done via SSH or from the DirectAdmin panel, depending on your server setup.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"165\" height=\"110\" src=\"https:\/\/fatreseller.in\/blog\/wp-content\/uploads\/2024\/06\/image-27.png\" alt=\"\" class=\"wp-image-501\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"using-custom-build\">Using CustomBuild<\/h3>\n\n\n\n<p>If you are using DirectAdmin&#8217;s CustomBuild tool, you can also customize <code>php.ini<\/code> templates:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Log in to your server via SSH:<\/strong><\/li>\n\n\n\n<li><strong>Navigate to CustomBuild Directory:<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>   cd \/usr\/local\/directadmin\/custombuild<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\" start=\"3\">\n<li><strong>Edit the <code>php.ini<\/code> Template:<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>   nano custom\/php.ini<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Find and edit the <code>disable_functions<\/code> directive.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Rebuild PHP:<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>   .\/build php<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>This will apply the changes across all users who are using this PHP configuration.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"important-considerations\">Important Considerations<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Security:<\/strong> Be cautious when enabling or disabling functions, as this can have security implications.<\/li>\n\n\n\n<li><strong>PHP Versions:<\/strong> Ensure you are editing the correct <code>php.ini<\/code> file for the PHP version you are using.<\/li>\n\n\n\n<li><strong>Testing:<\/strong> Always test the configuration changes in a staging environment if possible before applying them to production.<\/li>\n<\/ul>\n\n\n\n<p>By following these steps, you can customize the <code>disable_functions<\/code> directive in DirectAdmin to suit your needs.<\/p>\n\n\n\n<p>Customizing the <code>disable_functions<\/code> directive in PHP through DirectAdmin can be required for several reasons related to security, performance, and functionality. Here are some of the key reasons:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"security\">Security<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Prevent Code Execution Vulnerabilities:<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>customize PHP disable_functions in DirectAdmin, Functions like <code>exec<\/code>, <code>shell_exec<\/code>, <code>system<\/code>, <code>passthru<\/code>, <code>popen<\/code>, <code>proc_open<\/code>, and <code>eval<\/code> can be exploited to execute arbitrary code on the server. Disabling these functions can mitigate the risk of remote code execution (RCE) attacks.<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Limit File Manipulation:<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Functions such as <code>fopen<\/code>, <code>fwrite<\/code>, <code>unlink<\/code>, <code>rmdir<\/code>, and <code>file_put_contents<\/code> can be used maliciously to manipulate files on the server. Disabling these functions can prevent unauthorized file modifications or deletions.<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Prevent Information Disclosure:<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>customize PHP disable_functions in DirectAdmin, Functions like <code>phpinfo<\/code>, <code>getenv<\/code>, and <code>php_uname<\/code> can reveal sensitive information about the server environment and configuration, which can be useful to an attacker. Disabling these functions can help maintain the confidentiality of server details.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"performance\">Performance<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Reduce Resource Consumption:<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Disabling functions that are not needed for the application can reduce the risk of resource exhaustion. For example, functions that spawn external processes (e.g., <code>exec<\/code>, <code>system<\/code>) can significantly impact server performance if misused.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"functionality\">Functionality<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Customization for Specific Applications:<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Some applications may require certain functions to be disabled for compatibility or to enforce application-level security policies. Customizing the <code>disable_functions<\/code> directive allows for tailored configurations that meet the needs of specific applications.<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Compliance with Best Practices:<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>customize PHP disable_functions in DirectAdmin, Following best practices and compliance requirements often involves disabling potentially dangerous PHP functions. For example, certain security standards and guidelines recommend disabling functions that can execute shell commands or modify the file system.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"multi-user-environments\">Multi-User Environments<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>User Isolation:<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In shared hosting environments, isolating users by disabling potentially harmful functions helps prevent one user from affecting the security or stability of the server or other users. Each user can have a customized <code>disable_functions<\/code> setting that aligns with their specific requirements while maintaining overall server security.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"troubleshooting-and-maintenance\">Troubleshooting and Maintenance<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Debugging and Development:<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>During development or debugging, enabling or disabling specific customize PHP disable_functions in DirectAdmin PHP functions can be necessary to identify issues or to ensure the development environment mimics the production environment closely. Customizing <code>disable_functions<\/code> per environment helps maintain consistency and security across different stages of application development.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"how-to-customize\">How to Customize<\/h3>\n\n\n\n<p>As previously outlined, customize PHP disable_functions in DirectAdmin directive can be done at the global level or per user\/domain level in DirectAdmin. This flexibility allows server administrators to enforce security policies while accommodating the varying needs of different applications and users.<\/p>\n\n\n\n<p>Customizing the <code>disable_functions<\/code> directive in DirectAdmin is a crucial aspect of managing a secure and efficient PHP environment. It helps protect against security vulnerabilities, optimize performance, and ensure the proper functioning of applications according to their specific needs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Customize PHP disable_functions in DirectAdmin involves modifying the PHP configuration files. This can be done globally or per user. Log in to DirectAdmin as Admin: Navigate to System info &amp; files: Edit the php.ini File: disable_functions = exec,passthru,shell_exec,system Add or remove functions as needed. For example:disable_functions = exec,passthru,shell_exec,system Save the changes. Restart Web Server to [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":505,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[45],"class_list":["post-497","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-directadmin","tag-customize-php-disable_functions-in-directadmin"],"_links":{"self":[{"href":"https:\/\/fatreseller.in\/blog\/wp-json\/wp\/v2\/posts\/497"}],"collection":[{"href":"https:\/\/fatreseller.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fatreseller.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fatreseller.in\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/fatreseller.in\/blog\/wp-json\/wp\/v2\/comments?post=497"}],"version-history":[{"count":3,"href":"https:\/\/fatreseller.in\/blog\/wp-json\/wp\/v2\/posts\/497\/revisions"}],"predecessor-version":[{"id":506,"href":"https:\/\/fatreseller.in\/blog\/wp-json\/wp\/v2\/posts\/497\/revisions\/506"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fatreseller.in\/blog\/wp-json\/wp\/v2\/media\/505"}],"wp:attachment":[{"href":"https:\/\/fatreseller.in\/blog\/wp-json\/wp\/v2\/media?parent=497"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fatreseller.in\/blog\/wp-json\/wp\/v2\/categories?post=497"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fatreseller.in\/blog\/wp-json\/wp\/v2\/tags?post=497"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}