今天给网站换服务器结果无法正常运行,一步步排查后发现是没有安装xxtea扩展导致加解密函数无法使用,于是就安装xxtea扩展

pecl install xxtea

结果提示一堆警告加一个错误提示ERROR: failed to run 'phpize'

WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update

Warning: readlink() has been disabled for security reasons in OS/Guess.php on line 201
PHP Warning:  readlink() has been disabled for security reasons in /usr/local/php/lib/php/OS/Guess.php on line 201

Warning: popen() has been disabled for security reasons in OS/Guess.php on line 254
PHP Warning:  popen() has been disabled for security reasons in /usr/local/php/lib/php/OS/Guess.php on line 254

Warning: fgets() expects parameter 1 to be resource, null given in OS/Guess.php on line 255
PHP Warning:  fgets() expects parameter 1 to be resource, null given in /usr/local/php/lib/php/OS/Guess.php on line 255

Warning: pclose() expects parameter 1 to be resource, null given in OS/Guess.php on line 264
PHP Warning:  pclose() expects parameter 1 to be resource, null given in /usr/local/php/lib/php/OS/Guess.php on line 264
downloading xxtea-1.0.11.tgz ...
Starting to download xxtea-1.0.11.tgz (7,404 bytes)
.....done: 7,404 bytes
4 source files, building
running: phpize

Warning: popen() has been disabled for security reasons in PEAR/Builder.php on line 525
PHP Warning:  popen() has been disabled for security reasons in /usr/local/php/lib/php/PEAR/Builder.php on line 525
ERROR: failed to run `phpize'

于是开始疯狂的百度,百度给出的结果大概意思是在php.ini里将popen函数禁用了,只需要将php.ini里disable_functions的值里面的popen去掉即可
最初:

disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,`popen`,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server

修改后:

disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server

然后重启php-fpm

/etc/init.d/php-fpm restart

再次安装xxtea扩展成功,重启php-fpm,网站正常运行!


海枫
43 声望0 粉丝