I'm confused why these two things are, or appear to be, mutually exclusive, and wonder if there is a way around being able to use both on PHP-5.4. Trying to set this option, I get the following error:
curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set
I am using a MailChimp API library that requires CURLOPT_FOLLOWLOCATION to be set. Redirects can happen, and should be followed, and that is just the way the Internet works.
I am also using open_basedir on the domain. I want to ring-fence the directories that the site is able to access. It is just a security thing, and belt-and-braces along with other security measures.
So, is there any way to use both together? I want CURL to follow redirections, but also keep local file access of the PHP scripts to defined directories. The only approach I have seen that attacks this problem is one that emulates CURL following redirects, but that seems clumsy, then CURL is already designed to do that.
Edit:
In case it is not clear, this is the line throwing the error in the package I am using:
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true);
IMO PHP is being overly protective, and it should allow me to do this. So is there a way - without hacking/forking this package - to tell PHP, "look, I know what I am doing here"?
I have raised it as an issue with the package developers, but not got a response to date. If the package supported injection of the transport layer, then I could just work around it by using an alternative to PHP's curl functions.