How to enable PHP GMP --with-gmp on DirectAdmin CustomBuild

Andy

Administrator
If you want to add any extra modules to PHP, they'll most likely need to be compiled in. Any module that needs to be compiled in will have a --with-gmp type flag which will need to be used.
  1. First, figure out which configure file your system is using. Type:
    Bash:
    cd /usr/local/directadmin/custombuild
    ./build used_configs | grep configure.php
    Depending on your PHP version, it might look like this:
    Code:
    PHP (default) configuration file: /usr/local/directadmin/custombuild/configure/fpm/configure.php72
    Change in the values if they're different.
  2. To add this flag, run the following:
    Bash:
    cd /usr/local/directadmin/custombuild
    mkdir -p custom/fpm
    cp -fp configure/fpm/configure.php72 custom/fpm/configure.php72
  3. Add your --with-gmp line to the end of the custom/fpm/configure.php72 file, and make sure the \ character exists at the end of all lines except the last one. The \ character tells the line configure line to loop to the next line, making the configure settings easier to read. Without the \ character to trigger the wrap, the next line becomes a separate command, which is not correct. (see error below). Once set, type:
    Bash:
    ./build php n
    Change configure.php5 to configure.php4 if you're using php4.
    If you're using suphp, the paths would be configure/suphp/configure.php5 and custom/suphp/configure.php5.
    • If you get the following error message:
      Code:
      configure: error: Unable to locate gmp.h
    • Check if the following file is exist:
      Code:
      /usr/include/x86_64-linux-gnu/gmp.h
      If not:
      Code:
      sudo apt-get install libgmp-dev
  4. Restart apache:
    RedHat:
    Bash:
    /sbin/service httpd restart
    FreeBSD:
    Bash:
    /usr/local/etc/rc.d/httpd restart
Another common error people run into looks like this:
Code:
/usr/local/directadmin/custombuild/custom/fpm/configure.php72: line 36: --with-gmp: command not found
Which simply means that the \ character was not correctly added on the line before --with-gmp.
 
Top