#!/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`
#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`

本文介绍了一种手动安装PHP MySQL扩展的方法。通过配置环境变量、进入扩展目录、设置PHP模块、编译并安装扩展,最后更新php.ini文件及重启php-fpm服务完成整个过程。
33万+

被折叠的 条评论
为什么被折叠?



