The simpler media website CMS
I am trying to install Zenphoto using a lamp stack that can be found here:
https://github.com/sprintcube/docker-compose-lamp
and it even runs on a raspberry which is really nice!
However when I try to install it on my server I always run into the problem that during install it cannot find the database because this is not on localhost but in another container. Therefore it always shows the page "a configuration error occurred pls try again later". When I provide the correct MySQL credentials in zenphoto.cfg.php the setup process is somehow skipped and it shows the Zenphoto License Agreement. When I click on "I agree" nothing happens. In the debug.log file there is this error message:
USER ERROR: MySQLi Error: ( SELECT value
FROM [prefix]options
WHERE name
='Theme_colors' AND ownerid
=0 AND theme
='basic' ) failed. MySQLi returned the error Table 'zenphoto..options' doesn't exist in /var/www/html/zp-core/functions-db-MySQLi.php on line 95
And indeed the table zenphoto..options does not exist because the database was not created correctly!
I am using the docker-compose lamp stack with php74 and mysql57 with only minor modifications to the .env and docker-compose.yml files (apache document root changed and ssl enabled)
Any ideas? THX in advance!
Comments
If localhost does not work you have to enter the hostname or an IP address:
https://www.php.net/manual/de/mysqli.construct.php
Besider that I have no knowledge about Docker nor do I use it. Someone had made a docker image some year ago but it does not look maintained anymore: https://www.zenphoto.org/news/docker-zenphoto/
Thx acrylian! Where in the zenphoto code do I need to make changes to account for a different database location? The mysql server can simply be accessed by entering 'database' as the database server instead of 'localhost'. This is how it works on the raspberrypi but strangely not on my main server.
Amazing! I got it resolved by inserting 'database' in the zenphoto_cfg.txt file in zp-core. The empty database must always be created first! But using PHPmyAdmin for that (part of the docker compose stack) works like a charm!
I have a full description of how to use the docker-compose lamp stack if anybody is interested
Ah, okay. Zenphoto's setup will try to create the database if it does not exists but in most case it is not allowed by the server. So technically it must be already created.
If you can place it somewhere on GitHub or something we gladly link to it, perhaps just as an individual entry like the one I mentioned above.
Jsut to add the actual config (php) file is within /zp-data after an install. The .txt file is just the template setup uses to create that file.
I understand that. But editing the zenphoto.cfg.php file didn't do the trick. instead changing the template helped to run the setup correctly
If setup cannot create the php version the best way is to copy that template to zp-daten, rename it to .php and then fill the credentials. Because if it is there setup looks there first. Didn't that work?
Files within zp-core should never be modified of course.
No it didn't work! This is what caused this thread. I put the correct credentials in the zenphoto.cfg.php file and this let to the error above in the debug.log:
'zenphoto..options' doesn't exist
The problem is the 2 dots ".." not sure where this comes from. Because of course the database does not have entries starting with 2 dots.
You have to put the correct credentials into the config file and then explicitly run setup. If setup has not been run all sorts of bad things might happen.
The setup did not even show up but in the setup.log it looked as if it had completed (after entering the correct credentials into the config file). The "agreement to license" page showed up but when clicking accept nothing happened. The show Gallery click showed a blank page.
If you have a fresh install without any config file or any database respectively without tables setup will run automatically actually.
If it is an existing install it will not, not even when teh database credentials are wrong, missing. It would be quite bad to expose that to the outside other than on fresh installs.
If you reached the licence agreement you must have passed setup. It consists on two pages you cannot miss actually. Take a look here:
https://www.zenphoto.org/screenshots/setup/setup-page1-systemcheck.jpg.html (these are not the very current version but generally the same still).
You can run setup by accessing yoursite-install-path/zp-core/setup/. On existing installs you need to be login with admin rights and may have to enable setup files again.
When ever you get a blank page review your server error log as that usual means a PHP fatal error that can be caused by numerous things.