实例如下:
#!/bin/bash #this script is to install php extensions #author=steven #email=775189187@qq.com #writetime=sun aug 14 23:32:18 cst 2016 #the environment variable extension_home=/usr/local/src/php-5.6.16/ext/mysql php_home=/usr/local/webserver/php extension_install=mysql.so #enter the extension directory cd $extension_home #some of the set about php plugin modules $php_home/bin/phpize #target characteristics of the test installation platform $extension_home/configure --with-php-config=$php_home/bin/php-config #compile make #install make install #php.ini file insert the extension=$extension_install if grep -fxq "extension=$extension_install" $php_home/etc/php.ini then echo "extension=$extension_install exist " else echo -e "\n[mysql]\nextension=$extension_install" >> $php_home/etc/php.ini fi #restart php-fpm process kill -sigusr2 `cat $php_home/var/run/php-fpm.pid`
以上就是shell脚本实现安装php扩展的实例代码的详细内容。
