默认情况下,我的php.ini
位于/etc/php.ini
,我想将其移至/tmp/ab/etc/php.ini
。在/etc/lighttpd/lighttpd.conf
我尝试设置以下配置:
#### CGI module
cgi.assign = ( ".pl" => "/usr/bin/perl", ".cgi" => "/usr/bin/perl", ".py" => "/usr/bin/python", "cgi-bin/luci" => "", ".php" => "/usr/bin/php-cgi -c /tmp/ab/etc/php.ini", "sms_gateway" => "/bin/bash", "cgi-bin/check" => "/bin/sh", "cgi-bin/remove" => "/bin/sh", "cgi-bin/date" => "/bin/sh" )
请查看此部分:".php" => "/usr/bin/php-cgi -c /tmp/ab/etc/php.ini"
但在我这样做并重新启动lighttpd之后,我尝试用{}检查php.ini
的位置:
<?php
phpinfo();
?>
我的浏览器上显示500 - Internal Server Error
。我怎么能这样做?
答案 0 :(得分:1)
一种解决方案是创建一个包装脚本/ tmp / ab / bin / my-php-cgi并将其放在lighttpd.conf中cgi.assign = ( ".php" => "/tmp/ab/bin/my-php-cgi" )
#!/bin/sh
exec /usr/bin/php-cgi -c /tmp/ab/etc/php.ini
根据您使用的PHP版本,您可能还会考虑使用lighttpd.conf setenv.add-environment = ( "PHPRC" => "/tmp/ab/etc/php.ini" )
另请参阅How to change the path to php.ini in PHP CLI version