When I run php artisan queue:work on my local server, everything works fine, but on my production server, all queued jobs/notifications/mails fail.
It shows this error for my failed jobs:
exception 'ErrorException' with message 'include(/var/www/addondomains/mutual.ecowas.int/vendor/composer/../laravel/framework/src/Illuminate/Mail/SendQueuedMailable.php): failed to open stream: No such file or directory' in /var/www/....../vendor/composer/ClassLoader.php:444
or
exception 'InvalidArgumentException' with message 'View [email] not found.' in /var/www/....../vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php:137
If I change the queue_driver to SYNC, everything works fine. Otherwise, all fail.
Is there something I am missing?
In my case, restarting the queue workers fixed the issue. They had an uptime of 500 and something days. Therefore, old code was loaded on memory, leading to the inexplicable exceptions.
The error says:
failed to open stream: No such file or directory' in /var/www/....../vendor/composer/ClassLoader.php
Probably you have missing dependencies. You should try to do a composer install on your production server and also check if the user running PHP has access to the folders (e.g. on Ubuntu it's usually www-data user).
Please log in to your production server and run composer install. And, if you are manually deploying, I also recommend you to user Jenkins or some tools like that, which can handle this kind of thing during deployments for you.
If this doesn't work, please post more info about your server version, etc so we can help you.
composer dump-autolaod
after changes in queue files
Related
I set up an app using Laravel Sail, and hosted it in my C:Users/User/my_app folder, however API endpoints were terribly slow (around 7s to respond).
I decided to move my application to the WSL filesystem. I copied my_app folder to \\wsl$\Ubuntu-20.04\home folder. However, when I type ./vendor/bin/sail up command nothing happens. No error message, no "command not found message", nothing.
I tried changing home/my_app permissions as well as vendor/bin/sail permissions but it has not helped me. I have no idea how to solve this problem as I am not receiving any message from the console.
I think I solved the issue with copying the files from Windows to WSL using cp command run from WSL console (cp /mnt/c/users/..... ).
However I stubmled upon this error Laravel & Docker: The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied which I solved using the answers from this github thread https://github.com/aschmelyun/docker-compose-laravel/issues/49.
Now my endpoint response times are usually under 100ms.
I'm trying to deploy laravel app to aws beanstalk, OS is Amazon Linux 2 AMI.
I've setup following files:
.ebextensions/01-deploy-script-permission.config
It contains below code:
container_commands:
01-storage-link:
command: 'sudo chmod +x .platform/hooks/postdeploy/post-deploy.sh'
And
.platform\hooks\postdeploy/01-post-deploy.sh
It contains below code:
php artisan optimize:clear
Upon deploying it fails with following entry in eb-engine.log file
[ERROR] An error occurred during execution of command [app-deploy] -
[RunAppDeployPostDeployHooks]. Stop running the command. Error:
Command .platform/hooks/postdeploy/post-deploy.sh failed with error
fork/exec .platform/hooks/postdeploy/post-deploy.sh: no such file or
directory
This answer is for users who are using Windows to deploy their files to elastic beanstalk.
I found this information after spending 6 precious hours. Probably not documented anywhere in official documentations
As per this link "https://forums.aws.amazon.com/thread.jspa?threadID=321653"
psss: most important that the file is saved with LF line separator.
CRLF makes "no file or directory found"
So I used Visual Studio Code to convert CRLF to LF for files in .platform/hooks/postdeploy
At the bottom right of the screen in VS Code there is a little button
that says “LF” or “CRLF”: Click that button and change it to your
preference.
I don't know for sure but I think you are running the command before the files are even created hence getting the following error.
A while ago I faced the same kind of problem where I wrote migration commands in .ebextension and it used to give me an error because my env file wasn't even created yet hence no DB connection is made so I was getting the error. Hope this will give you a direction.
By the way, I resolved the problem by creating env then pushing these commands through the pipeline.
I am new with Laravel and working on a project to practice myself. I have set up and connected my database and when I try to execute the migrate command on the VS Code terminal, I get the error: Illegal Instruction: 4
I have seen different discussions but was not able to find one with good instructions to solve this.
Most of them were for other programs and not Laravel/VS Code.(also I am a Mac user)
Any ideas on this and how to solve it?
enter image description here
This error seems to occur if you have SSL issues or config issues in the options section.
It may be how the composer runs from a root directory and it cannot find the real path of a SSL certificate.
We experienced this due to an incorrect configuration on Symfony[*] where the the mysql port was set to 33060 instead of 3306.
I think you can get this error if your mysql configuration is pointing to the wrong host/port combination, possibly combined with SSL enabled.
The issue is in the php mysql layer so which framework is in use is not so important.
You are trying outside the project folder you should go inside your project folder
cd YOUR_FOLDER_NAME
then
php artisan migrate
I have been working on a project for about a month. There have been no major issues. We are about to launch.
An error was reported that a route was not working as intended on staging. I tried to replicate it locally by putting the route into my browser ( but obviously with the local domain path ) and it didnt work. this is the order of events:
that route was causing a permanent redirect. Code looked fine but i noticed the intended get did not seem to be hitting so I put a dd('test'); after it and refreshed and saw the test. So it was bypassing its intended route::get, which was not happening before.
I tried figuring this out, clearing cache and the normal things that could cause this. I then killed the server ( locally ) shut down terminal and restarted it, now everytime I try to run anything it responds with http://localhost
CO!!##!##!##:directoryproject username$ php artisan cache:clear
"http://localhost"
CO!!##!##!##:directoryproject username$ php artisan config:clear
"http://localhost"
CO!!##!##!##:directoryproject username$ php artisan serve
"http://localhost"
CO!!##!##!##:directoryproject username$
i cannot get anything to work. I tried checking out a different branch, nothing. Composer update, install nothing. I keep getting:
Script #php artisan package:discover handling the post-autoload-dump event returned with error code 1
Any help would be greatly appreciated at this point.
You've likely got a dd statement somewhere like dd(request()->getHost()); or similar. Do a recursive search starting in the app's root directory for the pattern dd(. If that doesn't yield anything, start at the very top pulic/index.php and put in dd(__DIR__); statements and attempting to access the app. Then move onto the service providers, http kernel, etc. until you can locate the culprit code.
I am trying openshift DIY cartridge. I use a windows system to manage the server from command line. I managed to run a simple html5 website. I have deleted the testrubyserver.ruby file from the webpage folder for test purposed and then added it again to my webfolder. Now i have 503 error. No restart, no stop, no start helps. I am stuck in 503. Does anyone know what to do? How can I make the testrubyserver.ruby run again?
Solved my problem. I checked the log file in the folder: app-root / logs. There I found out that
nohup: failed to run command `/..//testrubyserver.rb': Permission denied
I change in filezilla the permissions for the file from rw to rwx to execute it. Restarted the server and then it worked.
I do not know if this is the right approach. At least it makes my app running again.