Problem running Gallery under LiteSpeed

Discussion in 'PHP' started by kchrist, Sep 1, 2006.

  1. kchrist

    kchrist New Member

    I'm trying to get the Gallery photo gallery (PHP/MySQL) working under LiteSpeed. This same installation works fine when running under Apache, but throws an error when trying to view it via LiteSpeed (which is running simultaneously on a different port).

    Apache is running as the user 'www-data', while LiteSpeed is running as 'nobody', but the Gallery data directory and all subdirectories are world-writable. This gallery also works fine under lighttpd. I suspect the problem is with PHP, as LiteSpeed is using it's own PHP module (via lsapi) while Apache and lighttpd are using the system's PHP5 installation. LiteSpeed is running PHP (4) fine otherwise.

    Because this is likely a Gallery problem rather than a LiteSpeed problem, I've posted more details in the Gallery support forums. I'm mainly wondering if anyone here has any tips or info regarding the Gallery/LiteSpeed combo.
  2. mistwang

    mistwang LiteSpeed Staff

    Compile your own lsphp binary using PHP5 might be the fix to your problem.
  3. xing

    xing LiteSpeed Staff

    Depending on what the exact "error message" that php threw at you, we can help you pin-point the problem down.

    The best way is ensure that your PHP is up to date is as George suggested: compile your own latest and great PHP5 for litespeed. Use our step by setup wiki how-to:

    http://www.litespeedtech.com/support/wiki/
  4. kchrist

    kchrist New Member

    Ok, I've got a bit of an update. I enabled error logging in the LS php.ini (it was already enabled, but not writing to the web server log, so I had to explicitly specifiy a log file). Once I did, I was able to find the PHP error that Gallery wasn't displaying. It seems the orignal error was caused by the LS PHP module looking in the wrong place for mysql.sock. I corrected that in /opt/lsws/conf/php.ini and am now getting a different Gallery error. Unfortunately, unlike the first one, this one isn't being logged. I've updated the post in the Gallery support forum and am still waiting for any feedback over there.

    I think you'll understand when I say that I'd rather avoid compiling a new version of PHP for a single application. I may have to do so eventually in order to get PHP5, but I may just stick with PHP5 via FastCGI (once I have time to figure out how to get that working).

    Thanks.
  5. gboudreau

    gboudreau Member

    If you use the URL rewrite module for Gallery 2, here's what you'll need to do to be able to use Litespeed httpd.

    Edit /.htaccess

    Invert those those lines:

    Code:
    RewriteCond %{THE_REQUEST} \ /d/([0-9]+)-([0-9]+)/([^\/\?]+)(\?.|\ .)
    RewriteCond %{REQUEST_FILENAME} !/main\.php$
    to get

    Code:
    RewriteCond %{REQUEST_FILENAME} !/main\.php$
    RewriteCond %{THE_REQUEST} \ /d/([0-9]+)-([0-9]+)/([^\/\?]+)(\?.|\ .)
    And also invert those lines:

    Code:
    RewriteCond %{THE_REQUEST} \ /v/([^?]+)(\?.|\ .)
    RewriteCond %{REQUEST_FILENAME} !/main\.php$
    to get

    Code:
    RewriteCond %{REQUEST_FILENAME} !/main\.php$
    RewriteCond %{THE_REQUEST} \ /v/([^?]+)(\?.|\ .)
    Also edit modules/rewrite/templates/Htaccess.tpl

    Change:

    Code:
    RewriteCond %{ldelim}THE_REQUEST{rdelim} \ {$Htaccess.rewriteBase}{$rule.pattern}(\?.|\ .)
    RewriteCond %{ldelim}REQUEST_FILENAME{rdelim} !{$Htaccess.matchBaseFile}$
    
    into:

    Code:
    RewriteCond %{ldelim}REQUEST_FILENAME{rdelim} !{$Htaccess.matchBaseFile}$
    RewriteCond %{ldelim}THE_REQUEST{rdelim} \ {$Htaccess.rewriteBase}{$rule.pattern}(\?.|\ .)

Share This Page