Zenphoto as a plugin / tries to install PHP

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

  • acrylian Administrator, Developer
    PDO is an extension for database access and should not interfer here actually. No idea why this would stop to work. Any errors? Did you try to set the SERVERPATH statically?

    I have to admit I never used the "zenphoto as the plugin" myself…
  • Where exactly did you put the code mentioned?

    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.
  • acrylian Administrator, Developer
    Really, then the documentation is probably wrong for quite some time?:
    http://www.zenphoto.org/news/integration-with-existing-sites-and-other-cms#zenphoto-as-a-plugin
  • Sorry, I did not quite read the question correctly.

    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.
  • Thanks for the responses guys.

    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. :(
  • It is not the gallery folder .htaccess that is of concern. What is in the folder where your home page resides?

    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?
  • Hey sbillard,

    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."
  • The code you have will not generate any links, so cannot be the source of the 404 error. The .htaccess also will not redirect you as described.

    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?
  • acrylian Administrator, Developer
    There something wrong:
    `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.
  • Unless you actually typed that link or the link was on your homw page this is the RESULT of a link, not the answer to my question.
  • acrylian, It is actually within /gallery.

    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.
  • Something is wrong with your defines. As to what, we cannot tell. I suggest you display the results of the defines and compare with what your site overview page shows for these items.

    Or maybe more simply, just copy what the overview page says to the definitions.
  • acrylian Administrator, Developer
    @kocho: If it is in `/gallery` something is really wrong since then the setup link `domain.com/zp-core/setup/index.php?autorun=gallery` cannot work naturally. That would mean it is in the root. Maybe some htaccess conflicts. There should be no directing needed if ZP is in `/gallery`)
  • Bah, this still really bothers me. Not sure why I can't get it working.

    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!
  • acrylian Administrator, Developer
    Sorry, I really have no idea. I can only again assure that Zenphoto works fine on any "cheap" shared hosting I ever tried.

    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?
  • The website is run on a VPS.

    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.
  • acrylian Administrator, Developer
    Sorry for the trouble but I fear I cannot help. I am not a server administrator and surely I know nothing about Windows servers. Something seems not right on your server if Zenphoto runs fine out of the box on various standard shared hosts (non Windows as said but I never used a Windows server at all myself)

    Besides PDO is the recommended MySQL interface. You should not and not need to disable that. Alternatively you could try mysqli.
  • Finally worked it out. Some php.ini problem, I think. I'm not 100% sure, I got someone else to help me.

    Thanks zenphotoers for your help!
  • acrylian Administrator, Developer
    Great to hear. Thanks for the feedback.
Sign In or Register to comment.