CakePHP – Open_Basedir Restriction in Effect

Just deployed a CakePHP on a domain running PLESK and dismayed by the fact that your screen is over-flowing with warning about open_basedir restriction in effect? Fear not, the solution is straight forward (if a little frustrating to track down!)

The problem is caused by this line (line 69, in CakePHP 1.2.0.6311) in /app/webroot/index.php:

ini_set('include_path', CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS . PATH_SEPARATOR . ini_get('include_path'));

Yep, the simple ini_set command – the clues should start coming in thick and fast that ini_set is causing the problem due to the fact taht open_basedir complains about paths with :’s in their structure. (:’s being the delimiter for automatically included paths). To fix the problem you can either remove the if logic that calls “function_exists(‘ini_set’)”, or, if you prefer to fix things the corret way, modify the line to remove the final stub:

ini_set('include_path', CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS);

Good luck, hope that saves someone a headache! :)

This entry was posted in CakePHP and tagged , , , . Bookmark the permalink.

4 Responses to CakePHP – Open_Basedir Restriction in Effect

  1. Lloyd says:

    That has seriously saved so much time for me – it got rid of all of those errors..but… there’s always a but..

    I am getting these errors still..
    Warning: fread(): 18 is not a valid stream resource in /home/httpd/vhosts/wayfunky.com/subdomains/crm/httpdocs/cake/libs/file.php on line 170

    Warning: fclose(): 18 is not a valid stream resource in /home/httpd/vhosts/wayfunky.com/subdomains/crm/httpdocs/cake/libs/file.php on line 266

    Warning: fwrite(): 18 is not a valid stream resource in /home/httpd/vhosts/wayfunky.com/subdomains/crm/httpdocs/cake/libs/file.php on line 236

    Warning: fclose(): 18 is not a valid stream resource in /home/httpd/vhosts/wayfunky.com/subdomains/crm/httpdocs/cake/libs/file.php on line 266

    Warning (2): fwrite(): 18 is not a valid stream resource [CORE/cake/libs/file.php, line 236]

    I am not sure – but I am trying to set up a sub-domain not a primary domain with cake. It’s plesk 7.5.4 that I’m trying to use as well.

    Do you think it has anything to do with this? http://www.experts-exchange.com/Software/Server_Software/Web_Servers/Apache/Q_21788041.html?sfQueryTermInfo=1+apach+cgi+httpd.conf+plesk+rail+rubi+vhost

    My head is about to explode

  2. Steven says:

    thx mate, very very useful. Just saved me an aspirine.

  3. Thanks a lot for this tip. I am new to CakePHP and Plesk.

    This tip has been of great help for me!

    Kind regards, Christine

  4. Shaun says:

    The fix didn’t work for me, but I am not using Plesk. I have a feeling this is going to waste my whole day.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">