Check /storage/logs/laravel.log
500 internal error after deploying
HIi... After deploying my laravel project on server , I get 500 server error ... Can u help me, please?
@Sinnbeck Thanks for replying... After trying to run php artisan key:generate command , I get... "Your composer dependencies require a PHP version >= 8.0.2. you are running 7.4.28". But the thing is I have already updated my php version for domain.
@battlecry11 What does php -v give you. It sounds like the change on change havent gone through. Maybe you need to restart something there.
@Sinnbeck In my index.php file I commented the whole code and wrote simply <?php phpinfo(); which says I am using 8.1.3 version of php.
@battlecry11 Yeah that is for the webserver. Be aware that the webserver and cli (commandline) can run different versions
@Sinnbeck Yes I checked and in cli it shows 7.4.28... Any fixes?
@battlecry11 Hard to say as I dont know what your host allows you to change. But perhaps that interface has a button for both web and cli when changing versions?
@Sinnbeck I am using Plesk software, my system administrator updated php version to 8.1.3 for one of our domains.
@battlecry11 So there are multiple sites on the same server? You might be able to run with a specific version
Can you post the output of the both of these
which php
which composer
@Sinnbeck Yes, of course /usr/local/bin/php /usr/local/bin/composer
@battlecry11 Can you try this then. It should run the correct version of php with composer.
/usr/local/bin/php8.0 /usr/local/bin/composer install
and if that works
/usr/local/bin/php8.0 artisan key:generate
@Sinnbeck Sorry, I did not understand. Could you please explain "/usr/local/bin/php8.0 /usr/local/bin/composer install "?
@battlecry11 Open a terminal and run that command. If you run composer install it will just run the composer program with the default php. But if you prefix it with the actual version you want to use (php8.0) it will use that instead. Same goes for artisan
@Sinnbeck It says /usr/local/bin/php8.0 : no such file or directory
@battlecry11 Ok. It was a guess as to there the binary was. try /usr/bin/php8.0
Or try asking the server people
@Sinnbeck Meanwhile I uploaded laravel8 project instead of laravel9 , which support php 7.4.28 (my cli version), now it shows laravel starting page. Could you please tell me what next steps should i make ? I am trying to run composer install but it gives me error.. (I am not able to instert url here couse it's my first day of using forum)... So , it says: Your lock file does not contain a compatible set of packages. Please run composer update. Problem 1 -psr/log is locked to version 2.0.0 and update of this package was not requested. -psr/log 2.0.0 requires php>=8.0.0 -> your php version (7.4.28) does not satisfy that requirement.
@battlecry11 I have already given you steps to run composer and artisan with a specific php version, but as I dont know the set up of the server I cannot give you the correct path. One more idea. Try which php8.0
@Sinnbeck Thank you very much.
@battlecry11 Did that command give anything? :)
@Sinnbeck nah... it says the same _ no such file or directory unfortunately
@battlecry11 Dang. Can you check with your server people if they can help find where php8 is installed on the server? :)
@Sinnbeck Yes , figured it out and it's in /opt/plesk/php/8.1/bin/php
@battlecry11 Awesome. Would never have guessed that.
Can you now try
/opt/plesk/php/8.1/bin/php /usr/local/bin/composer install
and
/opt/plesk/php/8.1/bin/php artisan key:generate
@Sinnbeck first one says: "COMPOSER_BIN="/opy/psa/var/modules/composer/composer.phar"
[ -e "$COMPOSER_BIN" ] || {echo " '$COMPOSER_BIN' not dound" >&2; exit 1;}
[ -x "$COMPOSER_BIN" ] || {echo " '$COMPOSER_BIN' is not executable" >&2; exit 1;}
"$COMPOSER_BIN" "$0"
And the second: APPLICATION KEY Is generated successfully,
thank you very much
@battlecry11 Ok. So it is installed and working now?
@Sinnbeck I think it is... I am using laravel as an api for my Next js application... So, I created subdomain api.example.com which serves laravel application. While example.com _ My Next js app. Now , I want to send request from my frontend to it. (But it does not send it because of CORS policy, so firstly I should handle it). Thank you once again for your help... So grateful... Definitely saved my day
@battlecry11 I suggest creating a new thread, as that is a bit off topic. And happy to help :)
@Sinnbeck Hi mate, this thread is perfect timing for me as I'm trying to deploy my first ever site!
I'm using Laravel Forge with AWS Servers, the layout of the website is there I just get an internal server error with the data. I followed the Gaming Aggregator series and it all works locally. - https://github.com/JordHemsworth/GameAPI -
However when putting it to the server I get these errors in the console browser -
Failed to load resource: the server responded with a status of 500 (Internal Server Error) /livewire/message/popular-games:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error) /livewire/message/most-anticipated:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error) /livewire/message/coming-soon:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
In the laravel log this is the most recent error - 2022-01-20 12:41:44] local.ERROR: View [app] not found. {"exception":"[object] (InvalidArgumentException(code: 0): View [app] not found. at C:\Users\Jord\Coding\GameAPI\vendor\laravel\framework\src\Illuminate\View\FileViewFinder.php:137) [stacktrace] - But I'm not really sure what it is saying when it all works locally.
Any ideas?
Please or to participate in this conversation.