Strange IIS (?) path problem?

Just installed zenphoto. I'm on an IIS server (I think)--its windows. In order to get the setup.php to work, I had to set mod_rewrite to false and uncomment the path lines:

define('WEBPATH', '/Images');
define('SERVERPATH', 'www.desilva.info/Images');

Zenphoto is installed in /Images.

Setup then ran, it connected to the database, and with a hack (explained below), I uploaded a jpg to a gallery. Viewing the gallery works fine, navigation from the main page to album to photo all works.

But, I keep having login issues.

On my server, there is a subfolder on my hosting account called info, which is where www.desilva.info takes you. /Images, where zenphoto is installed, is actually under /info--/info/Images. So www.desilva.info/Images/index.php is the URL for the gallery. The way the server seems to work, you can also get there with www.desilva.info/desilvainfo/info/Images/index.php--the hosting account name followed by the /info directory. Interestingly, if you go to www.desilva.info/Images/index.php, and click on the album (Memorial Bridge), it takes you to www.desilva.info/desilvainfo/info/Images/index.php?album=memorialbridge. Somewhere zP is adding in the "/desilvainfo/info." This doesn't seem consistent with having defined SERVERPATH to 'www.desilva.info/Images'

Anyway, for whatever reason, the public interface seems to work. The problem is with administration. I can go to the admin page, but if I add an image, it takes me to the login page--www.desilva.info/desilvainfo/info/Images/zen/admin.php. I then get trapped there in a login loop.

However, if I shorten the URL to www.desilva.info/Images/zen/admin.php, I continue on and it seems to perform whatever function it was trying to do.

Any ideas for having to hack /desilvainfo/info out of the URL in the browser everytime I want to edit/upload anything?

Comments

  • trisweb Administrator
    Let's take a step back and start with these:

    `define('WEBPATH', '/Images');

    define('SERVERPATH', 'www.desilva.info/Images');`

    The first one is perfect, WEBPATH should be the path after your domain, so `www.desilva.info/Images` has a WEBPATH of `/Images`, perfect.

    The second one is the filesystem path of that same directory on the server. It should be something like (on Windows) `D:\iis\htdocs\desilvainfo\info\Images` (JUST GUESSING, you have to use your FTP program or a php file with just `<?php phpinfo(); ?>` to find the real path).

    Frankly I'm surprised it's working with the SERVERPATH you gave it... did you end up re-commenting it? Give it the correct one though and see if that helps the admin problem...
  • Thanks for the tip... I redefined:

    define('SERVERPATH', 'E:\userdirs\wwwroot\desilvainfo\info\Images\');

    after running a phpinfo() call on the server. Still end up with the same issue--it allowed me to upload four new jpgs into an album, kicked me to the login screeen, and looped there. The pictures did get uploaded, however, and if I edited the /desilvainfo/info out of the URL for admin.php, I could get back to the admin screen.

    Argh. I really wish I had a better working knowledge of PHP... Any more ideas?
  • I use IIS for my site and this is how I have it set. Notice the directions of the / in server path..

    define('WEBPATH', '/zp');
    define('SERVERPATH', 'd:/website/chilifrei.net/zp/');
  • Well, I switched the "\"s to "/"s and it doesn't seem to make any difference. Still have to delete the /desilvainfo/info to get back to the admin page after making any mods...

    I really like this app and want it to work... Something must be deciding I'm not logged on or something. Is there a debug function that can be enabled to see what is being called?

    Odd bit is that it actually does the function I'm trying to do--change themes, upload pictures, etc. Its just when it tries to go back to the admin page that I get bounced to the login.
  • trisweb Administrator
    Seems like the server path was working fine for you anyway even before you changed that... must have been autodetected still, not sure how.

    The redirect looks something like:
    `header("Location: " . FULLWEBPATH . "/zen/admin.php?page=edit");`

    and FULLWEBPATH is calculated like:
    `define('FULLWEBPATH', PROTOCOL . "://" . $_SERVER['HTTP_HOST'] . WEBPATH);`

    That could be your problem. IIS might not be assigning the HTTP_HOST environment variable that you want. A simple fix for you would be to replace that... here's how:

    In `zen/functions.php`, around line 24, you'll see the above line. Change it to:

    `define('FULLWEBPATH', PROTOCOL."://www.desilva.info" . WEBPATH);`

    You're basically replacing $_SERVER['HTTP_HOST'] manually with your domain. I think that should work.

    I might need to make another override option for this, I didn't even know it could cause problems, but thanks for pointing it out :-)
  • I'll give it a whirl... Unfortunately, seems like my host is in the midst of upgrading my account, so I can't do anything. Grr.

    Thanks so much for taking the time to look at the issue... I'll follow up w/the results as soon as I can.

    BTW, I think I said it before, but great piece of work!
  • Well, part of my account "upgrade" seems to have rearranged something unanticipated... Without touching the code, it suddenly started working. I can't get there from www.desilva.info/Images until some host headers get fixed, but accessing the server directly at desilvainfo.ehost-services104.com/info/Images/index.php shows everything (including the admin parts) working fine.
Sign In or Register to comment.