Hey everyone,
My host has activated PDO for PHP and I'm using zenphoto as a plugin.
The top of my home page reads:
<?php
define('SERVERPATH',str_replace('\\','/',dirname(__FILE__)).'/gallery');
define('WEBPATH','/gallery');
require_once(SERVERPATH.'/zp-core/template-functions.php'); ?>
Which always used to work until the php.ini was changed.
Now, it brings up a 404 but more importantly has this in the URL:
domain.com/zp-core/setup/index.php?autorun=gallery
So it's ignoring the /gallery define.
The gallery itself is working fine. I've tried running setup a few times and refreshing the database, but I can't seem to work out why my home page is getting a 404 and trying to run setup.
Any ideas?
Comments
I have to admit I never used the "zenphoto as the plugin" myself…
To override these defines you must place the new definitions into the configuration file. Of course you need to be sure that they evaluate to the correct paths.
http://www.zenphoto.org/news/integration-with-existing-sites-and-other-cms#zenphoto-as-a-plugin
The mechanism does still work. Best guess is that you have a .htaccess file that is redirecting your link. The zenphoto .htaccess file should be in the "gallery" folder.
Also possible is that something on your server has changed so that the define you used does not match what zenphoto computes. Check your overview page to see what zenphoto thinks the WEBPATH and SERVERPATH are.
Also, please be more specific on the URL used and how it was created. The zenphoto as a plugin typically fetches content directly so no no links would be involved.
The code in my first post is just after the doctype and before the html tag.
My overview page says:
Server path: /home/xxxyyy/public_html/gallery
WEB path: /gallery
Here's what's on my htaccess within the gallery folder:
http://pastebin.com/EdNjPAjz
In regards to where I'm trying to display the albums, they're located at:
public_html/index.php
public_html/collection.php
with zenphoto at:
public_html/gallery/
It was working fine before this PDO thing, so I'm very confident my PHP code with the WEBPATH and SERVERPATH correct. Both htaccess files (in my root and zenphoto folder) look to be the same as they were.
Host says it's a PHP error, so they're not helping me anymore.
Also I did not get an answer to what this Link that is getting a 404 error is. For instance, testalbum-2.sbillard.org is an example of this plugin technique. You will see there an image from the gallery. There was no Linking involved in this, just PHP code to display the image.
So if you are receiving a 404 error you must be following a link and we need to know what the link is and how it was created.
Just by the way, your gallery folder .htaccess file is a little strange. All the rules for searches should not be present. They certainly may make your site mis-function, though.
When your host says PHP error, are there error logs to back that up? Perhaps also clarify what PDO for PHP is. We are assuming that it is "PHP Data Objects" which is a database access tool. Maybe it is something else?
Here's my htaccess for where my home page resides:
http://pastebin.com/x9wbkrZz
For example, if I go to the home page: http://domain.com/index.php (where the code is), that is bringing up the domain.com/zp-core/setup/index.php?autorun=gallery url. Well, not right this second because I've removed the code so the website functions.
Here's how I'm running the plugin within index.php:
http://pastebin.com/xEKbMySB
(I asekd you to make this for me, so it hasn't changed).
Well, my post said it was a PHP related issue, not so much an error, and just that they couldn't help me with coding. As soon as I showed them the code in the head and how it wasn't corresponding with the SERVERPATH they said it wasn't there issue. However, as soon as they changed this PDO thing , it hasn't worked.
When they installed it, they said:
"It looks like the PDO PHP module is not installed on your server. I'm currently in the process of installing this for you and will update you once it's complete."
Also, I visit your site and do not get a 404 error. So again, what is the link giving the 404 and how is it generated?
`adv1wheels.com/zp-core/setup/index.php?autorun=gallery`
means the Zenphoto install is in the root, but the link of the main navigation to the media gallery says it is within `/gallery`. Where is it actually?
Again, PDO is a PHP extension to communicate with databases. Zenphoto supports that and the recommended MySQLi and the now deprecated MySQL extensions.
sbillard, I'm not really sure what you're asking from me. I renamed index.php to index-404.php just to show you the result of what's happening. index-404 and index are identical besides the fact that I've taken off the zenphoto functionality to allow the website to run.
As I mentioned previously, the gallery itself is running fine. The functionality of displaying zenphoto outside the gallery (ie on my home page) is not.
Or maybe more simply, just copy what the overview page says to the definitions.
I have isolated the code:
https://pastee.org/pnhcf
And it's the code thing I have on:
adv1 wheels.com/test.php (broken link so I don't get locked out).
It just redirects to the setup.
My overview states:
Server path: /home/advo newh/public_html/gallery (again, broken so I don't get locked out).
I actually have no idea where I can go to from here.
NOTE: This only doesnt work for any folder up from /gallery. If, say, I have this page: http://adv1 wheels.com/technical/titanium.php (broken), it works perfectly fine. If it's in the root of public_html, it's a no go!
Those were of course no Windows servers and we generally don't test on such. So it might still be the server configuration. I am not sure if that is how it should be. If I type in wheels.com it takes sevearl seconds until the page is redirected to wheels.com/PUBLIC/default.aspx. I guess that should not be that way either?
I got my host to disable PDO to see if it fixes the problem, which it does. I can now see the photos on the home page with PDO disabled.
However I have another database on the website which needs PDO enabled.
I've tried running setup, whilst PDO is enabled, multiple times but that hasn't fixed the problem.
Besides PDO is the recommended MySQL interface. You should not and not need to disable that. Alternatively you could try mysqli.
Thanks zenphotoers for your help!