{"id":725,"date":"2024-02-14T12:36:09","date_gmt":"2024-02-14T12:36:09","guid":{"rendered":"https:\/\/linuxresellerwebhosting.in\/blog\/?p=725"},"modified":"2024-03-30T12:27:09","modified_gmt":"2024-03-30T12:27:09","slug":"custom-php-modules-in-directadmin","status":"publish","type":"post","link":"https:\/\/linuxresellerwebhosting.in\/blog\/custom-php-modules-in-directadmin\/","title":{"rendered":"Add Custom PHP Modules with Custombuild in DirectAdmin"},"content":{"rendered":"<p>Custom PHP Modules ,PHP is a open source script which mainly used to create or build static and dynamic pages. PHP is supported by all <a href=\"https:\/\/www.linuxresellerwebhosting.in\/dedicated-servers\/\">linux web servers.<\/a><\/p>\n<p>PHP modules, also known as PHP extensions, are libraries of functions that add specific capabilities to the PHP programming language. These extensions are compiled into PHP and can be dynamically loaded or statically linked to enhance PHP&#8217;s functionality.<\/p>\n<p>It can be compiled with PHP to enable static loading or dynamic loading. PHP modules are used for different purposes with only a few extensions.<\/p>\n<p>It play a crucial role in enhancing the capabilities, performance, security, and maintainability of PHP applications,<\/p>\n<p>Various websites may require some additional modules and extensions. You may extend your PHP functionality by using our Custom Build tool.<\/p>\n<p>All extensions are mainly maintained by PECL, which stands for PHP Extension Community Library. It has extensions written in C, which can be loaded into PHP to provide additional functionality.<\/p>\n<p>PHP maintains an alphabetical list of all the available extensions via the <a href=\"https:\/\/www.php.net\/manual\/en\/extensions.alphabetical.php\" target=\"_blank\" rel=\"noopener noreferrer\">php.net website<\/a><\/p>\n<p><strong>Single PHP Version<\/strong><\/p>\n<p>If your server only has a single PHP version installed, you can run this PHP command anywhere, and it will give you the same list of modules. The general command we will be using is php -m. This command will give you the full list of installed PHP modules\/extensions.<\/p>\n<pre>[root@dedicated ~]# php -m<\/pre>\n<p>This command will give you an output similar to the following information.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-726 size-full\" src=\"https:\/\/linuxresellerwebhosting.in\/blog\/wp-content\/uploads\/2024\/02\/php-m.png\" alt=\"Custom PHP Modules\" width=\"699\" height=\"843\" srcset=\"https:\/\/linuxresellerwebhosting.in\/blog\/wp-content\/uploads\/2024\/02\/php-m.png 699w, https:\/\/linuxresellerwebhosting.in\/blog\/wp-content\/uploads\/2024\/02\/php-m-249x300.png 249w\" sizes=\"auto, (max-width: 699px) 100vw, 699px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2 id=\"installing-extensions\" tabindex=\"-1\"><span class=\"ez-toc-section\" id=\"Custom_PHP_Modules_Installing_extensions\"><\/span>Custom PHP Modules Installing extensions<span class=\"ez-toc-section-end\"><\/span><\/h2><div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/linuxresellerwebhosting.in\/blog\/custom-php-modules-in-directadmin\/#Custom_PHP_Modules_Installing_extensions\" >Custom PHP Modules Installing extensions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/linuxresellerwebhosting.in\/blog\/custom-php-modules-in-directadmin\/#Add_a_custom_module_to_PHP_with_CustomBuild\" >Add a custom module to PHP with CustomBuild<\/a><\/li><\/ul><\/nav><\/div>\n\n<p>Most of all control panel provides a set of possible extensions to be already complied by default. Here DirectAdmin already provides a set of possible extensions to be easily compiled using our CustomBuild tool, including:<\/p>\n<pre>bz2\r\ngmp\r\nhtscanner\r\nigbinary\r\nimagick\r\nimap\r\nioncube\r\nldap\r\nopcache\r\nphalcon\r\nredis\r\nreadline\r\nsuhosin\r\nsnuffleupagus\r\nxmlrpc\r\nzend<\/pre>\n<p>Those can be installed using the following commands: For example if you need to compile ioncube<\/p>\n<p>Than use the below commands,<\/p>\n<pre>cd \/usr\/local\/directadmin\/custombuild\r\n.\/build set_php \"ioncube\" yes\r\n.\/build \"php_ioncube\"<\/pre>\n<p>We can add more extensions to the list.<\/p>\n<h2 id=\"add-a-custom-module-to-php-with-custombuild\" tabindex=\"-1\"><span class=\"ez-toc-section\" id=\"Add_a_custom_module_to_PHP_with_CustomBuild\"><\/span>Add a custom module to PHP with CustomBuild<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>You may want to compile your PHP with a custom module. It can be done by using the <strong>&#8211;with-module<\/strong> flag.<\/p>\n<p>First, let&#8217;s figure out which configuration file your system is using. Type:<\/p>\n<pre>cd \/usr\/local\/directadmin\/custombuild\r\n.\/build used_configs | grep configure.php<\/pre>\n<p>It might look like this:<\/p>\n<p>PHP (default) configuration file: <strong>\/usr\/local\/directadmin\/custombuild\/configure\/php\/configure.php74<\/strong><\/p>\n<p>Be ware to whether your files is located in<strong> \/usr\/local\/directadmin\/custombuild\/**configure**\/php\/configure.php74 or \/usr\/local\/directadmin\/custombuild\/**custom**\/php\/configure.php74<\/strong><\/p>\n<p>In case you&#8217;re already using a custom configuration file, you can skip the above step<\/p>\n<p>To start customizing the compilation parameters, first we need to create a custom compilation file:<\/p>\n<pre>cd \/usr\/local\/directadmin\/custombuild\r\nmkdir -p custom\/php\r\ncp -fp \"configure\/php\/configure.php74\" \"custom\/php\/configure.php74\"<\/pre>\n<p>Add your &#8211;with-module line to the end of the custom\/php\/{{configurephp}} file, and make sure the \\ character exists at the end of all lines except the last one. The \\ character tells the configure line to loop to the next line, making the line easier to read. Without the \\ character to trigger the wrap, the next line is incorrectly read as a separate command.<\/p>\n<p>Once set, type:<\/p>\n<pre>.\/build php<\/pre>\n<p>Restart Apache and if necessary, PHP-FPM.<\/p>\n<pre>systemctl restart httpd\r\nsystemctl restart php-fpm74<\/pre>\n<p>If any error occured during the above process just looks like<\/p>\n<pre>\/usr\/local\/directadmin\/custombuild\/custom\/php\/configure.php74: line 32: --with-module: command not found<\/pre>\n<p>which simply means that the <strong>\\<\/strong> character was not correctly added on the line before the last <strong>&#8211;with-module<\/strong>.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Custom PHP Modules ,PHP is a open source script which mainly used to create or build static and dynamic pages.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[1],"tags":[],"class_list":["post-725","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/posts\/725","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/comments?post=725"}],"version-history":[{"count":8,"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/posts\/725\/revisions"}],"predecessor-version":[{"id":734,"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/posts\/725\/revisions\/734"}],"wp:attachment":[{"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/media?parent=725"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/categories?post=725"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/tags?post=725"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}