Internal server error apache2 linux

Internal Error 500 Apache, but nothing in the logs?

I’m getting 500 Internal Server errors when I try to make an HTTP POST to a specific address in my app. I’ve looked into the server logs in the custom log directory specified in the virtual hosts file, but the error doesn’t show up there so debugging this has been a pain in the ass. How do I cause Apache to log Internal 500 errors into the error log?

I had same issue using PHP with virtual hosts. no errors (Apache2, Ubuntu). Ended up being missing PHP modules (mysql, json, etc.)

On ours, it was sending them to the access log (presumably because from Apache’s point of view, it was working correctly and merely passing them along, from a deeper layer — in our case, Passenger/Rails). Just putting this note here in case somebody is scratching their head.

11 Answers 11

This is an Ancient answer from 2013, back when PHP was new and security wasn’t an issue:

Here in the future it’s a security risk to dump errors to screen like this. You better not be doing this in any production setting.

Why are the 500 Internal Server Errors not being logged into your apache error logs?

The errors that cause your 500 Internal Server Error are coming from a PHP module. By default, PHP does NOT log these errors. Reason being you want web requests go as fast as physically possible and it’s a security hazard to log errors to screen where attackers can observe them.

These instructions to enable Internal Server Error Logging are for Ubuntu 12.10 with PHP 5.3.10 and Apache/2.2.22 .

Make sure PHP logging is turned on:

el@apollo:~$ locate php.ini /etc/php5/apache2/php.ini 
sudo vi /etc/php5/apache2/php.ini 
;display_startup_errors ; Default Value: Off ; Development Value: On ; Production Value: Off ;error_reporting ; Default Value: E_ALL & ~E_NOTICE ; Development Value: E_ALL | E_STRICT ; Production Value: E_ALL & ~E_DEPRECATED 
display_startup_errors = On ; Default Value: Off ; Development Value: On ; Production Value: Off error_reporting = E_ALL ; Default Value: E_ALL & ~E_NOTICE ; Development Value: E_ALL | E_STRICT ; Production Value: E_ALL & ~E_DEPRECATED 
tail -f /var/log/apache2/error.log 
[Wed Dec 11 01:00:40 2013] [error] [client 192.168.11.11] PHP Fatal error: Call to undefined function Foobar\\byob\\penguin\\alert() in /yourproject/ your_src/symfony/Controller/MessedUpController.php on line 249 

@WanLiqun It’s a pretty good piece of info but it only applies to PHP, which is not even mentioned in the question.

Читайте также:  Linux awk поиск в строке

«The errors that cause your 500 Internal Server Error are coming from a PHP module. By default, PHP does NOT log these errors.» Who mentioned PHP? Server 500 Logging being disabled in PHP is an assumption and most often a wrong assumption. Apache will log server 500 errors from a faulting module (in this case php) but most often it will go to /var/log/apache2/error.log (assuming debian or similar)

I just ran into this and it was due to a mod_authnz_ldap misconfiguration in my .htaccess file. Absolutely nothing was being logged, but I kept getting a 500 error.

If you run into this particular issue, you can change the log level of mod_authnz_ldap like so:

LogLevel warn authnz_ldap_module:debug 

That will use a log level of debug for mod_authnz_ldap but warn for everything else (https://httpd.apache.org/docs/2.4/en/mod/core.html#loglevel).

The question was, «How do I cause Apache to log Internal 500 errors into the error log?» This should probably be a comment.

This is very useful, thank you. In my case, it was mod_proxy so LogLevel warn proxy:debug helped me track down the issue.

Check your php error log which might be a separate file from your apache error log.

Find it by going to phpinfo() and check for error_log attribute. If it is not set. Set it: https://stackoverflow.com/a/12835262/445131

Maybe your post_max_size is too small for what you’re trying to post, or one of the other max memory settings is too low.

The question was, «How do I cause Apache to log Internal 500 errors into the error log?» This should probably be a comment.

If your Internal Server Error information doesn’t show up in log files, you probably need to restart the Apache service.

I’ve found that Apache 2.4 (at least on Windows platform) tends to stubbornly refuse to flush log files—instead, logged data remains in memory for quite a while. It’s a good idea from the performance point of view but it can be confusing when developing.

This was the correct answer for me on Linux. Even after deleting the original error.log (which was a character device file) and replacing it with a touch 777 error.log, Apache wouldn’t write to it until being restarted.

(╯°□°)╯︵ ┻━┻ And by restart, that means cold restart, not graceful or reload. This applies to more than php . I just fought this with a rails/passenger server.

Please Note: The original poster was not specifically asking about PHP. All the php centric answers make large assumptions not relevant to the actual question.

Читайте также:  Android ndk linux x86 64

The default error log as opposed to the scripts error logs usually has the (more) specific error. often it will be permissions denied or even an interpreter that can’t be found.

This means the fault almost always lies with your script. e.g you uploaded a perl script but didnt give it execute permissions? or perhaps it was corrupted in a linux environment if you write the script in windows and then upload it to the server without the line endings being converted you will get this error.

print "content-type: text/html\r\n\r\n"; 

There are many reasons for it. so please first check your error log and then provide some more information.

The default error log is often in /var/log/httpd/error_log or /var/log/apache2/error.log .

The reason you look at the default error logs (as indicated above) is because errors don’t always get posted into the custom error log as defined in the virtual host.

Assumes linux and not necessarily perl

Источник

Apache2 500 internal error

[client 127.0.0.1:38930] AH00027: No authentication done but request not allowed without authentication for /. AstraMode requires authentication.

Как это победить
1) Правильным способом. Как использовать эту пресловутую Astra аунтификацию. Что эт такое вообще?
2) как это выключить в «хакерском режиме»? Пологаю что нужно выключть какой то PAM модуль или в конфиге апача.

