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.
- 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]#
- 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
- 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]#
- 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]#
- 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
- 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 ...
- 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. ...
- 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
- 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 ...
- 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]
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?
@Richard of course.
Thank you very much. Its working!!!
Спасибо, всё чётко работает! Thank You!