F
Filament6mo ago
Ali

Deployment Error

I have been trying for the last 2 hours to deploy my laravel/filament project on my server. I kept getting error 500 (server not laravel). After making some research with a friend we found out that the error is coming from the server itself not the laravel/filament project. so when i check the server logs i got this "2023-12-16 14:34:16.810265 [NOTICE] [2014] [T0] [xxx.xxx.xxx.xxx:62299-H3:D9BDE24FE5D394C2-4#APVH_efacture.algeriainnov.tech:443] [STDERR] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 20480 bytes) in /home/algeriainnov/efacture.algeriainnov.tech/vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php on line 102\n" Does that mean there's an infinite loop somewhere in the code ?
46 Replies
Ali
Ali6mo ago
Also here's my composer.json
No description
Ali
Ali6mo ago
No description
Lara Zeus
Lara Zeus6mo ago
a lot is happening in a deployment what if you deploy without filament what is your deployment script dose your server have all the minimal requirement for laravel and filament storage folders permission?!
Ali
Ali6mo ago
1- I already have project deployed without Filament in the server. 2- I git pull from github and set up the .env 3- I'm not really sure but it's the first time i get this error 4- stroage permission 0755 @Lara Zeus Thank you for your quick response
Lara Zeus
Lara Zeus6mo ago
not sure if related but only keep filament/filament and remove the other, update locally and push to test when the error shown? during composer install or visiting a page
Ali
Ali6mo ago
Have also tried this but same error 500. have tried to push the project to a whole different server and it's giving the same error. Have also tried to push a brand new laraevl project and it's working normally.
Lara Zeus
Lara Zeus6mo ago
?
jouni.i
jouni.i6mo ago
something issue about vendor folder.. i think you fix issue if remove vendor folder and run again composer install
Ali
Ali6mo ago
when the page loads UP. sorry i missed responding to your message will try doing this right now
Archie
Archie6mo ago
yeah, when I first deployed I got a 500 error, after implementing FilamentUser in the class and adding this function

public function canAccessPanel(Panel $panel): bool
{
return str_ends_with($this->email, '@yourdomain.com') && $this->hasVerifiedEmail();
}

