I've been trying to generate model classes from a local database using both propel and bake for cakephp , it seems that i have the same problem :
When I try to acces the database through bake or propel it gives me an error that it can't open the connection:
So I tried this :
I try to acces the database from the application using pdo it works just fine!!!
When I tried to acces database through terminal it's also working !!!
I really don't know what's the problem here !
You most likely have a separate php.ini config file for CLI and pdo_mysql is not loaded for CLI.
Related
When I try to load fixtures into my local database and I have sqlsrv.so enabled my fixture loading fails and I get this error:
In PriceCalculatorService.php(87) : eval()'d code line 1:
syntax error, unexpected ':'
Error is useless and irrelevant, the problem is not there.
my sqlsrv.ini file:
; priority=20
extension=sqlsrv.so
extension=pdo_sqlsrv.so
If I comment it like this
; priority=20
#extension=sqlsrv.so
#extension=pdo_sqlsrv.so
Fixture loading starts working again. I need the driver running since I want use both local mysql and mssql databases.
sqlsrv driver is working perfectly fine, I tested it.
I'm running symfony 4.4, php 7.4.22, ubuntu 18.04 and I'm using doctrine to migrate and load fixtures into my local database.
Does anyone have any idea what might be causing this?
It was locale settings, changing my OS region to United States, solved the problem.
https://learn.microsoft.com/en-us/sql/connect/php/non-system-locale-settings?view=sql-server-ver15
I have project in Laravel 6 with MySQL database and its working fine. My client wants to use SQLite instead of MySQL database.
So i converted my existing database from database.sql to database.sqlite using following online tool
Online database conversion done here : https://www.rebasedata.com/
https://www.rebasedata.com/convert-mysql-to-sqlite-online
After that i have configured database.sqlite into .env file and into config/database.php file.
Issue : I am not able to go beyond login page. Every time i try to login it redirects me back to login page.
Debug : I reviewed that if I remove Authentication function then i am able to access controller which comes after login.
If I do comment to this line $this->middleware('auth'); following function It starts working.
public function __construct()
{
// $this->middleware('auth');
}
Conclusion : I found that I am not getting any value for $user = Auth::user();
So I think that session is not getting generated and stored correctly with SQLite database
Notes :
I have exported existing database using phpmyadmin and removed all
unnecessary comments from database.sql file.
I converted database.sql file online using this tool
https://www.rebasedata.com/convert-mysql-to-sqlite-online
As per my investigation Auth is not getting generated and stored.
I am using default laravel Auth, I generated that using laravel terminal command.
This setup works fine if I configure project with MySql database.
SQLite database configure Path is correct. I found error of not proper path while configuring it and i solved that.
I have already tested using this commands. : php artisan cache:clear --- php artisan route:cache --- php artisan config:cache --- php artisan view:clear
Any help are appreciated. Thanks in advance.
I have few controllers in my zf2 project which work perfectly in the browser using apache and via command line.
However, I recently installed MongoDb so I can store some data using the driver found in (http://php.net/manual/en/set.mongodb.php)
My issue is, when I try to access the driver via controller + browser, I get the following message error in my apache logs :
PHP Fatal error: Class 'MongoDb\Driver\Manager' not found.
'MongoDb\Driver\Manager' is the namespace for this Driver.
If I execute some other controllers via command line, MongoDb works correctly.
Does anyone know why is this happening? I cannot see the issue :(
Thank you
I found that my php.ini was pointing to mongo.so instead of mongodb.so
That fixed the issue
http://php.net/manual/en/mongodb.installation.manual.php
Thank you for your help
I have a problem with an SQLite3 database where I can access it either with the sqlite3 command or with the PHPStorm built-in database manager but the application I am working on doesn't find the tables in it. It correctly connects to the database it seems.
This line of PHP causes the PDOException:
$query = "SELECT * FROM users";
$results = self::$app->db->query($query);
And the exception is simply SQLSTATE[HY000]: General error: 1 no such table: users. I am using the Slim framework, by the way.
I don't really know what to do as I am new to Slim as well as SQLite.
Thank you for your help :-)
The database that you have opened does not contain this table.
SQLite will happily open any file name; if it does not exist, it will create a new, empty database.
Check your database file name.
Thanks to the accepted answer that pointed me in the right direction.
I am using Symfony 4.1 and realized that the base directory for Symfony is the public directory (should be app in 2.8) so to open my database I had to do :
# file: PROJECT_ROOT/.env
DATABASE_URL="sqlite:///../my_super.db"
But then, every call to doctrine in a command (like doctrine:schema:update) must be called in a direct subfolder of the project, like so:
PROJECT_ROOT/bin$ ./console doctrine:schema:update --dump-sql
I'm trying to bake my models, controllers and views using 'cake bake'.I entered default when it promp for database configuration. Then the command prompt displays an error message saying
Database connection "My sql" is missing or could not be created.
I have edit the path to environment variables as follow;
;C:\wamp\bin\php\php5.4.3;C:\wamp\www\fit or fat\lib\Cake\Console;
I have no idea what about what I should do.
Open the CakePHP site in your browser and go to Documentation / Book / Getting Started/ CakePHP Database Configuration. You'll find an explanation on what file you need to edit to provide your database credentials.