I am having issues getting my database to build from my YAML file.
Here is the error:
./scripts/doctrine-cli build-all-load
build-all-load - Generated models successfully from YAML schema
build-all-load - Couldn't locate driver named mysql
build-all-load - Created tables successfully
build-all-load - Data was successfully loaded
It builds my models, but nothing in the database. I am using MAMP and I have checked and pdo_mysql is running. I am not completely sure why this would happen. Thank you.
This quite looks like pdo_mysql is not enabled ; you said you checked php.ini, but did you check the one that's used when PHP is run from the command line ?
(That's often not the same as the one used when PHP is run as an Apache module)
You can use php -m to get the list of loaded extensions :
$ php -m
[PHP Modules]
bcmath
bz2
...
pcre
PDO
pdo_mysql
...
And php -i should indicate which .ini file is used, when running PHP from the CLI :
$ php -i | grep 'ini'
Configuration File (php.ini) Path => /etc/php5/cli
Loaded Configuration File => /etc/php5/cli/php.ini
Scan this dir for additional .ini files => /etc/php5/cli/conf.d
additional .ini files parsed => /etc/php5/cli/conf.d/apc.ini,
/etc/php5/cli/conf.d/curl.ini,
...
Related
I'm using Ubuntu LTS 14.04 operating system and I'm trying to test my PHP scripts in the PHP CLI, but wherever my code attempts to connect to MySQL, with commands such as...
$mysqli = mysqli_connect($host,$user,$password,$database);
...,I get the following error:
Fatal error: Call to undefined function mysqli_connect()...
I've reviewed /etc/php5/cli/php.ini AND /etc/php5/apache2/php.ini and have found no difference.
I think that I must enable mysqli support for the command line interface (CLI), but I am uncertain.
How can I correct the error without affecting my current Apache php.ini/configuration/installation?
EDIT:
Based on comments, I ran the following command in terminal:
php --ini
Which displays:
Configuration File (php.ini) Path: /usr/local/lib
Loaded Configuration File: (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
Then, I copied /etc/php5/cli/php.ini to /usr/local/lib/php.ini.
Then, I ran php --ini again, which displays:
Configuration File (php.ini) Path: /usr/local/lib
Loaded Configuration File: /usr/local/lib/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
Then, I ran the PHP script from PHP CLI again, and the same error displayed.
Call to undefined function mysqli_connect()
Means the mysqli exension is not loaded.
I've reviewed /etc/php5/cli/php.ini AND /etc/php5/apache2/php.ini and have found no difference.
I would be very surprised if they were same. But in both cases, these are likely to be structured to work with extesnions distributed via packages - i.e. the ini file containing the directive to load the mysqli so extension will likely reside elsewhere and be included (or not) from these files.
Configuration File (php.ini) Path: /usr/local/lib
You have a Frankenstein system. You need to clean this up. Either use the distro's packaged apps or install apps from tarball. Don't use tarballs unless you know what you're doing. Don't mix and match unless you really know what you are doing.
Delete the tarball PHP files
reinstall the Ubuntu PHP cli
reinstall the Ubuntu PHP mysqli extension
test.php:
if (!extension_loaded('mysqli')) {
dl('mysqli.so');
}
in cli,run it:
php test.php
os output:
Warning: dl(): Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20131226/mysqli' - /usr/local/lib/php/extensions/no-debug-non-zts-20131226/mysqli: cannot open shared object file: No such file or directory in test.php
you can find and copy mysqli.so from any where, for example:
/usr/local/lib/php/extensions/no-debug-non-zts-20131226$ sudo cp /usr/lib/php5/20131226/mysqli.so ./mysqli.so
Hello I'm using latest version of Laravel, PHP 7.1.9 and MySQL 5.7.19. I'm also using WAMP stack.
When I run the command:
php artisan migrate
I get the following error:
I googled a lot and I' m 100% sure my php.ini file does not have the driver line commented out and the driver is properly working, as seen here:
The driver is obviously present:
Also the path to extension dir is absolute:
extension_dir ="c:/wamp64/bin/php/php7.1.9/ext/"
What else can I do? This thing is driving me crazy
There are 2 php.ini files in the WAMPServer implementation.
One for APACHE which is the one accessed from the menu system and one in each wamp\bin\php\phpx.y.z folder
As you are using the PHP CLI you have to check that all the required extensions are also activated in PHP you are using for the CLI wamp\bin\php\phpx.y.z
Do this from the command line
php --ini
It should show you something like this
Configuration File (php.ini) Path: C:\WINDOWS
Loaded Configuration File: C:\wamp64\bin\php\php7.0.29\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
Look at this param Loaded Configuration File: to see which php.ini file you should be checking.
This post may also be useful to you for making a batch file to run from the command prompt to switch easily from one version of PHP CLI to another from the command window How To Run PHP From Windows Command Line in WAMPServer
I have a problem where drush isn't able to connect to my drupal site with mysql. I think it's due to a module loading issue. For example, as root, I check if pdo_mysql is loaded like this:
# php -m|grep mysql
mysql
mysqli
pdo_mysql
# php -m|wc -l
55
# which php
/usr/bin/php
# php -i|grep conf
Scan this dir for additional .ini files => /etc/php5/cli/conf.d
Additional .ini files parsed => /etc/php5/cli/conf.d/curl.ini,
/etc/php5/cli/conf.d/gd.ini,
/etc/php5/cli/conf.d/ldap.ini,
/etc/php5/cli/conf.d/mysql.ini,
/etc/php5/cli/conf.d/mysqli.ini,
/etc/php5/cli/conf.d/pdo.ini,
/etc/php5/cli/conf.d/pdo_mysql.ini
But when I run this command as my user, I don't see any mysql modules:
$ php -m|grep mysql
$ php -m|wc -l
48
$ which php
/usr/bin/php
$ php -i|grep conf
Scan this dir for additional .ini files => /etc/php5/cli/conf.d
Why is this? And how do I get these modules to be loaded in php-cli as my user?
I'm using php 5.3.10 (old I know, but it's for compatibility with our production servers) on ubuntu 14.04.
I solved this by making /etc/php5 executable: chmod a+x /etc/php5.
I'm using Ubuntu LTS 14.04 operating system and I'm trying to test my PHP scripts in the PHP CLI, but wherever my code attempts to connect to MySQL, with commands such as...
$mysqli = mysqli_connect($host,$user,$password,$database);
...,I get the following error:
Fatal error: Call to undefined function mysqli_connect()...
I've reviewed /etc/php5/cli/php.ini AND /etc/php5/apache2/php.ini and have found no difference.
I think that I must enable mysqli support for the command line interface (CLI), but I am uncertain.
How can I correct the error without affecting my current Apache php.ini/configuration/installation?
EDIT:
Based on comments, I ran the following command in terminal:
php --ini
Which displays:
Configuration File (php.ini) Path: /usr/local/lib
Loaded Configuration File: (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
Then, I copied /etc/php5/cli/php.ini to /usr/local/lib/php.ini.
Then, I ran php --ini again, which displays:
Configuration File (php.ini) Path: /usr/local/lib
Loaded Configuration File: /usr/local/lib/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
Then, I ran the PHP script from PHP CLI again, and the same error displayed.
Call to undefined function mysqli_connect()
Means the mysqli exension is not loaded.
I've reviewed /etc/php5/cli/php.ini AND /etc/php5/apache2/php.ini and have found no difference.
I would be very surprised if they were same. But in both cases, these are likely to be structured to work with extesnions distributed via packages - i.e. the ini file containing the directive to load the mysqli so extension will likely reside elsewhere and be included (or not) from these files.
Configuration File (php.ini) Path: /usr/local/lib
You have a Frankenstein system. You need to clean this up. Either use the distro's packaged apps or install apps from tarball. Don't use tarballs unless you know what you're doing. Don't mix and match unless you really know what you are doing.
Delete the tarball PHP files
reinstall the Ubuntu PHP cli
reinstall the Ubuntu PHP mysqli extension
test.php:
if (!extension_loaded('mysqli')) {
dl('mysqli.so');
}
in cli,run it:
php test.php
os output:
Warning: dl(): Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20131226/mysqli' - /usr/local/lib/php/extensions/no-debug-non-zts-20131226/mysqli: cannot open shared object file: No such file or directory in test.php
you can find and copy mysqli.so from any where, for example:
/usr/local/lib/php/extensions/no-debug-non-zts-20131226$ sudo cp /usr/lib/php5/20131226/mysqli.so ./mysqli.so
I've just learnt how to compile php modules and things but I'm unsure of something.
My OS X comes with php 5.4.17 and it seems to have various extensions in it without any .sos anywhere (pdo_sqlite, pdo_mysql, curl etc)
If I compile php --with-extension, is that extension then built into the php binaries without need for adding in php? Or something similar.
E.g. I compiled pdo_sqlite and pdo_mysql and it warned that I was trying to include them twice. I unincluded them from php.ini and checked phpinfo() and they were already enabled and nowhere on my system.
I can only assume that the configure command put them in the binaries.
Is this right?
check your phpinfo() output page, whether you have this:
Scan this dir for additional .ini files
Additional .ini files parsed
most probably pdo_sqlite and pdo_mysql are already defined in the Additional .ini files parsed
after running ./configure --with-extension, run grep Configured config.log, you will see the actual configure options used
--with-extension enables the specified extension in your custom php build.
For example
--with-apx2=/usr/local/apache2/bin/apxs
enables apache2 server installed at location /usr/local/apache2/bin/apxs