I have the default config in my symfonu project I have this line at .env file
DATABASE_URL="postgresql://db_user:db_password#127.0.0.1:5432/db_name?serverVersion=13&charset=utf8"
and I get this error
An exception occurred in driver: SQLSTATE[08006] [7] could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
Of course I dont have not isntalled postgres, and I dont need a database for this project, How I cant fix this error I tried to comment the .env file line but I get another error
Commenting the line as L3xpert answer suggests doesn't seem to do the job.
It will throw the error :
Environment variable not found: "DATABASE_URL".
If you don't need Doctrine but you have Website-Skeleton installed, you can remove Doctrine by running this command :
composer remove doctrine/doctrine-bundle doctrine/doctrine-migrations-bundle
Related
I'm in linux mint and when I just trying to test my project with phpunit in laravel I get this Error :
Illuminate\Database\QueryException: could not find driver (SQL: PRAGMA foreign_keys = ON;)
and in a few line below this :
PDOException: could not find driver
I'm using mysql.
please help me to fix this problem
Check your phpunit.xml file. The DB_CONNECTION and/or DB_DATABASE environment variables are probably being overruled there.
I'm a fresh junior php developer and I'm building my first Symfony project.
When I used the command : php bin/console doctrine:database:create
I get these errors :
In AbstractMySQLDriver.php line 93:
An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory
In PDOConnection.php line 31:
SQLSTATE[HY000] [2002] No such file or directory
In PDOConnection.php line 27:
SQLSTATE[HY000] [2002] No such file or directory*
I'm actually using MAMP with default config "db_user" and "db_password"
so I edited the .env file with this following code :
DATABASE_URL=mysql://root:root#localhost:8889/mydbname
I know there is something wrong with my host or port, I saw on other topics that some users using MAMP keep Symfony default values for host and port : DATABASE_URL=mysql://root:root#127.0.0.1:3306/mydbname
Thanks for reading me and trying to help me.
I did more searches and some people are saying that localhost syntax is depreciated and prefer using : 127.0.0.1 instead of localhost.
In my case I checked and used Mamp config 'Connect using an UNIX socket'
So it's now working with :
DATABASE_URL=mysql://root:root#127.0.0.1:8889/mydbname
I've installed eZ Platform on my Mac using the eZ Launchpad docs: https://ezsystems.github.io/launchpad/.
After the installation, I'm able to successfully access the platform and start creating the Content Model.
I would also like to use GraphQL, so I followed the instructions: https://doc.ezplatform.com/en/latest/api/graphql/.
Unfortunately I get an error when I try to generate the schema using the commands:
php bin/console ezplatform:graphql:generate-schema
php bin/console cache:clear
This is the error I get:
In ExceptionConversion.php line 169:
Database error
In AbstractMySQLDriver.php line 93:
An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory
In PDOConnection.php line 31:
SQLSTATE[HY000] [2002] No such file or directory
In PDOConnection.php line 27:
SQLSTATE[HY000] [2002] No such file or directory
Here's the app/config/parameters.yml:
# This file is auto-generated during the composer install parameters:
env(SYMFONY_SECRET): ThisEzPlatformTokenIsNotSoSecret_PleaseChangeIt
env(DATABASE_DRIVER): pdo_mysql
env(DATABASE_HOST): localhost
env(DATABASE_PORT): null
env(DATABASE_NAME): ezplatform
env(DATABASE_USER): root
env(DATABASE_PASSWORD): null
env(DATABASE_CHARSET): utf8mb4
env(DATABASE_COLLATION): utf8mb4_unicode_520_ci
env(DATABASE_VERSION): mariadb-10.2.26
Looks like you have executed the composer and symfony commands directly from your host and you have setup the project using launchpad.
Try this instead:
~/ez sfrun ezplatform:graphql:generate-schema
~/ez sfrun cache:clear
With ezlaunchpad your app is running in the docker container so you have to execute all common symfony/ez commands through the ~/ez shell. Executing commands from host can lead to file permission issues as well.
I have installed MongoDB in xampp on Ubuntu using Laravel 5.1. But I always get this error
MongoConnectionException in TestController.php line 19: Failed to
connect to: localhost:27017: Connection refused
Nor I'm able
I have gone through a lot of questions, but all proved to be trivial solution.
Please help me with this as I'm stuck on it.
I think that first thing to do is to ssh on that server and check that mongod process is alive, then try open mongo shell using command - mongo . If all works try telnet on this server and port from your machine ,if there is no errors , read mongo logs
I am facing an issue in connecting my php client to my mongodb server.
Basically, I installed MongoDB on my server (hosted in the US), I can connect to it locally when I am connected to it via ssh.
But I can't connect to this server on remote from my php client, here is the error that I get :
Fatal error: Uncaught exception 'MongoConnectionException' with message 'Failed to connect to: xxx.xxx.xxx.xxx:27017: Connection refused' in /var/www/pages/news.php:9 Stack trace: #0 /var/www/pages/news.php(9): MongoClient->__construct('mongodb://xxx.xxx...') #1 {main} thrown in /var/www/pages/news.php on line 9
I am using this in order to create a connection from my php client :
$m = new MongoClient("mongodb://xxx.xxx.xxx.xxx");
My remote server is Ubuntu 12.04 and I already added the INPUT and OUTPUT rules in iptables to allow traffic for the port 27017.
I don't really know where the issue comes from ? (I did not add any authentication credentials to my mongodb instance, its a new one for testing purposes).
If anyone had the same issue and found a solution, it could be helpful, thank you !
Ok guys, found the issue :
I typed this command in order to display the listening services and their corresponding ports:
netstat -anltp | grep "LISTEN"
I saw that SSH was listening with the IP : 0.0.0.0
But mongod was listening on the local interface 127.0.0.1
I just had to update the mongodb configuration file here :
/etc/mongodb.conf and set the parameter "bind_ip" to : 0.0.0.0
and uncommented the "port" field to use the default one : 27017.
As a result, now I can connect from my client to my mongod instance on my server.
Hope this helps !