FTP cURL problem caused by SAFE MODE setting???

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

FTP cURL problem caused by SAFE MODE setting???

Post by alex.barylski »

I am getting this error on a client server...SAFE MODE is OFF...however open_basedir is set to the following: /home/lgadmin/:/usr/lib/php:/usr/local/lib/php:/tmp

Error:

Code: Select all

CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an
open_basedir is set in /home/lgadmin/public_html/temp/index.php on line
1866
Code:

Code: Select all

if (function_exists('curl_init')) {
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
I've read the docs on open_basedir, etc...but it doesn't say anything about cURL functions not working with SAFE MODE on or when open_basedir, etc...

What the heck? Any ideas? It's a shared host so I'm limited in what I can do with the server...

Cheers :)
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post by Buddha443556 »

There was a security problem with CURLOPT_FOLLOWLOCATION and open_basedir as I recall.
from the PHP 5.2.0 Change Log:

Disabled CURLOPT_FOLLOWLOCATION in curl when open_basedir or safe_mode are enabled. (Stefan E., Ilia)
Does it work with CURLOPT_FOLLOWLOCATION set to false?
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

I didn't try that...I just suppressed the error which appears to have done the trick...

Thanks :)
Post Reply