dreamfactorysoftware / dreamfactory

DreamFactory API Management Platform
https://www.dreamfactory.com
Apache License 2.0
1.55k stars 314 forks source link

Error 500 after fresh install by script on Ubuntu server 22.04LTS #513

Open Pammetje opened 9 months ago

Pammetje commented 9 months ago

The script installed with no errors or warnings (I chose option '0' install) After install when I connected to port 80 I get error 500

NGinx error output ->

[error] 663#663: *3 FastCGI sent in stderr: "PHP message: PHP Warning: require(/opt/dreamfactory/public/../vendor/autoload.php): Failed to open stream: No such file or directory in /opt/dreamfactory/public/index.php on line 24PHP message: PHP Fatal error: Uncaught Error: Failed opening required '/opt/dreamfactory/public/../vendor/autoload.php' (include_path='.:/usr/share/php') in /opt/dreamfactory/public/index.php:24 Stack trace:

0 {main}

thrown in /opt/dreamfactory/public/index.php on line 24" while reading response header from upstream, client: x.x.x.x, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "x.x.x.x" m: No such file or directory in /opt/dreamfactory/public/index.

nicdavidson commented 9 months ago

Thanks for sending over the nginx error. This looks like something went wrong specifically in the UI installation/deployment of the installation.

Quickest/easiest thing to try here is just rerunning the installer with the "Run df frontend install" (option 8)

If that doesn't resolve, can you post the contents of your /opt/dreamfactory/public/ directory?

Additionally, there was a brief period of time recently where the installer was bugged, make sure you have the latest version of the repo/installer.

OldaHorak commented 9 months ago

Composer issue. Hot Fix - run sudo composer update inside /opt/dreamfactory - it recreates composer modules. Then, you must setup user and group manually or simply do it running the dfsetup.run again with option 7 to enforce setting (debug mode never skip the setting of permissions of existing folders at the end of installation).

Pammetje commented 9 months ago

@OldaHorak I followed your instuction. I did a sudo composer update in /opt/dreamfactory, followed by running dfsetup with option 7. After that I rebooted the OS. I still get a error 500

Pammetje commented 9 months ago

Additional info: This is in the NGINX error log:

2024/01/08 13:04:41 [error] 6677#6677: *7 FastCGI sent in stderr: "PHP message: PHP Warning: require(/opt/dreamfactory/public/../vendor/autoload.php): Fail ed to open stream: No such file or directory in /opt/dreamfactory/public/index.php on line 24PHP message: PHP Fatal error: Uncaught Error: Failed opening r equired '/opt/dreamfactory/public/../vendor/autoload.php' (include_path='.:/usr/share/php') in /opt/dreamfactory/public/index.php:24 Stack trace:

0 {main}

thrown in /opt/dreamfactory/public/index.php on line 24" while reading response header from upstream, client: SOURCEIP, server: , request: "GET / HT TP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "SERVERIP" l

Pammetje commented 9 months ago

Updating dependencies Your requirements could not be resolved to an installable set of packages.

Problem 1

OldaHorak commented 9 months ago

@OldaHorak I followed your instuction. I did a sudo composer update in /opt/dreamfactory, followed by running dfsetup with option 7. After that I rebooted the OS. I still get a error 500

Please, check the user, group and permissions of the file(s), that can not be open to read as the error message says. The user, group and permissions can be set manually, if the option 7 does not set it. Next, some dependecies could be changed in actual vendor tree, that leads to error - I tried to install DF two weeks ago.

nicdavidson commented 9 months ago

Additional info: This is in the NGINX error log:

2024/01/08 13:04:41 [error] 6677#6677: *7 FastCGI sent in stderr: "PHP message: PHP Warning: require(/opt/dreamfactory/public/../vendor/autoload.php): Fail ed to open stream: No such file or directory in /opt/dreamfactory/public/index.php on line 24PHP message: PHP Fatal error: Uncaught Error: Failed opening r equired '/opt/dreamfactory/public/../vendor/autoload.php' (include_path='.:/usr/share/php') in /opt/dreamfactory/public/index.php:24 Stack trace: #0 {main} thrown in /opt/dreamfactory/public/index.php on line 24" while reading response header from upstream, client: SOURCEIP, server: , request: "GET / HT TP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "SERVERIP" l

In addition to the permissions checks mentioned above, would also suggest going into your /opt/dreamfactory/ dir and running:

composer install --no-dev --ignore-platform-reqs --verbose php artisan df:env (and then following the prompts for localhost, 3306, database name, database user... php artisan df:setup (And then setting up the first admin user, which is what you'll use to login to the UI)

Don't forget to fix permissions:

sudo chown -R dreamfactory:dreamfactory storage/ boostrap/cache/ sudo chmod -R 2775 storage/ bootstrap/cache/

If you're still seeing an issue, does it work when you use the php dev server? Run:

php artisan serve

Then try to access on 127.0.0.1:8000

Pammetje commented 9 months ago

@nicdavidson

That helped a lot, i can see the webinterface and the login screen, but it is not working yet The issue I now have is that I cannot login with the provided credentials

This is in the nginx error log:

2024/01/09 09:25:01 [error] 688#688: *41 FastCGI sent in stderr: "PHP message: REST Exception #401 > Invalid token: Token Signature could not be verified" while reading response header from upstream, client: CLIENTIP, server: , request: "GET /api/v2/system/environment HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "SERVERIP", referrer: "http://SERVERIP/"

nicdavidson commented 9 months ago

That is a really odd issue. I am guessing you don't have an APP_KEY in /opt/dreamfactory/.env?

cd into /opt/dreamfactory/ and run:

php artisan key:generate

that should generate the key and allow you to proceed with the login. You might need to dump your browser cache.

Pammetje commented 9 months ago

@nicdavidson

I had to add the line APP_KEY to /opt/dreamfactory/.env first (in .env was only the license entry) After that I had to run php artisan key:generate in /opt/dreamfactory/

I can now succesfully login.

Thank you very much

anywheresa commented 8 months ago

I am having similar issues, trying to install and older version 2.12.0-2. There are no errors and then the dreamfactory user takes over /opt/dreamfactory and hides or deletes it cause I cant find it. And that is the end of my installation. Cant cant access anything.