public function canAccessPanel(Panel $panel): bool
{
return str_ends_with($this->email, '@yourdomain.com') && $this->hasVerifiedEmail();
}
it worked, just changed @yourdoman.com, with your actual domain name, mine was something like @ testing.co.uk the email that you login with must end with the custom
@yourdomain.com
@yourdomain.com
jouni.i
jouni.i6mo ago
@Archie i think that 500 error coming before filament login page... AuthManager.php on line 102 in line 102 laravel not found any auth driver.. and authmanager try to solve it again and crash fatal error another option for this error is that all the config files of laravel are missing
Ali
Ali6mo ago
i have just tried this but unfortunately i keep getting the same error. :/ i think the error really comes from somwhere else.
Archie
Archie6mo ago
have you tried as Jouni suggested with the vedor file? Probably make a zip file of it and unzip to see if there's some files missing
Ali
Ali6mo ago
Also, when i check the laravel log file i dont find any error, the issue probably is the server is stopping the laravel application because of the infinite loop, so laravel doesnt even get the change to log the error. instead the error i can find it in cpanel error logs. i have deleted the vendor and did composer install all over again and i still have the same issue. but what do you mean by zipping and unzipping ?
jouni.i
jouni.i6mo ago
@Ali how about config files.. you are same files in deployment server vs developer ? laravel crash before any provider.. then you not got any error in laravel logs..
Ali
Ali6mo ago
i have the same project, i have pushed the code to github and pulled it on the server
jouni.i
jouni.i6mo ago
but your git include also all config files..
Archie
Archie6mo ago
nvm, if composer install ran successfully it's not going to help
Ali
Ali6mo ago
I will try to make a new filament project right now and push it to the server and see what's going on.
Archie
Archie6mo ago
maybe if you can share the repo and I try helping from here
Ali
Ali6mo ago
yes let me make it public
jouni.i
jouni.i6mo ago
check this git ls-files --others --exclude-standard
Ali
Ali6mo ago
Here it is. https://github.com/Da-ci/online-invoice-payment thank you guys really for helping me out
GitHub
GitHub - Da-ci/online-invoice-payment: A quick solution for invoice...
A quick solution for invoice payments initially made for heetch @ Guiddini - GitHub - Da-ci/online-invoice-payment: A quick solution for invoice payments initially made for heetch @ Guiddini
jouni.i
jouni.i6mo ago
as soon as I looked at the repo, it seems to be fine.. what php version you use
Ali
Ali6mo ago
-1 locally 8.1.13 -2 server 8.1.26
jouni.i
jouni.i6mo ago
and php artisan route:list that working ?
Ali
Ali6mo ago
here it is my friend
No description
No description
jouni.i
jouni.i6mo ago
and composer dump autoload not result error ?
Ali
Ali6mo ago
yup worked perfectly im losing my mind over this
No description
No description
No description
jouni.i
jouni.i6mo ago
you use local valet or something else ?
Archie
Archie6mo ago
I've got the same error when I tried to run it locally, so I set up the .env and ran this
composer update
php artisan key:generate
php artisan view:clear
composer update
php artisan key:generate
php artisan view:clear
, in addition I also got a view not found(search.search) error and change the name folder from Search to search
jouni.i
jouni.i6mo ago
cpanel uses case sensitive by default then uppercase folder name result error.. the same also applies to the class name and namespace my local server that working fine.. - Downloading phpunit/phpunit (10.5.3) - Downloading spatie/laravel-ignition (2.3.2) - Upgrading symfony/css-selector (v6.4.0 => v7.0.0): Extracting archive - Upgrading symfony/event-dispatcher (v6.4.0 => v7.0.0): Extracting archive - Upgrading symfony/string (v6.4.0 => v7.0.0): Extracting archive - Upgrading carbonphp/carbon-doctrine-types (2.0.0 => 2.1.0): Extracting archive - Upgrading laravel/framework (v10.35.0 => v10.37.3): Extracting archive - Upgrading livewire/livewire (v3.2.6 => v3.3.0): Extracting archive - Upgrading symfony/yaml (v6.4.0 => v7.0.0): Extracting archive - Upgrading nikic/php-parser (v4.17.1 => v4.18.0): Extracting archive - Upgrading phpunit/php-code-coverage (10.1.9 => 10.1.10): Extracting archive - Upgrading phpunit/phpunit (10.5.2 => 10.5.3): Extracting archive - Upgrading spatie/laravel-ignition (2.3.1 => 2.3.2): Extracting archive upgraded lasted laravel and livewire the only difference is that I use php 8.2 and 8.3
Ali
Ali6mo ago
yup well I couldnt reporduce the error locally. and for that error, i forgot the rename the file from Search to search. but what could be the problem ? im really getting lost over here. it's my first time working with filament anyway
jouni.i
jouni.i6mo ago
issue not filament and laravel... issue is your server settings.. that work also my product server fine if you can try to change php version 8.2
Archie
Archie6mo ago
the problem is not filament, I've deployed it and it's working
Ali
Ali6mo ago
So what do you think the problem is ? Do you think the problem comes with the laravel version ? Or just my server configuration? This will be the first thing i will do once i get home i will keep you updated
Archie
Archie6mo ago
have you set-up the database correctly in the .env? and tried running the commands above
Archie
Archie6mo ago
if you should end up with something like this, if you aren't sure what your setting in the .env it's
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
and
php artisan key:generate
php artisan migrate
php artisan key:generate
php artisan migrate
, good luck! 😃
No description
Ali
Ali6mo ago
Hello @Archie and hello @Jouni have tried to start the hosting process from the beginning and no hope, the application still gives the error 500. to assure you that the .env is set up correctly. i tried to do php artisan migrate and it worked correctly.
No description
Ali
Ali6mo ago
And as of this time i still get these errors in my server.
No description
Ali
Ali6mo ago
for more information. sometimes when i load the page this error actually shows up. and most of the refreshes it just gives me error 500
No description
No description
Ali
Ali6mo ago
and i get this error jsut when i get the error 500
No description
KA
KA6mo ago
I think you should remove/rename your .env file from your project root. Few server doesn't allow this.
jouni.i
jouni.i6mo ago
I still believe that the problem is in the server's php, it's hard to give exact advice when you don't know if php-fpm is in use. What settings and what are the memory settings of php at the moment.. usually the insufficient memory problem is caused by the php settings itself or by the non-functionality of its handler or in fact I know that the problem is in the php settings because the github version of the application works for me as well as the local and deployment server
Samir
Samir6mo ago
I feel it is purely a server configuration issue. Are you on a shared or managed VPS host with limited control? It feels like it is a PHP versioning issue. Many times host providers especially shared hosts allow you to change the php version for domains and sub-domains using their Cpanel which changes the php version but your dependent packages and other settings still default to their base default php version. Do also check your database configuration. Like DB HOST.