I have created a schedule wich should import a xml file into the database. But when i run this schedule i get a "SQLSTATE[HY000] [2002] No such file or directory" error.
But when i run the same script manualy from the site it works perfectly
Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] No such file or directory (SQL: select `company` from `company`)
at vendorframework/src/Illuminate/Database/Connection.php:671
667| // If an exception occurs when attempting to run a query, we'll format the error
668| // message to include the bindings with SQL, which will make this exception a
669| // lot more helpful to the developer instead of just the database's errors.
670| catch (Exception $e) {
> 671| throw new QueryException(
672| $query, $this->prepareBindings($bindings), $e
673| );
674| }
675|
+19 vendor frames
20 app/Console/Commands/importXML.php:47
Illuminate\Database\Eloquent\Builder::get()
+14 vendor frames
35 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symf
bash-4.2$ /opt/plesk/php/7.3/bin/php artisan import:XMLmutaties
Yes when i run '/opt/plesk/php/7.3/bin/php artisan import:XMLmutaties' i get the error.
On the website there is a button that runs the script and that works 100%. The script checks if there are files in the storage/app directory there are 18 in it now so thats not the problem.
On my local machine its working with out any problems. Only at the website host its not working but it does work when you run it manually but not if its within a schedule. Really confusion :p
I found a possible solutions wich says you should change the DB_HOST from localhost to 127.0.0.1 but then i get a access denied.
So wrote a email to my host hoping they can change this.