This is an old revision of the document!


PHP

Gotchas

open_basedir and CURLOPT_FOLLOWLOCATION

This error appears in the PHP log:

PHP Warning:  curl_setopt() [<a href='function.curl-setopt'>function.curl-setopt</a>]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in /var/foo/bar.php on line 123

Updating open_basedir to include the directory won't work, because the curl option CURLOPT_FOLLOWLOCATION is disabled by PHP when open_basedir is set.

The purpose for this not working is that curl will follow a result with a header pointing to another location, which creates the option of directory traversal outside of the limited basedir.

This change was introduced in PHP 4.4.4.