oko

New member

to clop1000
Primo, какая версия ALSE? 1.6? Судя по логу, она самая.
Secundo, в документации (Руководство администратора на ту же ALSE 1.6) есть все ответы на ваши вопросы. В частности, раздел 6.
Хотел процитировать, да раздумал, — научитесь читать оф.документацию самостоятельно.

JohnRambo

New member

2) как это выключить в «хакерском режиме»? Пологаю что нужно выключть какой то PAM модуль или в конфиге апача.

clop1000

New member

Secundo, в документации (Руководство администратора на ту же ALSE 1.6) есть все ответы на ваши вопросы. В частности, раздел 6.
Хотел процитировать, да раздумал, — научитесь читать оф.документацию самостоятельно.

clop1000

New member

А кто нибудь успешно настраивал Kerberos авторизацию?)
А то как то сложно выглядит? Есть у кого опыт?

clop1000

New member

Сюдаже что бы не плодить новую тему:

Как включить поддержку .htaccess?

mod_auth_kerb/5.4
И после чего caught SIGTERM, shutting down

JohnRambo

New member

clop1000

New member

А можете рассказать в кратце как это работает в пактическом смысле?
Это желательно только в рамках домена ALD? (Иначе придется на сервере для каждого юзера заводить аккаунт)?
Т.е. разрешения будут на каждый файл в отдельности?
А если это PHP скрипт. он же выполняется от пользователя apache2?
Работает ли apache2 в такой конфигурации в режиме целостности отличной от нуля? (т.е. когда другие сетевые службы не очень работают?)

Читайте также:  Мониторинг температуры cpu linux

А вы пробовали Postgres аунтификацию настраивать? Как она работает? Для каждой строки мандатная метка?

Источник

localhost 500 internal server error [closed]

The congregation at this server message is that it is so unspecific. Since theoretically could be just «Something is going wrong!» – When immersed in this message? Which request you have sent to the server.

1 Answer 1

The congregation at this server message is that it is so unspecific. Since theoretically could be just Something is going wrong!

    Remove the file /etc/apache2/conf-available/fqdn.conf via

sudo mv /etc/apache2/conf-available/fqdn.conf /etc/apache2/conf-available/fqdn.conf.bak 
sudo service apache2 restart 
sudo mv /etc/apache2 /etc/apache2.bak sudo apt-get purge apache2 sudo apt-get install apache2 
sudo service apache2 restart 
The apache2 configtest failed. Output of config test was: apache2: Syntax error on line 140 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/alias.load: Cannot load /usr/lib/apache2/modules/mod_alias.so into server: /usr/lib/apache2 modules/mod_alias.so: cannot open shared object file: No such file or directory Action 'configtest' failed. The Apache error log may have more information. 
sudo apt-get install --reinstall apache2-bin 
echo "ServerName localhost" | sudo tee /etc/apache2/conf-available/fqdn.conf sudo a2enconf fqdn 

Источник

500 Internal Server Error after changing AllowOverride to All in Ubuntu

My Project is working fine in Blue host shared hosting and as well in my XAMPP localhost. For testing we moved the files to a local ubuntu server. But .htaccess not working in this ubuntu server.
Which means the files accesible with .php extention but 404 error when accesed without .php extention. http://172.31.0.55/project/contact.php works, but
http://172.31.0.55/project/contact shows 404 error This is the htaccess code I use.

Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase /project/ ## hide .php extension # To externally redirect /dir/foo.php to /dir/foo RewriteCond % ^[A-Z]\s([^.]+)\.php[\s?] [NC] RewriteRule ^ %1 [R=301,L] # To internally forward /dir/foo to /dir/foo.php RewriteCond % !-d RewriteCond %/project/$1.php -f RewriteRule ^(.+?)/?$ /project/$1.php [L] Options All -Indexes RewriteCond % !^http://(www\.)?172.31.0.55/project/ [NC] RewriteCond % !^http://(www\.)?172.31.0.55/project/.*$ [NC] ErrorDocument 403 http://172.31.0.55/project/403-error ErrorDocument 404 http://172.31.0.55/project/404-error 
 Options Indexes FollowSymLinks AllowOverride none Require all granted 
 Options Indexes FollowSymLinks AllowOverride All Require all granted 

But now its showing 500 Internal server error when tried to access http://172.31.0.55/project/ Server version is Apache/2.4.18 (Ubuntu) Its a PHP Website I can see following codes in http://172.31.0.55/ Apache default page The configuration layout for an Apache2 web server installation on Ubuntu systems is as follows:

/etc/apache2/ |-- apache2.conf | `-- ports.conf |-- mods-enabled | |-- *.load | `-- *.conf |-- conf-enabled | `-- *.conf |-- sites-enabled | `-- *.conf 

Источник

Оцените статью
Adblock
detector