1.编译php5.4,加载相应模块
mysql模块编译时需要注意,--withmysql=DIR Include MySQL support. DIR is the MySQL base mysqlnd the MySQL native driver will be used
DIR是根目录,可以用find / -name mysql.h查找 ,/usr/include/mysql/mysql.h,只需/usr即可
./configure --prefix=/usr/local/php5 --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --enable-fastcgi --with-mysql=/usr --withmysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr
make
make install 编译好后发现少了一些模块,不过可以手动编译单个模块。
gd模块编译
cd ext/gd
/usr/local/php5/bin/phpize
./configure --with-php-config=/usr/local/php5/bin/php-config --with-freetype-dir=/usr/local/include/freetype2
make
make install snmp模块编译
cd ext/snmp
/usr/local/php5/bin/phpize
./configure --with-php-config=/usr/local/php5/bin/php-config
make
make install 编辑 /usr/local/php5/lib/php.ini,在最下面添加
extension =snmp.so
extension=gd.so
extension=mysql.so
extension=mysqli.so
extension=pdo_mysql.so 2. 安装fcgiwrap
apt-get install fcgiwrap 或者源码安装
autoreconf
./configure
make
make install
4.运行
/etc/init.d/fcgiwrap start
/usr/local/php5/sbin/php-fpm
nginx 5.cacti0.87g 使用php5.4出现错误的解决方法,错误内容为:PHP message: PHP Fatal error: Call to undefined function session_unregister() in /var/www/cacti/site/lib/functions.php on line 410,修改functions.php 410行附近内容为:
/* kill_session_var - kills a session variable using two methods -- session_unregister() and unset() */
function kill_session_var($var_name) {
/* register_global = off: reset local settings cache so the user sees the new settings */
/*session_unregister($var_name);*/
/* register_global = on: reset local settings cache so the user sees the new settings */
/*unset($_SESSION[$var_name]);*/
unset($var_name);
}