lnmp0.9的一些bug处理方法

转自点点 12 年前 回复

, , , , , ,

貌似lnmp从0.9开始,限制了不少函数,理由是出于安全考虑,但是这也影响了一些网站程序。

譬如 DiscuzX 通信失败或通过Socket连接SMTP无法发送邮件或wordpress Akismet 无法工作问题的解决方法目前LNMP 0.9禁用了部分危险函数:passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,fsockopen

由于禁用了pfsockopen、fsockopen 会造成 Discuzx Discuz X通行失败,通过Socket连接SMTP无法发送邮件 或wordrpess的Akismet 无法工作:引用:您的主机似乎禁用了 PHP 的 fsockopen 或 gethostbynamel 函数。在此问题修复之前,Akismet 无法工作。请联系您的主机服务管理员或防火墙管理员,并向他们提供 Akismet 的运行环境要求。解决方法:
目前最常可能用到的就是pfsockopen、fsockopen,如果将这2个函数从禁用列表里删除可以执行:

sed -i 's/disable_functions =.*/disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket/g' /usr/local/php/etc/php.ini

 

然后执行:/etc/init.d/php-fpm restart 重启生效

如果想完全删掉禁用列表里的函数可以执行:

sed -i 's/disable_functions =.*/disable_functions =/g' /usr/local/php/etc/php.ini

再执行:/etc/init.d/php-fpm restart 重启生效

wordpress3.4后主题管理不显示其他的主题?
解决方法:将scandir 函数从禁用列表里删掉就行了。

sed -i 's/disable_functions =.*/disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket/g' /usr/local/php/etc/php.ini

然后执行:/etc/init.d/php-fpm restart 重启生效

安装好ImageMagick,在后台设置好路径,但是无法预览缩略图效果?
解决方法:将exec 函数从禁用列表里删掉就行了。

sed -i 's/disable_functions =.*/disable_functions = passthru,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket/g' /usr/local/php/etc/php.ini

然后执行:/etc/init.d/php-fpm restart 重启生效

感谢XMJ's Blog分享。

支付宝打赏微信打赏

如果此文对你有帮助,欢迎打赏作者。

发表评论

欢迎回来 (打开)

(必填)