Asked  7 Months ago    Answers:  5   Viewed   30 times

As a prelude, I know what a HTTP 500 is, and I know how to fix them.

On PHP 5.3, i'm running a production environment with show_errors off. When there are any fatal errors, the user gets a plain white 500 page in response. I'm trying to create a 500 error page just in case there any any errors; just so it is more user friendly.

I used to be able to do

ErrorDocument 500 500.html

It doesn't seem to be working anymore, however - even thought my 404

ErrorDocument 404 404.html

Works fine.

Curious to see solutions regarding this - Thank you for your time.



Fatal errors don't produce 500 errors in and of themselves, they would return 200 with blank page typically (if no output had been flushed to browser at the point of the error) . Plus this will not help you anyway, as Apache would be no longer involved when PHP is having the error.

Maybe you could register a shutdown function to send 500 header (to get 500 result) and display the content you want to display.

Wednesday, March 31, 2021
answered 7 Months ago
# Turn On ReWrite Engine
RewriteEngine On

# Exclude url.php and index.php from redirecting
RewriteCond %{REQUEST_URI} !^/(index|url).php

# Redirect to url.php
RewriteRule . url.php [NC,L]
Wednesday, March 31, 2021
answered 7 Months ago


Please change the version number to get more security if you have phpMyAdmin exposed to the public or need features from newer phpMyAdmin versions.

This was taken from a chat. Some things might be inaccurate, but this solved the OP's problem

Install PHPMyAdmin using the following tutorial:


apt purge phpmyadmin -y
cd /path/to/somefolder
wget && unzip && 
cd phpMyAdmin-5.1.0-rc1-all-languages
apt install pwgen -y
  1. Make note of the output of this command, I will refer to it as pw
pwgen -s 32 1
  1. Edit with favorite editor, and paste the pw in this line:
. . .
. . .
vim /etc/apache2/conf-available/phpmyadmin-custom.conf
  1. Paste the following to that previous command:
Alias /phpmyadmin /path/to/that/phpMyAdmin-5.1.0-rc1-all-languages
<Directory "/path/to/that/phpMyAdmin-5.1.0-rc1-all-languages">
Options SymLinksIfOwnerMatch
DirectoryIndex index.php
Require all granted
  1. Save the previous one using :wq, Run the following command
a2enconf phpmyadmin-custom && systemctl restart apache2 && mysql
  1. Replace your_password_here to your own password.
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password_here';
systemctl restart mysql

It should work now.

Additional notes:

To only allow you to view phpMyAdmin, try:

<Directory "/path/to/that/phpMyAdmin-5.1.0-rc1-all-languages">
Options SymLinksIfOwnerMatch
DirectoryIndex index.php
Require local
# Or change it to
# Require ip
# change to your personal computers ip address,
# not to the server ip
# if you want to access phpMyAdmin from a public server, but not allow others to access it
Friday, May 28, 2021
answered 5 Months ago

I found where my problem was. For all those who encounter the very nasty error 500, check your logs. Occured to me that once I checked the logs, I found that the method checkhashSSHA() was never being used, and this was causing the following error:

PHP Fatal error:  Call to undefined function checkHashSSA() in /xxx/xxx/xxx/xxx/UserFunctions.php on line 54

Hence I added the following code to decrypt the password:

public function getUserByEmailAndPassword($email, $password) {

    $stmt = $this->conn->prepare("SELECT * FROM users WHERE UserEmail = ?");

    $stmt->bind_param("s", $email);

    if ($stmt->execute()) {
        $user = $stmt->get_result()->fetch_assoc();
        $salt = $user['salt'];
        $userPassword = $user['UserPassword'];
        $hash = $this->checkhashSSHA($salt, $password);

        if ($userPassword == $hash) {
            return $user;
    } else {
        return NULL;

This solved my error.

Just for the record, logs for such errors are usually found in the following location: var/log/apache2/error.log You may need to make some change to the php.ini file to log these errors.

Hope this helps anyone with the 500 error ;)

Saturday, May 29, 2021
answered 5 Months ago

Please make a backup of your .htaccess file. Now remove all lines -- make it empty (there is too much noise there at the moment).

Add these lines to your empty .htaccess (should be in the root folder of your website):

RewriteEngine On
RewriteRule ^opslag/vis/(d+)$ /opslag/view.php?vis=$1 [NC,QSA,L] 

This should treat as

Please ensure that you have no more .htaccess files in opslag folder.

Saturday, July 31, 2021
answered 3 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :