To add a new structure out the PHP directory, you have to do first:
- Configure the .ini file
- Add to your IDE the interpretor
一个非常安全的做法就是把 PHP 解释器放在 web 目录外的地方,比如说 /usr/local/bin。这样做唯一不便的地方就是必须在每一个包含 PHP 代码的文件的第一行加入如下语句:
#!/usr/local/bin/php
#!
开头的 shell-escape 机制来启动它们。
要使 PHP 能使用此设置正确处理 PATH_INFO 和 PATH_TRANSLATED 信息,需要开启 cgi.discard_path ini 指令。
To add a new structure out the PHP directory, you have to do first:
- Configure the .ini file
- Add to your IDE the interpretor
You can use binfmt-misc to avoid the need for the #! line, by registering your php5-cgi binary as an interpreter for *.php files. E.g. with Debian binfmt-misc installed:
update-binfmts --install php5 /usr/bin/php5-cgi --extension php
cat /proc/sys/fs/binfmt_misc/php5
However, you still need chmod +x on the .php file. And Apache will give a rather sad "500 Internal Server Error" if you are missing the +x permissions :( You can improve the error message using mod_rewrite (but not obliviate the need for +x)..