Im using laravel in manjaro linux.. if I excute php artisan migrate command it gives me this erro how I fix this. also Im already install xampp
thank you..
error :
Illuminate\Database\QueryException : could not find driver (SQL: select * from information_schema.tables where table_schema = nws and table_name = migrations and t able_type = 'BASE TABLE')
at /run/media/snake/Entertainment/VS/linuxTest/Nurses/NW/vendor/laravel/framework/src/ Illuminate/Database/Connection.php:664
660| // If an exception occurs when attempting to run a query, we'll format the error
661| // message to include the bindings with SQL, which will make this exception a
662| // lot more helpful to the developer instead of just the database's errors.
663| catch (Exception $e) {
> 664| throw new QueryException(
665| $query, $this->prepareBindings($bindings), $e
666| );
667| }
668|
Exception trace:
1 PDOException::("could not find driver")
run/media/snake/Entertainment/VS/linuxTest/Nurses/NW/vendor/laravel/framework/src/
lluminate/Database/Connectors/Connector.php:70
2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=nws", "root", "", [])
/run/media/snake/Entertainment/VS/linuxTest/Nurses/NW/vendor/laravel/framework/src/
Illuminate/Database/Connectors/Connector.php:70
Please use the argument -v to see more details.
Make sure you have installed Maria / MySQL and it's PHP driver.
sudo pacman -Syu mariadb mariadb-clients libmariadbclient
My solution is use localhost instead 127.0.0.1 in .env...
DB_HOST=127.0.0.1
to
DB_HOST=localhost
try this, worked for me...
Related
I'm trying to run some services on a ubuntu server using process() (from Symfony\Component\Process\Process)
$process = new Process(['systemctl', '--user', 'start', $serviceName]);
try {
$process->mustRun();
}
catch (ProcessFailedException $ex) {
Log::alert($ex->getMessage());
}
but I'm getting the following error:
The command "'systemctl' '--user' 'start' 'some_service_name.service'" failed.
Exit Code: 1(General error)
Working directory: /
Output:
Error Output:
Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>#.host --user to connect to bus of other user)
Any help would be much appreciated!
I figured it out, for anyone facing the same problem the argument "--machine=username#.host" was missing.
so the end result should be something like this:
$process = new Process(['systemctl', '--machine=USER_HERE#.host', '--user', 'start', $serviceName]);
try {
$process->mustRun();
}
catch (ProcessFailedException $ex) {
Log::alert($ex->getMessage());
}
(replace the USER_HERE with your user)
I really need some help here hehe
Ok i got a symfony 4 application that is working perfectly in local environement.
I installed the app on heroku, but i want to access my Mysql database on my web hosting.
To be able to do that i had to install the Fixie app on heroku to have two ip adress and be able to whitelist those address for the remote access of my database.
The app is running good, but if i go to any links that have a call to do at the database i got a timeout.
I think the problem is in my index.php file, when installing Fixie you have to add code to the trust proxy
Heres what i have right now in my index.php file
<?php
use App\Kernel;
use Symfony\Component\Debug\Debug;
use Symfony\Component\HttpFoundation\Request;
require dirname(__DIR__).'/config/bootstrap.php';
if ($_SERVER['APP_DEBUG']) {
umask(0000);
Debug::enable();
}
$trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false;
$trustedProxies = $trustedProxies ? explode(',', $trustedProxies) : [];
if($_SERVER['APP_ENV'] == 'prod') $trustedProxies[] = $_SERVER['REMOTE_ADDR'];
if($trustedProxies) {
Request::setTrustedProxies($trustedProxies, Request::HEADER_X_FORWARDED_AWS_ELB);
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts([$trustedHosts]);
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
Thats the log message i get when i try to access a page that have a call to the database
2019-11-28T22:13:12.218311+00:00 app[web.1]: [2019-11-28 22:12:42] request.INFO: Matched route "publicResultat". {"route":"publicResultat","route_parameters":{"_route":"publicResultat","_controller":"App\\Controller\\PublicController::index"},"request_uri":"https://jugement.herokuapp.com/public","method":"GET"} []
2019-11-28T22:13:12.218435+00:00 app[web.1]: [2019-11-28 22:12:42] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
2019-11-28T22:13:12.220033+00:00 app[web.1]: [2019-11-28 22:13:12] request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\ConnectionException: "An exception occurred in driver: SQLSTATE[HY000] [2002] Connection timed out" at /app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 93 {"exception":"[object] (Doctrine\\DBAL\\Exception\\ConnectionException(code: 0): An exception occurred in driver: SQLSTATE[HY000] [2002] Connection timed out at /app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:93, Doctrine\\DBAL\\Driver\\PDOException(code: 2002): SQLSTATE[HY000] [2002] Connection timed out at /app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31, PDOException(code: 2002): SQLSTATE[HY000] [2002] Connection timed out at /app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27)"} []
When you install fixie in heroku you have to add something this is the example they give for php but i don't understand how to do that in my symfony app
PHP cURL is the easiest way to get your PHP application working correctly with Fixie. Here’s how:
<?php
function proxyRequest() {
$fixieUrl = getenv("FIXIE_URL");
$parsedFixieUrl = parse_url($fixieUrl);
$proxy = $parsedFixieUrl['host'].":".$parsedFixieUrl['port'];
$proxyAuth = $parsedFixieUrl['user'].":".$parsedFixieUrl['pass'];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyAuth);
curl_close($ch);
}
$response = proxyRequest();
print_r($response);
?>
Hope that i am clear on my problem
any help would be very useful
I also found strange that i have no header present when the call is done
Request URL: https://jugement.herokuapp.com/public
Referrer Policy: no-referrer-when-downgrade
Thats all i have in the header
My os is windows
Illuminate\Database\QueryException : could not find driver (SQL: select * from information_schema.tables where table_schema = blog and table_name = migrations)
at E:\Programme\Laravel Lab\blog\vendor\laravel\framework\src\Illuminate\Database\Connection.php:664
660| // If an exception occurs when attempting to run a query, we'll format the error
661| // message to include the bindings with SQL, which will make this exception a
662| // lot more helpful to the developer instead of just the database's errors.
663| catch (Exception $e) {
> 664| throw new QueryException(
665| $query, $this->prepareBindings($bindings), $e
666| );
667| }
668|
Exception trace:
1 PDOException::("could not find driver")
E:\Programme\Laravel Lab\blog\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:68
2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=blog", "root", "root", [])
E:\Programme\Laravel Lab\blog\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:68
Please use the argument -v to see more details.
first you need start your mysql server
then check your env configuration for your mysql, i think your password isn't root, but you put root in password.
some times password is empty. check it please.
I am new to Laravel and myphpadmin so I am assuming I am making a stupid mistake while entering parameters into my env file. Also, keep in mind that I am using a brand new copy of myphpadmin that was included with MAMP (I haven't altered username or password at all).
Here is my error:
Illuminate\Database\QueryException : SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = mysql an
d table_name = migrations)
at
/Users/christian/Desktop/lsapp/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
660| // If an exception occurs when attempting to run a query, we'll format the error
661| // message to include the bindings with SQL, which will make this exception a
662| // lot more helpful to the developer instead of just the database's errors.
663| catch (Exception $e) {
> 664| throw new QueryException(
665| $query, $this->prepareBindings($bindings), $e
666| );
667| }
Exception trace:
1 PDOException::("SQLSTATE[HY000] [2002] No such file or directory")
/Users/christian/Desktop/lsapp/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
2 PDO::__construct("mysql:host=localhost;port=8080;dbname=mysql", "root", "", [])
/Users/christian/Desktop/lsapp/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
Here is my env file:
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=8080
DB_DATABASE=lsapp
DB_USERNAME=root
DB_PASSWORD=
In your env file, try change to:
DB_HOST=127.0.0.1
DB_PORT=3306
Also are you sure mysql is running on 8080? Mine is normally 3306
8080 is your Apache port, despite it showing up in the url of your PHPMyAdmin, it is not the value you need to put in your .env
Your MAMP instalation should mention a seperate MySQL Port that you need to use for the DB_PORT value.
I am using dynamic connection in laravel 5.2
try{
$mt4connection = DB::reconnect('mt4db');
}catch(Exception $e){
echo "test";exit;
$e->getMessage();
}
it is throwing exception :
[PDOException]
SQLSTATE[HY000] [2003] Can't connect to MySQL server on '52.44.48.105' (4)
But not coming in catch block.
How can i handle this, Please help me.