Announcement

#1 2024-04-01 18:47:44

nobody_special
Member
2022-10-28
10

Blank pages / 500 errors after losing .htaccess file

Hi All-

I was going to move all my web code to a new CM system, however botched the sync and some files got deleted- including .htaccess.   No, I don't have a complete list.

Now my piwigo setup has a totally blank main page (literally empty source if you "view source). 
Individual picture pages return:
Parse error: syntax error, unexpected '?' in /<root>/<dir>/htdocs/piwigo/piwigo/include/functions.inc.php on line 628
Gallery pages show:
<domain> is currently unable to handle this request.
HTTP ERROR 500

I've gone back into the .htaccess and added the line to select PHP versions- 7.4, 8.1, 8.2 produce the same results.

I moved the web directory aside and tried a clean manual install- it also just produces a blank page, not an installation page.

Any suggestions on how to fix this?  So far my digging through the forums haven't turned up anything I didn't try.

Piwigo 14.3, php 7.4/8.1/8.2

Thanks in advance

Offline

 

#2 2024-04-01 19:30:58

erAck
Only trying to help
2015-09-06
2038

Re: Blank pages / 500 errors after losing .htaccess file

Blank page is common after a 500 server error.

So, what does your .htaccess now contain? Also, what is inherited from a parent directory's .htaccess, if so?

However, the "Parse error: syntax error, unexpected '?' in /<root>/<dir>/htdocs/piwigo/piwigo/include/functions.inc.php on line 628" indicates that your PHP can't parse the

    $performed_by = $user['id'] ?? 0;

with its ?? Null Coalescing Operator, which is odd because that was added to PHP 7.0 already, so are you sure you're not running a very old PHP version, no matter what you do in .htaccess to select a different version (what even do you do there to accomplish that)?


Running Piwigo at https://erack.net/gallery/

Offline

 

#3 2024-04-02 02:09:45

nobody_special
Member
2022-10-28
10

Re: Blank pages / 500 errors after losing .htaccess file

I've tried various things, from nothing, to what's currently there (mostly pieces extracted from various forum threads)

------------
#Alternate default index pages
DirectoryIndex index.php

AddHandler application/x-httpd-php81 .php


------------------------------

Top level one likewise has:
------
#Alternate default index pages
DirectoryIndex index.php

AddHandler application/x-httpd-php81 .php

addType application/x-httpd-php .php


----

Thanks

Offline

 

#4 2024-04-02 18:52:41

erAck
Only trying to help
2015-09-06
2038

Re: Blank pages / 500 errors after losing .htaccess file

First, you do not want to use AddHandler that way, because the extension specified is matched against any extension of a file name, even for multiple extensions, e.g. it would match also file.php.png and you certainly don't want an arbitrary uploaded "image" file that contains PHP instead to be interpreted as a .php file. Unless you have an explicit handler for .png as well, in which case the rightmost handler is taken (which you would need to define for every possibly up-loadable extension).
See https://httpd.apache.org/docs/2.4/mod/m … addhandler and https://httpd.apache.org/docs/2.4/mod/m … ultipleext and https://www.php.net/manual/en/install.unix.apache2.php figure 8.

Also, AddType is unrelated to how the server processes files, it tells the client what MIME type an extension's content is if served as is. But the type will be used as handler-name if a handler-name is not set, so you might even confuse things by using different values for AddType and AddHandler, I'm not sure.

You may want to use something like

<FilesMatch "\.php$">
  SetHandler application/x-httpd-php
</FilesMatch>

instead, see also https://httpd.apache.org/docs/2.4/mod/c … sethandler

However, whether including a PHP version number as in x-httpd-php81 would work for you at all (I assume you read that somewhere on the internet but unrelated to your setup i.e. it sounds somewhat like cPanel) I don't know, that depends on how the web hoster set up the environment. Also make sure the correct PHP module is loaded, for example
LoadModule php_module modules/libphp8.1.so
in the Apache config (e.g. /etc/apache2/httpd.conf) is present.

You may get better specific advice at https://serverfault.com/


Running Piwigo at https://erack.net/gallery/

Offline

 

#5 2024-04-03 05:40:48

nobody_special
Member
2022-10-28
10

Re: Blank pages / 500 errors after losing .htaccess file

I was (incorrectly) thinking phpinfo was a piwigo utility.  Once I remembered it was standalone, I called it and found that the webserver was calling PHP 5.6, not 7.4/8.1/8.2 like I'd been trying to specify.

Some more digging, and putting this into the .htaccess:
------------------
#Alternate default index pages
DirectoryIndex index.php

<FilesMatch "\.php$">
SetHandler "proxy:unix:/run/php/php8.1-fpm.sock|fcgi://localhost"
</FilesMatch>
----

It gets things back working.  In my new test area, it'll install and find the database.  In my old area, it's basically working properly again.

Interestingly, I'd moved my htdocs dir to htdocs.old and tried a clean install in an htdocs.new directory, using a symlink to switch between the two directories.  If I remove the symlink and put htdocs.old back as htdocs, I get errors or it tries to do an install.  For now, I'm happy to have it back up and running.

Thanks for the hints that helped me get this sorted.

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact