PDA

View Full Version : [GAL] Image-Upload failed -> Safe_Mod_on


za4a tuner
03-07-2008, 11:15 AM
Hello,
i have some trouble by uploading images to GAL.

My server where the forum is hosted uses php5.2.5-0.dotdeb.2 and mysql5.0.51a-0.dotdeb.1-log (php-info (http://www.zafira-forum.de/index.php?do=phpinfo))

In the vBulletin-settings the safemod is set to yes -> and the tmp-path (/var/www/web27/html/forum/tmp) is set correct (attachement and avatar upload is OK).
When i try to activate at the GAL-Settings the safe_mod (Thumbnails -> Safe mod on? ->) to YES ... after safing the settings it turns back to NO!

When i try to upload an image the following error-message appears:
Warning: move_uploaded_file() [function.move-uploaded-file]: SAFE MODE Restriction in effect. The script whose uid is 686 is not allowed to access /var/www/web27/html/forum/geek/gal/images/1 owned by uid 33 in /geek/gal/includes/gal_functions_image.php on line 263

The folders -> images, 1 and 4 are chmoded to 777


Why does it not work?

Morgan
03-07-2008, 01:41 PM
Grab the GAL package again, reFTP the gal_admin.php file into the /forum/admincp directory, and then in the GAL ACP settings, set 'Safe mode on' to yes and it'll stick.

za4a tuner
03-08-2008, 08:05 AM
Thanks for the repack,
no the settings are OK, but the upload still doesn't work.

I get the following message when i try to upload an image:
1. Got some freaky error while moving file.

Any help for this?


kr Chris

Morgan
03-09-2008, 10:35 PM
In the gal_functions_image.php file find:

if (!move_uploaded_file($file['tmp_name'], $dest))
{
@unlink($file['tmp_name']);
$errors[] = "Got some freaky error while moving file.";
return;
}

And beforehand add:

ini_set('display_errors', true);
error_reporting(E_ALL);
move_uploaded_file($file['tmp_name'], $dest);

Then try another upload and copy-paste any PHP message you see on screen.

Afterwards you can undo that edit.

za4a tuner
03-10-2008, 07:28 AM
I did the edits, tried a new upload => but there are no php-errors shown!
The upload failed again ... the errormessage is the same as i posted before:
1. Got some freaky error while moving file.

Morgan
03-10-2008, 02:23 PM
Are you sure /var/www/web27/html/forum/tmp is correct? When I go to http://www.your-domain.de/forum/tmp/ I get a 404 not found message. Perhaps you need to use /var/www/web27/html/tmp instead and set the directory permissions so that http://www.your-domain.de/tmp/ does not generate a 403 forbidden message.

za4a tuner
03-12-2008, 09:12 AM
Are you sure /var/www/web27/html/forum/tmp is correct? Yes i am, this is the Serverpath to the temp-folder, set in tne ACP -> vBulletin -> Serversettings and optim.

When I go to http://www.your-domain.de/forum/tmp/ I get a 404 not found message. Perhaps you need to use /var/www/web27/html/tmp instead and set the directory permissions so that http://www.your-domain.de/tmp/ does not generate a 403 forbidden message.My domain links to -> "forum", so that the domainpath is -> http://www.your-domain.de//tmp/
When i upload an avatar or an attachment to the forum -> it works perfectly,
so i think, this settings must be ok!


But whats about the settings @ the gal (ACP)
There i have to set the serverpath and the URL to header images.
The Server path to images is -> /var/www/web27/html/forum/geek/gal/images
and path of URL to header images is -> geek/gal/images/

Where does GAL upload the images first (before moving)?
TMP or geek/gal/images/1


kr Chris

Morgan
03-12-2008, 12:14 PM
Uploads go to your server's /tmp and then to your safe mode temp directory and then get moved to the /geek/gal/images directory or whatever directory you have set in the GAL ACP settings. When GAL created the /1 directory in the /geek/gal/images directory, it tried to set 777 permissions on the /geek/gal/images/1 directory. Do you see 777 permissions on the /geek/gal/images/1 directory?

za4a tuner
03-13-2008, 12:44 AM
Yes, the Folders -> images + 1 + 4 <- have 777 permission!

I deleted the Folder "1" and get the following error:
1. Cannot open server path for images.
after that i created the folders again, chmod is 777 -> and tried another upload =>
1. Got some freaky error while moving file.

Morgan
03-13-2008, 02:45 AM
Try setting 755 directory permissions on /tmp so that http://www.your-domain.de/tmp/ does not generate a 403 forbidden message.

za4a tuner
03-14-2008, 05:17 AM
Try setting 755 directory permissions on /tmp ....when i use this settings, i get the following error:
1. Unable to move this file.
and also i can't upload any images like avatars or sig-pics to the forum!

Morgan
03-14-2008, 05:43 PM
What happens if you set 777 permissions on that directory?

za4a tuner
03-15-2008, 07:53 AM
What happens if you set 777 permissions on that directory?
This setting is "standard" => but i get this error by uploading an image by using GAL =>
1. Got some freaky error while moving file.:

Morgan
03-15-2008, 01:38 PM
In the gal_functions_image.php file find:

if (!move_uploaded_file($file['tmp_name'], $dest))

And beforehand add the following:

echo ':: ' . $file['tmp_name'] . ' :: ' . $dest . ' ::';
exit();

Then try another upload and copy-paste here what you see on screen.

Afterwards you can undo that edit.

za4a tuner
03-16-2008, 12:38 AM
with this edit, i get the following message:
:: /var/www/web27/html/forum/tmp/32bc5452c6bc74dd32188b45e5f37a12 :: /var/www/web27/html/forum/geek/gal/images/1/post_thanks.gif ::

Morgan
03-16-2008, 01:22 AM
I think I see the problem. Try this...

In the gal_functions_image.php file find:

if (!move_uploaded_file($file['tmp_name'], $dest))

And replace with the following:

if (!rename($file['tmp_name'], $dest))

Then try another upload and let me know if it works.

za4a tuner
03-17-2008, 07:15 PM
Sorry Morgan, but it doesn't work.

I did the edit you postet => and after that i get the following message:
Warnung: rename() [function.rename]: SAFE MODE Restriction in effect. The script whose uid is 686 is not allowed to access /var/www/web27/html/forum/geek/gal/images/1 owned by uid 33 in /geek/gal/includes/gal_functions_image.php (Zeile 263)

Morgan
03-18-2008, 05:15 PM
Did you create the /1 directory? If you did, delete that directory and let GARS create that directory when it goes to save the image, keeping the edit in post sixteen in place.

za4a tuner
03-18-2008, 05:53 PM
Yes, i created this directory.
Now i deleted it, tried another upload => and now i get this errormessage:
1. Cannot open server path for images.
Folder "1" was created by GAL with the settings "777" .... but the upload failed.

kr chris

Morgan
03-18-2008, 06:57 PM
Make sure that the GARS /images directory has 777 permissions, and let GARS create the /1 directory, keeping the edit in post sixteen in place.

za4a tuner
03-20-2008, 08:32 PM
Make sure that the GARS /images directory has 777 permissions, YES, it is =>
948
and let GARS create the /1 directory,the directory was deletet by me (the images inside this folder where uploaded by FTP, not by GAL) =>
949
keeping the edit in post sixteen in place.this edit is still active

If i try to upload an file, i get this errormessage => 1. Cannot open server path for images.

The "1"-directory was created by gal ->
950
with the correct "777"-settings =>
951


kr Chris

Morgan
03-24-2008, 05:41 PM
In the gal_functions_image.php file find:

if ($fput = @fopen($server_path . '/index.htm', "w"))

And temporarily replace with the following:

ini_set('display_errors', true);
error_reporting(E_ALL);
if ($fput = @fopen($server_path . '/index.htm', "w"))

Then try another upload and copy-paste here what you see on screen.

Afterwards you can undo that edit, but keep the edit in post sixteen in place.