We were recently using a class we had created to access RETS/MLS in PHP which required that both cookies could be written locally and CURLOPT_FOLLOWLOCATION was enabled.

The actual error was:

 CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in /var/file/location

We are running this particular site as a virtual host on Apache.

To both disable safe mode as well as remove the open_basedir issue follow these instructions. Please note that safe mode is going away in future versions of PHP.

  1. Fire up your UNIX shell of choice, navigate to the location of your httpd.conf file for the virtual host (or your single httpd.conf file with multiple virtual hosts enabled):
cd /var/www/virtualhosts/domain.com/conf
  1. Edit the file
vi httpd.conf
  1. Add the following 2 lines to the required location in your httpd.conf file and save the edits:
php_admin_flag safe_mode off
php_admin_flag open_basedir none
  1. Reload the apache service
service httpd reload

You’re all set!

Optionally you could also change this configuration in the default php.ini file, but this is a much safer and restricted approach.