ansonphong / postworld

Wordpress Theme Development Framework
GNU General Public License v2.0
7 stars 0 forks source link

grab_image() Causing Error on Staging server #83

Closed ansonphong closed 10 years ago

ansonphong commented 10 years ago

Hi Haidy, Michel, There's an issue which is important to fix before going public -- here it is.

When running pw_save_post() in the post_link screen, the server response is:

<br />
<b>Warning</b>:  curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set in <b>/var/www/vhosts/realitysandwich.com/staging.realitysandwich.com/wp-content/plugins/postworld/php/postworld_images.php</b> on line <b>75</b><br />
{"version":"0.1","status":200,"data":214561}

So I noticed that the original file_get_contents method has been commented out, and in place is a custom function grab_image.

grab_image($image_url,$file);//file_get_contents($image_url);

Can I revert to the original file_get_contents function, or is the grab_image function critical?

michelhabib commented 10 years ago

Phong, i will reply for part of the issue. there is some unknown server setting either in reality sandwich or staging that is preventing any function that grabs images from running with redirection. Redirection means grabbing a file from url where the url redirects to another url. This issue happens only between staging and live servers, it works very well with any other website. We could not find or change that setting, it took us a long time trying all possible options, and we narrowed it down to 2 options, i just can't recall the issue id, will search for it now.

Anyways, the easy option, was to grab the final urls, so, instead of grabbing realitysandwich.com/imagefilename, we grab www.realitysandwich.com/imagefilename, in that case it works very well.

Not sure if that applies in the case above, so i will just ask Haidy what we can do.

ansonphong commented 10 years ago

OK - if this modification was only used for migration, and if you're now finished with it, then I'll revert to the original function.

Just let me know if you still need it in there for now. If you do, I'll duplicate the parent function to use that one separately for the migration, so it doesn't effect the front-end.

ansonphong commented 10 years ago

In the future, if modifying this function for migrations, please make a duplicate of the function so that it remains isolated. Thank you.