Install PHP extension on Directadmin – fast and easy way (without custombuild)

Directadmin is pretty good, lightweight, control panel for providing web hosting service or to host your own websites/projects, managing mail … Through the years, I recompiled PHP with custombuild countless times. Problem is, that every time that you want to install some new PHP extension – exif, in this example – you’ll have to rebuild whole PHP with Directadmin’s custombuild also. That can be very annoying and time-consuming. Expesialy when things go wrong. So, there is simple way on how to quickly install PHP extensions without using custombuild. I used this way many times. In this case, installation was done on CentOS 7.2 server with Directadmin and PHP version 5.6.23.

I hope this was helpful to you in any way.

  1. Navigate to your Directadmin’s custombuild directory. Don’t worry, we won’t use custombuild.
    [root@webserver ~]# cd /usr/local/directadmin/custombuild
    [root@webserver custombuild]#
  2. Search for PHP package and unarchive it.
    [root@webserver custombuild]# ls -l | grep php
    -rw-r--r-- 1 root root 18428932 Jun 23 18:40 php-5.6.23.tar.gz
    [root@webserver custombuild]# tar -xvzf php-5.6.23.tar.gz
  3. Go to php directory that was created when you unarchive package.
    [root@webserver custombuild]# cd php-5.6.23
    [root@webserver php-5.6.23]#
  4. Navigate to ext directory where extensions are. Go to directory of extension that you want to install. In this case exif.
    [root@webserver php-5.6.23]# cd ext/exif/
    [root@webserver exif]#
  5. Run phpize. Be shure to run the right one! In my case, phpize path is /usr/local/php56/bin/phpize. I’m using php version 5.6 on CentOS server. Change this accordingly to your installation.
    [root@webserver exif]# /usr/local/php56/bin/phpize
    Configuring for:
    PHP Api Version: 20131106
    Zend Module Api No: 20131226
    Zend Extension Api No: 220131226
  6. Run configure. Again, be shure to include right php-config file!
    [root@webserver exif]# ./configure --with-php-config=/usr/local/php56/bin/php-config
    checking for grep that handles long lines and -e... /usr/bin/grep
    checking for egrep... /usr/bin/grep -E
    checking for a sed that does not truncate output... /usr/bin/sed
    checking for cc... cc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    ...
  7. Then run make. You should see part that says “Libraries have been installed in” and “Build complete”.
    [root@webserver exif]# make
    ...
    ----------------------------------------------------------------------
    Libraries have been installed in:
    /usr/local/directadmin/custombuild/php-5.6.23/ext/exif/modules
    Build complete.
    ...
  8. Install extension by run make install. You’ll also see in which directory extension was installed.
    [root@webserver exif]# make install
    Installing shared extensions: /usr/local/php56/lib/php/extensions/no-debug-non-zts-20131226/
    [root@webserver exif]# cd /usr/local/php56/lib/php/extensions/no-debug-non-zts-20131226/
    [root@webserver no-debug-non-zts-20131226]# ls
    exif.so opcache.a opcache.so
  9. Open your php.ini file and find part where it says extension_dir. Add this line below commented “; extension_dir = ext” part. In my case is exif extension. Change this according to your install.
    ...
    ; extension_dir = "ext"
    extension=exif.so
    ...
  10. Restart apache and check if extension is installed. In my case, there is.
    [root@webserver exif]# php -m | grep exif
    exif

That’s it. I hope that it works for you also. Have a good one! 🙂

[kofi]

4 Comments

Got Something To Say:

Your email address will not be published. Required fields are marked *

*

I accept the Privacy Policy

This site uses Akismet to reduce spam. Learn how your comment data is processed.

After installing the modules with phpize is it still possible to install additional PHP modules with custombuild?

Can you explain the difference between PECL en phpize?

Thank you very much. Its working!!!

Спасибо, всё чётко работает! Thank You!

© 2024 geegkytuts.net
Hosted by SIEL


About author