500 | Server Error
bavermelkor opened this issue · 31 comments
I have this issue also on a new instance. My existing instance works fine, but the new instance at https://linkstack.cc/ gives me server error 500. I have tried multiple prior versions, including the version that worked previously. I am confused, because the webserver is the same as the one that works, just a different domain.
@bavermelkor did you try to set it up yourself? or where did you get this error?
@talheim-it
I have the same error on a fresh install that I set up on my own Ubuntu 2020 server w/ PHP 8.1. Unfortunately nothing in the error logs. Thanks!
@aleannox can you specify your setup? All services are running without errors?
And also provide config files so I can validate :)
Thanks a lot @talheim-it for the quick response. Other websites on the server are running correctly. I have inspected the index.php and installed all $required_extensions. Which config files would you like to have? Thanks! :)
@aleannox Services are important? Do you use a docker or apache/mod_php or nginx/php-fpm?
@talheim-it I am using Apache with PHP-FPM (no docker) :)
Can you provide the configuration of apache and php-fpm?
I use php with version 8.2:
root@web05:~# php -m
[PHP Modules]
apcu
bcmath
calendar
Core
ctype
curl
date
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
hash
iconv
intl
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
random
readline
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache
Do you enabled error logging in php-fpm.log? Do you separated it for the vhost?
Thanks again @talheim-it! I have a separate error log file for the vhost and logging of all errors is enabled
php_admin_value[display_errors] = On
php_admin_value[error_reporting] = E_ALL
php_admin_value[log_errors] = On
php_admin_value[error_log] = /path/to/php-fpm.log
Also the output of php -m is
[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
hash
iconv
intl
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
pspell
readline
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache
I was able to resolve this issue by unzipping the files to a linkstack/ directory inside my webroot directory. I was able to load the configuration page there. Then, I moved the linkstack directory outside of my webroot directory, deleted my webroot directory, and renamed the linkstack directory to my webroot directory name. Now it works. https://linkstack.cc/
@aleannox try it the way @theobfuscated described otherwise check your apache2 logs, if the php socket is reachable.
OK thanks @theobfuscated @talheim-it I will try that!
if it still fails then we need to check your configuration for apache2 and php-fpm.
Same problem, using php-fpm, unziped contents of linkstack inside domain.com/link
dir, 500 error, if i unzip inside domain.com/linkstack
it works...
You have linkstack in a subdirectory? @tekert
yes
but now i have more errors, if i try to change the language in the first screen I get 404 errors.
example: it jumps to https://domain/linkstack/editConfigInstaller 404
There are a few things:
1.) Which webserver?
2.) How is the webserver configured?
3.) What do the log files say?
- Debian 12, Nginx, php8.3-fpm
nginx site file
server {
... ports, ssl, logs config, etc ..
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ [^/]\.php(/|$)
{
fastcgi_buffers 32 4k;
fastcgi_busy_buffers_size 16k;
fastcgi_index index.php;
fastcgi_pass unix:/run/php/php8-usertest-usersocket.sock;
}
}
php-fpm pool file:
user = *standard_user*
group = *user_group*
listen = /run/php/php8-fpm-usertest-usersocket.sock
listen.owner = *user*
listen.group = *group*
listen.mode = 0660
php_admin_value[disable_functions] = exec,passthru,shell_exec,system,proc_open,popen,curl_multi_exec,parse_ini_file,show_source
php_admin_flag[allow_url_fopen] = off
pm = ondemand
pm.process_idle_timeout = 10s;
pm.max_children = 15
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 1000
php_admin_value[open_basedir] = "/var/www/*user*/html/:/var/www/*user*/.tmp/"
php_admin_value[upload_tmp_dir] = "/var/www/*user*/.tmp/"
- Strange, webserver logs don't say anything, and the php logs either. nothing. And they work correctly.
Okay, what I miss in the server config is the document root or for nginx the root directory for the vhost.
I only see the location / specified but the location is a path inside the root.
Sorry, root /var/www/*user*/html/*domain*;
edit:
and linkstack is in /var/www/*user*/html/*domain*/linkstack
@tekert I understand it the way that linkstack is in the domain.tld/linstack.
So it is part of a domain you are already using?
If you want to achive it via a subdomain you need to add additional locations to your nginx config and how they shall be handled.
location /linkstack/ {
try_files $uri $uri/ /index.php$is_args$args;
}
Your nginx config needs to know how to handle this location.
Uhm, i tried everything i can but visiting https://domain.tld/linkstack and changing a languague or advancing results in a redirection to https://domain.tld/linkstack/editConfigInstaller File Not found or 404 depending on fast_cgi config. Every other php site works.
Do you mean linkstack only works via subdomain?
I have it directly running on a subdomain.domain.tld on my own instance.
The question is why it should be in a subdirectory?
Additionally I don't know if you changed your config as I wrote above?
It does not need to be on a subdomain, and it should not need to be in a subdirectory. I was only mentioning the workaround that I used to get it up and running at https://linkstack.cc
I was also getting the generic error 500 when installing to the web root directory, but it worked in a subdirectory called linkstack. I then moved the subdirectory out of the web root directory, deleted the web root directory, and renamed the linkstack directory with the name of my web root directory. Then it worked.
Directory and file permissions were already correct (755), as far as I could tell, so I don't know why this was necessary, but it worked for me.
@theobfuscated maybe in the installation script there is something hardcoded. I didn't check it yet but sounds logical that something like this is set.
The main issue I see in the comments above is that software like OS, Webserver (Apache, NGINX, Caddy, etc.) and PHP Version are missing. Without that informations and including the configurations it is pretty hard to say what cause the error 500. Error 500 is pretty generic and is a server error. Without server informations noone can help to debug this. Like searching for the needle in a haystack.
The problem is that i have no errors, nothing, no logs, it's like you say, i don't know here to start, the config files for this server are around 500 lines in total counting scripts, i can't easily share eveything, to add this a production server, but php is not used so i can change php config but be careful of other settings, and with no logs or doc watsoever, uhm..
@tekert, I am gonna try it locally and let you know.
Thanks, I'm creating a subdomain, have to wait for DNS propagation, and test with subdomains what happens. Looked at the code but php is not my thing, long time.
Yep, works from subdomain or root dir. seems something is hardcoded in the code.
As far as I can see the issue has something to do with the routing => routes/web.php
When you try to run linkstack in a subdirectory the paths are not working correctly.
In nginx:
location /linkstack {
try_files $uri $uri/ /index.php?$query_string;
index index.php;
}
When I set the subdirectory I see in the post request (when choosing the db sqlite3 or mysql):
POST https://node-1.talheim-it.ua/linkstack/linkstack/db
So it duplicates the the path.
@JulianPrieber maybe you can tell it better since I am not into php and don't know how much work it can be to make it possible to run in a subdirectory.
If you encounter a generic error 500 issue, make sure to check for missing files and correct file permissions.
Unless you turned off debugging in your config, the error page should display an error description.
This however does not happen if the index.php is not initialized correctly or Laravel could not complete the boot-up-call.
As far as I can see the issue has something to do with the routing => routes/web.php
This file gets initialized after index.php. In most cases this means if this file causes any errors, it would display on screen or in storage/logs/laravel.log
.