I'm getting the following error when pushing a job to a laravel 5.2 Queue, using the database driver.
exception 'InvalidArgumentException' with message 'No connector for
[]' in
/var/www/krsa/vendor/laravel/framework/src/Illuminate/Queue/QueueManager.php:150
The queue is running with supervisor and the following setup
[program:krsa-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/krsa/artisan queue:work —tries=3 --daemon
autostart=true
autorestart=true
user=root
redirect_stderr=true
stdout_logfile=/var/www/krsa/supervisor/worker.log
.env file points to the database driver
QUEUE_DRIVER=database
config/queue.php file has correct settings:
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'expire' => 60,
],
table jobs exists and has the correct columns.
The same settings work on another project on a different server.
I've made composer update and made sure all dependencies are installed, unless there are extra dependencies I am not aware of for the database driver.
Can't figure out why Laravel is not picking up the connector/driver. Any help would be greatly appreciated.
UPDATE
When I run php artisan queue:work the queue processes all jobs correctly.
I've just run into this too. It'll likely be because tries doesn't have two hyphens before it, only one in your case
Related
I've been trying to setup mailing in Laravel 7 with AWS SES and have setup all my credentials properly and set my drivers to SES.
I get the following error when attempting to send an email verification with the default built in functionality.
Connection could not be established with host smtp.mailtrap.io :stream_socket_client(): unable to connect to tcp://smtp.mailtrap.io:2465 (Operation timed out)
.env
MAIL_DRIVER=ses
MAIL_FROM_ADDRESS=no-reply#taxsion.com
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=HIDDEN
AWS_SECRET_ACCESS_KEY=HIDDEN
AWS_DEFAULT_REGION=us-east-1
I have ensured that the AWS key and secret have full access to SES, in my config/services.php I am setting it to use these credentials.
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
]
I have searched through numerous "solutions" and have tried creating a separate user for SES only with no luck.
Any help would be great, thanks!
Laravel 7 has introduced Multiple Mail Drivers which has changed how the mail config works.
If you look at your config/mail.php you'll notice that you have a MAIL_MAILER value instead of MAIL_DRIVER. You should be able to simply change the MAIL_DRIVER to MAIL_MAILER in your .env file:
MAIL_MAILER=ses
You may also need to clear the config cache after you've made the change:
php artisan config:clear
The issue was that my .env was not being loaded due to caching.
Simply running php artisan config:clear cleared the cached config and updated it with my new parameters.
My .env contains the following:
MAIL_MAILER=ses
MAIL_FROM_ADDRESS=no-reply#domain.com
MAIL_FROM_NAME="${APP_NAME}"
I generate one laravel project . Now i need to move the project to the production server. In the local system, I use php artisan serve to run the project and run http://127.0.0.1:8000/ .
while moving to the production server, I changed the .env file
APP_ENV=production
APP_DEBUG=false
APP_LOG_LEVEL=debug
APP_URL=http://myserverip
My config/app.php
'env' => env('APP_ENV', 'production'),
'debug' => env('APP_DEBUG', false),
'url' => env('APP_URL', 'http://my ip'),
I run the project (ip/projectfolder) in live it displays dirctory files listing in the browser.
Is there is any thing extra I need to configure ?
I have installed & configured supervisor.
ps -ax shows 10 processes such as:
php /home/vagrant/Sites/mysite/artisan queue:work --tries=1
However when I put something in queue it stays there and nothing happens. But if I run this command manually (even under vagrant user, exactly how it does supervisor) everything works.
I use Redis for keeping queues.
What can be the reason?
update
So, here is some additional info, since I really couldn't figure it out.
Laravel 5.5 version
Actually I have two supervisor configs for 2 projects. First one seemed to be working. Second doesn't. I mean, I can see the processes by ps -ax, but nothing happens. Both configs are identical:
[program:mysite-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /home/vagrant/Sites/mysite/artisan queue:work --tries=1
autostart=true
autorestart=true
user=vagrant
numprocs=10
redirect_stderr=true
stdout_logfile=/home/vagrant/Sites/mysite/worker.log
Also I couldn't figure out how can I enable and disabled some configs (like en2site for supervisord :) )
So, when I put something in the queue I can see it in redis. Then I manually run php /home/vagrant/Sites/mysite/artisan queue:work --tries=1 under vagrant user and queue jobs are dispatched and run. But only if I run the command manually =\
I was about the same problem.
The issue is apears becouse supervisor when call
php /home/vagrant/Sites/mysite/artisan queue:work --tries=1
actualy not in project working directory, and artisan cant find .env file.
so you have some option to handle this:
set your enviroment variables from .env file
or
add directory parametr to your supervisor config
directory="path/to/your/project"
or
set set_include_path in php.ini to your project folder
I went through the laravel to-do app and am stuck at the php artisan migrate part. I know this question has been posted many times here already but I feel like I've tried many suggestions that just aren't working--changing the host to localhost and 127.0.0.1, generating the key for the .env file, adding in a socket, forcing the migration, etc. Below is a screenshot of my .env and database files for your reference. Any assistance is greatly appreciated!
screenshot here
So because you're using MAMP, there's a few caveats which are probably not clear, such as MAMP not using a normal UNIX Socket.
But to fix your problem, you'll need to do the following in your database config file, replace unix_socket with this:
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
You may also have to run:
php artisan cache:clear
Incase your config files have been cached previously.
Had this same issue since I am using MAMP. I am on laravel 5.5 so my database.php has this line under the mysql directive:
'unix_socket' => env('DB_SOCKET', ''),
The solution was to add the DB_SOCKET option which was missing on the environment file:
DB_SOCKET=/Applications/MAMP/tmp/mysql/mysql.sock
I experienced the same problem using Laravel 5.7.3 with XAMPP for OS X (not XAMPP-VM) and managed to solve this by referring to Kyo's solution in this post.
I updated line 49 in config/database.php:
'unix_socket' => env('DB_SOCKET', ''),
with
'unix_socket' => env('DB_SOCKET', '/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock'),
I also tried TechyTimo's solution above and this worked for me as well. I assume it would be better to use this solution since all configurations are kept in one file.
When I use 'php artisan migrate' I get the following error message:
[Illuminate\Database\QueryException]
SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = homestead and table_name = migrations)
[PDOException]
SQLSTATE[HY000] [2002] Connection refused
I've installed Laravel on a mac with XAMPP and have the following settings:
database.php
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
.env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
I've tried several solutions I could find online, but none have worked so far.
This is really anoying, but changing DB_HOST=127.0.0.1 to DB_HOST=localhost solves the problem. Give it a try (obviously your file permission must be the right one)
The solution for me was different than anywhere else I found online.
I was unknowingly using the VM (virtual machine) version of XAMPP on Mac, which functions differently than the normal version. VM XAMPP interface looks like this.
If you are using the VM XAMPP, uninstall it and install the correct XAMPP version here.
Once I installed the new version php artisan migrate worked.
If someone is experiencing this when using Docker, I had a multi-stage build with first container running the dependency installation and the second one just being the runtime. What I didn't realise is that the installation with Laravel scripts generate a cached config (bootstrap/cache/config.php) which is used instead of the config/database.php file.
Adding the following to the Dockerfile as the last step did the trick:
RUN php artisan config:clear
First create your database. Read more about it here: http://www.complete-concrete-concise.com/web-tools/creating-a-mysql-database-using-xampp
Let's say your new database is named: my_db.
Use this in your .env:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=my_db
DB_USERNAME=root
DB_PASSWORD=""
I was using a Vagrant machine to run the whole thing, but I was mistakenly running command on my own machine.Thought this might help someone.
Hi you don't have DB_SOCKET= /path/to/socket in env.file while you have unix_socket => env('DB_SOCKET', '') in database.php file.
You could get the /path/to/socket by $ mysql_config --socket
if you are using MAMP then in your .env file :
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=root
DB_PASSWORD=root
I had a similar problem. Only it was using "ddev". It turned out that mysql responds to a completely different IP instead of 127.0.0.1 or locahost.
console: ddev ssh // If using ddev.
Login to mysql: mysql -y USERNAME -p
Runs this "SELECT SUBSTRING_INDEX(USER(), '#', -1) AS ip, ##hostname as hostname, ##port as port, DATABASE() as current_database;" It displays a table with data. The IP may not be the one to connect to. Must take is hostname.
ping "hostname" from the previous table. And then try to put the obtained IP in the .env file. Or "hostname". It also fits.
Now connection works.
This is coming late but it might help someone. I had the same error, it turned out it was a typo in my .env file. Instead of DB_HOST, it was B_HOST. In your case it might be some other env key. Just look closer and you will discover the you have a malformed env file.