I am trying to create a shared hosting scenario, using open_basedir option of php. I am doing this by adding the following to apache2.conf

<VirtualHost *:80>
    ServerName lt1.example.net
    DocumentRoot /home/akshat/example/tmpblogs/tb1/
    php_admin_value open_basedir /home/akshat/example/tmpblogs/tb1/

<VirtualHost *:80>
    ServerName lt2.example.net
    DocumentRoot /home/akshat/example/tmpblogs/tb2/
    php_admin_flag open_basedir /home/akshat/example/tmpblogs/tb2/

Now when I access lt2.example.net, I get the error:

Warning: Unknown: open_basedir restriction in effect. File(/home/akshat/example/tmpblogs/tb2/index.php) is not within the allowed path(s): (0) in Unknown on line 0

Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0

Fatal error: Unknown: Failed opening required '/home/akshat/example/tmpblogs/tb2/index.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0

I was getting the same error while accessing "lt1.example.net" too, but then it suddenly became alright.

What am I doing wrong here?


Found the mistake. It is a stupid one.

In site 2 I am using "php_admin_flag" directive instead of "php_admin_value". Problem solved

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.