Page 1 of 1

S3 Curl and ASL

Posted: Mon Apr 15, 2013 9:44 am
by laughingbuddha
Hi all,

I'm attempting to use Undesigned's PHP S3 Class (http://undesigned.org.za/2007/10/22/amazon-s3-php-class) that uses PHP 5.2.x and CURL, but keep hitting a brick wall on it. The main issue is that I'm getting this error:

Code: Select all

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
So I figured, ok I'll disable Safe Mode in Plesk. Erm that didn't work, ok well maybe I'll run phpinfo and see what's happening. Erm nope, ok maybe Allow PHP Info is set to No in ASL, so I switch that to Yes, and still no phpinfo. Grrr, ok so I next I turn Safe Mode off in ASL as well. Finally starting to get somewhere.

But still the issue is I just can't seem to get past this error. I'm wondering is anyone else here has used this class, or could help me with this issue.

Thanks, Matt

Re: S3 Curl and ASL

Posted: Mon Apr 15, 2013 12:04 pm
by scott
Plesk is setting that open_basedir too.

Re: S3 Curl and ASL

Posted: Mon Apr 15, 2013 12:31 pm
by laughingbuddha
Is there an option to change it in Plesk? I couldn't see anything in the CP.

Re: S3 Curl and ASL

Posted: Mon Apr 15, 2013 12:37 pm
by prupert
laughingbuddha wrote:Is there an option to change it in Plesk? I couldn't see anything in the CP.
In Plesk 11.x you can alter the open_basedir value for a specific domain via the PHP Settings page under the Subscription website settings. Alternatively (or in other cases) you can disable open_basedir via a vhost.conf.

For security reasons it is not recommended to disable open_basedir. Where possible I would suggest only disabling open_basedir for a specific directory where the PHP script that requires this is located.

Re: S3 Curl and ASL

Posted: Mon Apr 15, 2013 1:57 pm
by laughingbuddha
Ok. So if I'm running an MVC framework, and the class file that is being called to run the command is in say the libs folder, I would disable it for that folder. Is that right?

Basically how I'm using the script is to upload the file to the server, processes it, then upload it to S3 bucket. In this case it is handling an image.

So with that in mind, what is the command needed for the vhost to disable it for just one directory?

Thanks

Re: S3 Curl and ASL

Posted: Mon Apr 15, 2013 7:34 pm
by laughingbuddha
Think I've got it to work, without having to mess about with the open_basedir. Someone made a patch to that S3 class, but it never got officially released. However I found the patch details in the gethub repo, and applied the changes. Added to that some security policy changes to the user account I created to perform these tasks, and we have a working script. YAY!

Anyone else happen to come across the same issue, drop me a message and I'll pass the script with the changes over to you.