Symfony - An exception has been thrown during the rendering of a template - php

I have been using Codeigniter for sometime now and thought I would try out Symfony. I am very new to Symfony and working from the demo project. When I launch the demo project in my browser I get this error:
An exception has been thrown during the rendering of a template ("An exception occured in driver: could not find driver") in blog/index.html.twig at line 6.
500 Internal Server Error - Twig_Error_Runtime
3 linked Exceptions: DriverException » PDOException » PDOException »
I am not sure where to begin. Can someone please help me in the right direction?

This is your problem: An exception occured in driver: could not find driver
It means that you haven't installed a proper driver for PDO for the RDBMS, which you are using. Or there is specified some invalid value in the config file.

Ubuntu 16.04 doesn't come with php7 and sqlite3. Please run the following command
sudo apt-get install php7.0-sqlite3

Once I ran sudo apt-get install php5-sqlite and then composer install everything started working.

Related

Symfony : An exception occurred in driver: could not find driver

I'm currently learning Symfony and Doctrine on Wamp, the problem is when i type the command
php bin/console doctrine:database:create
I have the following error :
In AbstractMySQLDriver.php line 110:
An exception occurred in driver: could not find driver
In PDOConnection.php line 31:
could not find driver
In PDOConnection.php line 27:
could not find driver
It's strange because i have my .env file with my DATABASE_URL correct :
DATABASE_URL="mysql://root:#127.0.0.1:3306/csi_film4?serverVersion=5.7"
I also have on WAMP, the pdo_mysql extension ticked on the Wamp, and i've made sure that the extension is in my php.ini file.
But still, i have the error when i type the command to create a database...
I also did a php -m and php -i command on my command prompt but i don't see any pdo_mysql extensions in the php modules so i kknow these modules are missing but I have no idea how can I download them.
If you have any ideas how can I install the missing modules to my php on my Wamp server, I would be glad to have them !
Thanks!
You need to install MysQl, for Ubuntu just use
sudo apt-get install php-mysql

Mac OSX Catalina install pdo_pgsql extension for PHP

I have a laravel application that I've been trying to run, but I get the following error when hitting the database:
Illuminate \ Database \ QueryException (7)
SQLSTATE[08006] [7] FATAL: unsupported frontend protocol 1234.5679: server supports 2.0 to 3.0
I'm running postgres 12.1 (have also tried with 12.2, no go), php 7.2.28 (have also tried with 7.4.3, no go). The stack trace also mentions a PDOException, so I tried using pecl to install pdo_pgsql, to make sure I have the needed drivers, but I keep getting the following error:
Build complete.
Don't forget to run 'make test'.
running: make INSTALL_ROOT="/private/tmp/pear/temp/pear-build-bowmanLwaFvm/install-PDO-1.0.3" install
Installing shared extensions: /private/tmp/pear/temp/pear-build-bowmanLwaFvm/install-PDO-1.0.3/usr/local/Cellar/php#7.2/7.2.28/pecl/20170718/
cp: modules/*: No such file or directory
make: *** [install-modules] Error 1
ERROR: `make INSTALL_ROOT="/private/tmp/pear/temp/pear-build-bowmanLwaFvm/install-PDO-1.0.3" install' failed
I've been fighting this for hours today, just to get this application to connect to the database and work properly. Searching around to try different things, like downloading the pdo_pgsql package and manually building it gives the same error.
Help?

MongoDB PHP driver not working on Ubuntu AWS

I'm trying to install the MongoDB PHP driver Using PHP 7.2 on AWS EC2 Ubuntu.
I used sudo pecl install mongodb. it seems to have installed without any errors.
However, when loading phpinfo() I don't see any reference to Mongo. When I try to run:
$manager = new MongoDB\Driver\Manager("mongodb://localhost:27017");
Fatal error: Uncaught Error: Class 'MongoDB\Driver\Manager' not found in /var/www/html/website/test.php:3 Stack trace: #0 {main} thrown in /var/www/html/website/test.php on line 3
I did put in extension=mongodb.so into my php.ini
I'd appreciate assistance as to why this isn't working.
I tried to install driver using
sudo apt-get install php-mongodb
and it works.

"Class 'XMLWriter' not found" Error in php | php55w-xml-5.5.24-1.w6.x86_64.rpm is missing

I am getting this error in PHP in server Fatal Error (E_ERROR): Class 'XMLWriter' not found . we are using Cent OS 6
After exploring some sites, we found that we need to install php55w-xml-5.5.24-1.w6.x86_64.rpm. But the link is not working, I am not able to get this package. we are using PHP 5.5.24. We can not upgrade our PHP because of dependency with other products.Can we resolve this error without upgrading the PHP. Thanks !!!
UPDATE: we are using https://rollbar.com/ for error handing.
Install php7-xmlwriter
yum install php-7xmlwriter
on Centos 7, in my case this works:
yum install php-xml
service httpd restart

Fatal error: Class 'MongoDB\Driver\Manager' not found in /srv/www/api/releases/...vendor/mongodb/mongodb/src/Client.php

I am trying to configure MongoDB on the AWS server, but when I try to make an API call, I get the following error:
Fatal error: Class 'MongoDB\Driver\Manager' not found in /srv/www/api/releases/20160912135146/vendor/mongodb/mongodb/src/Client.php on line 56
I have done the following:
Install mongodb, following the instructions here -> install mongodb community edition on ubuntu
installed the php mongodb driver using pecl install mongodb
added extension=mongodb.so to php.ini at etc/php5/cli/php.ini
Started the mongodb service
on the server, I can enter the mongo console with $ mongo
What am I missing here, Please?
PS: the API is developed using Phalcon
I finally found a solution to this. Apparently, the apache server uses a special php.ini file, different from etc/php5/cli/php.ini. This file is located in etc/php5/apache2/php.ini. After installing the mongodb driver using pecl install mongodb, your extension should go in etc/php5/apache2/php.ini i.e add extension = mongodb at the end of etc/php5/apache2/php.ini. Good luck

Categories