Hi,
Just installed version 1.0.6 for first time. Thought I followed all the installation instructions but now I receive an error message when trying to create an album and upload photos:
--
Warning: mkdir(/usr/home/czcweb/public_html/zenphoto/albums/yes) [function.mkdir]: Permission denied in /usr/home/czcweb/public_html/zenphoto/zen/admin.php on line 105
Warning: move_uploaded_file(/usr/home/czcweb/public_html/zenphoto/albums/yes/ss_lettr.png) [function.move-uploaded-file]: failed to open stream: No such file or directory in /usr/home/czcweb/public_html/zenphoto/zen/admin.php on line 117
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/var/tmp/phpOCWura' to '/usr/home/czcweb/public_html/zenphoto/albums/yes/ss_lettr.png' in /usr/home/czcweb/public_html/zenphoto/zen/admin.php on line 117
MySQL Query ( INSERT INTO (title) VALUES ('YES'); ) Failed. Error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(title) VALUES ('YES')' at line 1
--
It appears this may have something to do with changing the permissions, or perhaps a database compatibility issue. Any help please?
Thanks for your response. I thought I did that already. Here's the related code from my admin.php. I'm an amateur with backend, so maybe I made a mistake:
/ UPLOAD IMAGES */
/***/
} else if ($action == "upload") {
// Check for files.
$files_empty = true;
if (isset($_FILES['files']))
foreach($_FILES['files']['name'] as $name) { if (!empty($name)) $files_empty = false; }
// Make sure the folder exists. If not, create it.
if (isset($_POST['processed'])
&& !empty($_POST['folder'])
&& !$files_empty) {
$folder = strip($_POST['folder']);
$uploaddir = SERVERPATH . '/albums/'. $folder;
if (!is_dir($uploaddir)) {
mkdir ($uploaddir,777);
}
@chmod($uploaddir,777);
$error = false;
foreach ($_FILES['files']['error'] as $key => $error) {
if ($_FILES['files']['name'][$key] == "") continue;
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES['files']['tmp_name'][$key];
$name = $_FILES['files']['name'][$key];
if (is_image($name)) {
$uploadfile = $uploaddir . '/' . $name;
move_uploaded_file($tmp_name, $uploadfile);
@chmod($uploadfile,777);
} else if (is_zip($name)) {
unzip($tmp_name, $uploaddir);
}
}
}
$album = new Album($gallery, $folder);
$title = strip($_POST['albumtitle']);
if (!empty($title)) {
$album->setTitle($title);
$album->save();
}
header("Location: " . FULLWEBPATH . "/zen/admin.php?page=edit&album=$folder");
exit();
} else {
// Handle the error and return to the upload page.
$page = "upload";
$error = true;
if ($files_empty) {
$errormsg = "You must upload at least one file.";
} else if (empty($_POST['albumtitle'])) {
$errormsg = "You must enter a title for your new album.";
} else if (empty($_POST['folder'])) {
$errormsg = "You must enter a folder name for your new album.";
} else if (empty($_POST['processed'])) {
$errormsg = "You've most likely exceeded the upload limits. Try uploading fewer files at a time, or use a ZIP file.";
} else {
$errormsg = "There was an error submitting the form. Please try again. If this keeps happening, check your "
. "server and PHP configuration (make sure file uploads are enabled, and upload_max_filesize is set high enough). "
. "If you think this is a bug, file a bug report. Thanks!";
}
}
@jayray999
I'm on Dreamhost, and 777 has always worked for me just fine. Never had to chmod 755.
The 755 fix did not work. In the meantime I've contacted my host to help troubleshoot the problem. However, I've also discovered some disfunctionality elswhere with my zenphoto. When trying to automatically switch themes through the options tab in admin, nothing happens. The page reloads and the current theme (default) remains. Might these two issues be related?
Wow, I did not know that. Here is the Dreamhost Wiki aboout Zenphoto for example...
@thinkdreams
You may be right. I always used 755 since I thought 777 would not work on Dreamhost. After your posting I just tried 777 on a subfolder of /albums and it does work as well. So I guess it is an urban myth as far as Zenphoto is concerned. I suppose this (755 instead of 777) is only required for folders containing PERL scripts on Dreamhost. I vaguely remember this issue was also important with a phpBB install I once did.
Anyway I will stick with 755 since it is an added layer of protection.
I'm having exactly the same problem...
I have tried changing permissions but this isn't doing anything...
I also manage the webserver and I know for sure suexec isn't running, etc.
Any ideas? - I need this working within the next few hours or I'll find another application.
Cheers,
Liam