Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

500 | Server Error #744

Open
bavermelkor opened this issue Mar 8, 2024 · 31 comments
Open

500 | Server Error #744

bavermelkor opened this issue Mar 8, 2024 · 31 comments

Comments

@bavermelkor
Copy link

LinkStack version

4.7.7

Description

Initially my website was opening but now doesn't open. I see this page. What is solve technic?
Adsız

Details about your system

Windows 10, browser Microsoft Edge.

How to reproduce

I don't know.

Possible Solution

No response

Additional Context

No response

@theobfuscated
Copy link

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.

@talheim-it
Copy link

@bavermelkor did you try to set it up yourself? or where did you get this error?

@aleannox
Copy link

@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!

@talheim-it
Copy link

@aleannox can you specify your setup? All services are running without errors?

And also provide config files so I can validate :)

@aleannox
Copy link

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! :)

@talheim-it
Copy link

@aleannox Services are important? Do you use a docker or apache/mod_php or nginx/php-fpm?

@aleannox
Copy link

@talheim-it I am using Apache with PHP-FPM (no docker) :)

@talheim-it
Copy link

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?

@aleannox
Copy link

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

@theobfuscated
Copy link

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/

@talheim-it
Copy link

@aleannox try it the way @theobfuscated described otherwise check your apache2 logs, if the php socket is reachable.

@aleannox
Copy link

OK thanks @theobfuscated @talheim-it I will try that!

@talheim-it
Copy link

if it still fails then we need to check your configuration for apache2 and php-fpm.

@tekert
Copy link

tekert commented Apr 20, 2024

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...

@talheim-it
Copy link

You have linkstack in a subdirectory? @tekert

@tekert
Copy link

tekert commented Apr 20, 2024

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

@talheim-it
Copy link

There are a few things:
1.) Which webserver?
2.) How is the webserver configured?
3.) What do the log files say?

@tekert
Copy link

tekert commented Apr 20, 2024

  1. 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/"
  1. Strange, webserver logs don't say anything, and the php logs either. nothing. And they work correctly.

@talheim-it
Copy link

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.

@tekert
Copy link

tekert commented Apr 20, 2024

Sorry, root /var/www/*user*/html/*domain*;

edit:
and linkstack is in /var/www/*user*/html/*domain*/linkstack

@talheim-it
Copy link

@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.

@tekert
Copy link

tekert commented Apr 20, 2024

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?

@talheim-it
Copy link

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?

@theobfuscated
Copy link

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.

@talheim-it
Copy link

talheim-it commented Apr 20, 2024

@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.

@tekert
Copy link

tekert commented Apr 20, 2024

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..

@talheim-it
Copy link

@tekert, I am gonna try it locally and let you know.

@tekert
Copy link

tekert commented Apr 20, 2024

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.

@tekert
Copy link

tekert commented Apr 20, 2024

Yep, works from subdomain or root dir. seems something is hardcoded in the code.

@talheim-it
Copy link

talheim-it commented Apr 20, 2024

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.

@JulianPrieber
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants