9

I'm attempting to use multiple paths for my php open_basedir config value, in php.ini on a windows server.

The line I'm using is:

open_basedir = E:/Websites;C:/PHP/includes/

Unfortunately, it's ignoring the second entry. Whenever I try to execute code in the C:/PHP/includes directory (this example happens to be PHPUnit), I get

PHP Warning: require(): open_basedir restriction in effect. File(C:\PHP\includes\PHPUnit\PHPUnit-3.6.10\PHPUnit\Autoload.php) is not within the allowed path(s) : (E:/Websites) in C:\PHP\includes\PHPUnit\PHPUnit-3.6.10\phpunit.php on line 41

Note, it's not even showing the second item in the paths list. Can anyone spot where I'm going wrong?

Am I right in thinking that semicolon (;) denotes a comment? If so, how do I separate the entries, as the manual doesn't make it clear

2 Answers 2

8

Don't forget put quotes " around whole path, and AFAIR windows is using different notation? try sth like that: open_basedir = "E:\Websites;C:\PHP\includes"

2
  • the quotes did it for me on windows server 2012 with php 5.4.14, thanks
    – Richard
    Nov 5, 2013 at 15:19
  • Not working from the command-line: php.exe -t "%DOCROOT%" -d open_basedir="%TEMP%;%DOCROOT%" -S 0.0.0.0:8000
    – Massimo
    Jul 8, 2022 at 22:32
5

I had the same problem.

Just use a simple colon : as a separator, then it works.

Note for clarity: "Under Windows, separate the directories with a semicolon. On all other systems, separate the directories with a colon." (from the php docs)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .