How do I limit PHP apps to their own directories and their own php.ini?

前端 未结 6 744
走了就别回头了
走了就别回头了 2021-01-01 00:38

I am running multiple PHP apps on my Mac, running OS X 10.5.6, Apache 2, PHP 5. I have subdomains setup for each project, a host file entries for each subdomain, and Virtua

6条回答
  •  悲&欢浪女
    2021-01-01 01:30

    You can limit a scripts ability to see anything above a specific folder tree by adding the open_basedir directive a folder block in the httpd.conf file. It should look like:

    php_admin_value open_basedir "/full/path/to/top/folder/of/desired/tree/"

    One thing - if you don't end the path with a / then it's a wildcard match. In other words, "/var/etc/my" will match "/var/etc/myFolder" as well as "/var/etc/myMothersFolder", while "/var/etc/my/" will only match that exact folder name.

提交回复
热议问题