The simpler media website CMS
ZenPhoto rocks. I have a gallery for my church's website with albums going back to 2008! Everything was merry until my host told me I had to update the version of PHP my site was running under. I first updated ZenPhoto to 1.6 by replacing index.php, /themes, and /zp-core. I didn't overwrite old with new, I moved old to a backup directory first. All seemed to work. THEN I updated PHP to 8.1 and now I get a white screen and the only clue is a ":status: 500" when I try to view the gallery or log in to administer or perform set up. Where should I start? Should I delete the contents of /cache? Should I upload ALL the ZenPhoto 1.6 files but keep my /albums directory, and then try to do set up again? Will doing so damage the mysql database? I'm so very sorry to bother you, but searching the Forum hasn't resulted in a solution. Steve
It's really hard to tell what may cause the 500. You did run setup after uploading the new files? Is the htaccess file in place?
Also review the debuglog.
No, if you keep the albums folder the database should not be affected.
Thank you. No, I was not able to run set up. I was not able to do anything. Not even when navigating directly to "/zp-core/setup.php"
Yes, index.php is in place with permissions 664: rw-rw-r--
.htaccess has permissions 644: rw-r--r--
Because I changed the name of the zenphoto directory to "photogallery" I uncommented line 89 of the config file and changed it to read "define('WEBPATH', '/photogallery');" but then I saw this in debug:
So I re-commented line 89.
No point in trashing cache manually via FTP?
I will attempt to replace ALL the files and directories except for /albums with fresh versions. Would it be advisable to manually edit the config file with the mysql credentials before uploading?
Thank you again so much for your time and interest.
So Zenphoto is in that subfolder and is called via
http://yourdomain.com/photogallery/? Then your
.htaccessfile has probably still the old folder name as the rewrite base and therefore cannot rewrite.
Running setup does normally fix that but if you manually set the webpath it cannot run because of not matching.
You can enter them via setup once when there is not a config file yet (e.g. what we assume a "fresh install") but afterwards you have to edit the config file. You can enter the credentials right beforehand as well.
If your Zenphoto install is in a subfolder but a domain points directly to that folder the htaccess files no rewritebase. Because the folder is then the root of the domain.
Nuts. I am SO sorry to be a pain.
I put everything but /albums in a backup directory.
I uploaded everything except albums from the 1.6 download.
I ran admin.php and was elated to see something. I tightened the permissions on zp-data as directed, put in the database credentials, clicked the proceed button, and got a white screen.
I went through the same process again, this time selecting "relaxed" from the dropdown, and this time got a white screen displaying "An attempt at cross site reference forgery has been blocked."
In the Network tab of Chrome tools I noted
But I have no clue if that's meaningful.
In Safari's Console log I read
Again, I don't have a clue what that might suggest.
I confirmed I do actually have a database.
My hosting environment is PHP 8.1 FastCGI
What do you recommend I try next.
I have no idea about the Safari one - those are some internal scriptst and not ours. But the first one seems to indicate there might be still a permissions issue with zp-core.
I have tried 4 more times with the same results.
My host is Dreamhost
My FTP software (Mac) is Transmit (I have tried both with and without "use passive mode" checked)
I have tried disabling the .htaccess file at the site root
I upload the entire zenphoto-1.6 download to the server.
I move all the contents except /albums to a folder at the root of my site, named /photogallery.
I navigate to [my-domain.org]/photogallery/zp-core/admin.php
I see a set up page into which I put my mysql credentials (Dreamhost says to use mysql.[my-domain].org instead of localhost)
I have tried with and without setting permissions to "loose 0666"
I click "save" and get a white screen.
I fiddle randomly with changing permissions on /zp-core and /zp-data (for example, change zp-core from 755 to 744, 754) which sometimes results in "currently unable ot handle this request", sometimes "An attempt at cross site reference forgery has been blocked."
I have confirmed I have the correct database name and password.
I have tried doing this in Safari (which always worked fo rme in the past) and Chrome.
Interestingly, the /zp-data folder from the download is empty. Before even running setup it's populated with files. AFTER setup the above process DOES populate the config file in /zp-data with all the credentials. I just can't get beyond the initial setup page.
I tried manually editing the config file to set the server protocol to https, and uncommenting and editing Path Overrides to define('WEBPATH', '/photogallery');
I have exhausted everything I can think of, short of starting from scratch with a new database and losing years of captions.
Hm, this all sounds not normal. I use Transmit as well btw.
If you cannot get past the first setup page something must be wrong somewhere… Is there anything new in the debuglog? The one in zp-data but also please try to find the php error log of the server if any is provided by Dreamhost.
Well, zenphoto REALLY didn't like that I edited the WEBPATH in the config file:
So I re-commented that line, refreshed the page, and got no new entry in debug.log, but the familiar "An attempt at cross site reference forgery has been blocked." warning appeared.
I confess it took me a while to locate the server log files but when I did finally get to error.log it also complained about the WEBPATH but then at the end I saw this (domain name edited just to be safe):
So wow - if I'm reading this right, my shared hosting plan no longer offers sufficient memory to run zenphoto??? It worked perfectly for years before updating to PHP 8.1 this week.
Do you suppose memory could be the issue? If I'm allowed to manually allocate more memory, what's recommended?
Thank you so much for your patience and help.
The WEBPATH issue is actually indeed a bug. The constant is already defined before the config file is loaded. I will look into that.
But as mentioned you generally don't need to define that. I at least never had any occasion that was needed.
I really don't thinks so. We have certainly not changed memory requirements. The error is from a general query function so it sadly could be anything…
I have not seen this or had any of these troubles updating older ZP installs to 1.6 and all were fairly standard shared hosting (even our own site's host is).
Also, not directly related: Are you using a custom theme or any other third party plugins? Just in case anything interferes?
The config/webpath/serverpath issue is fixed in 1.6.1a on GitHub at least. But I don't think this the issue.
What does the parent site use? A common issue if one CMS is installed within the folder of another is a conflict with a parent htaccess for example. But if that was never a problem I don't see why it should now…
(I did remove one domain instance in one of your earlier posts above)
The parent site is currently hand-coded html and css and VERY basic PHP (mostly to include common elements like navigation). I am absolutely NOT a sophisticated PHP developer.
I'm hoping to redeploy it at the end of this month with Wordpress but I'm going to create a separate database for Wordpress to hopefully compartmentalize WP and zenphoto. When that happens I am hoping to put the zenphoto directory in the root of the site but thanks for the warning.
I'm a simple user, acrylian might confirm if my idea is good or not :
My idea : starting from scratch
1 use phpmyadmin to save your existing database.
2 create a new database using phpmyadmin
3 do a fresh 1.6 installation in a NEW subfolder using filezilla to download files, and your new database in the admin config page
4 check everything is working
5 move your albums folder from photogallery inside your NEW subfolder
6 check everything is ok, save your new database with phpmyadmin
7 restore your old database (step 1) in your new database with phpmyadmin
8 check everything is ok
9 save again your database with phpmyadmin AND with the zenphoto admin page.
10 backup your working theme, time to copy your old theme inside your NEW themes folder and check if it works or not.
A start from scratch "should" not be necessary actually…
But creating a fresh test install on the same server could be an idea to find out if it something in general or just the update of the old install.
Thank you for your suggestions, ctdlg. If you are a "simple user" you are certainly several levels beyond me! I'm not very sophisticated with manipulating mysql databases, especially not restoring a legacy database into a new one! But I know how to Google, so I'll take the risk.
acrylian: By "fresh install" you mean also with a new, empty database? Because in the process of figuring this out I HAVE freshly installed ALL of the 1.6 files except for the /albums folder because, you know, I don't want to overwrite years of images! If so, I'm up for the undertaking just to see what happens. And you don't think the memory limit fatal error is something to worry about at this stage?
Thank you both very much.
I mean a 2nd install without any images in another subfolder, just like ctdlg suggested. Yes. best with a fresh database. Just without any database restoring and an empty albums folder for now.
Just to see if that works or also fails. If not it is something with the upgrade. If it also fails we have some more general problems possibly…
So for this the current install is not involved so it is not harmed.
I think you didn't mention the Zenphoto version you upgraded from?
Right. My guilty secret. I honestly didn't pay attention when I upgraded zenphoto prior to upgrading the PHP version. But it had not been updated in some time 'cause, you know, it was working fine. And I did confirm that it worked prior to the PHP update but I suppose it could have been a big enough change that something didn't go well with the database tables. I'm about to create a new database and clean install of zenphoto 1.6. I'll report back on the results.
So good news - a fresh install, in a folder in the site root named zenphoto, and a brand new, fresh database worked. It did not appear to have generated an .htaccess file and somewhere it said "mod_rewrite is not enabled. The plugin works best if mod_rewrite is active and the htaccess file exists" but I checked the mod_rewrite option in the options tab so I hope that's cool. I did transfer one album from the original and the images show. Now I have to figure out what I did to customize the theme because that's been lost but I'll get there. Now it sure would be nice if I could retrieve all the captions from the legacy gallery but I'm reluctant to just replace the new database with content from the old because I don't want to restore whatever hiccup gave me all the problems up to now.
So now I'll take a breather and come back later to make it look like I'd like it to look.
Thank you both so much for your help. I still have a ways to go to get it back to where it was but this is the most encouraging development so far this week!
You should really upgrade regulary for bugfixes and especially securitty fixes. Also doing this reguliary causes less work because of changes at the time.
Sadly there is no really reliable way to check for htaccess and ours requires the cURL library. So the report may be wrong and it is working actually. If you enable the modrewrite options you need to make sure the .htaccess file is there. Within zp-core/file-templates there is the template file. Rename it and best re-run setup.
So if the fresh install works, please check for differences with the older install. Especailly any third party plugins within /plugins or outdated third party themes in /themes. If your theme was customized, remove it for now and use a standard theme. Just in case these interfere which may be the cause if you didn't upgrade for some time.
I did it!
Just to wrap this up so no one is left wondering…
After creating the brand new database and zp install, and testing with one album, I summoned my courage and copied the zp-albums and zp-images tables from the old database into the new one. Then I copied all the albums and images into the new zenphoto directory and so far as I can tell I have all the legacy captions.
What a super relief. Thanks again for your patient help throughout this time of frustration and uncertainty.
And of course, thank you for zenphoto in the first place!
Great, thanks for the follow up.
Just to note: The correct order is always folders first, then database as documented here: https://www.zenphoto.org/news/moving-and-changing-existing-installations/
If you had any kind of visitor in the meantime, Zenphoto would check the filesystem with the database and updated db after the filesystem, not the other way round.
For those albums/images requested by that visitor, so not for all at the same time, as the discovery happens "on request".
Right. My earlier post was misleading. I did move the images and folders into place before tinkering with the database. Dumb luck I guess!