im on ubuntu12.10 using xampp 1.8.1
i was working on a symfony2 project on a windows machine and im currently working on same project from ubuntu machine.
the problem is when i run commands like
php app/console doctrine:schema:update
it gives error
PDO exception:could not find driver
whereas i checked my phpinfo and pdo_mysql is enabled.also there are many select and insert queries in my project which are working fine.
also when i run php -m it shows only PDO and not pdo_mysql
is something wrong with the enviornment variable or something like that?
Its possible that the pdo_mysql extension is not enabled in your php CLI ini file.
Check your ini file for the pdo_mysql extension, you can get your ini file location from php --ini. On ubuntu it should output a list of all loaded ini files, look for
/etc/php5/cli/conf.d/pdo_mysql.ini
and
/etc/php5/cli/conf.d/pdo.ini
If either of these two ini files are not listed, then you haven't installed that extension. If they are present, then make sure they extension is enabled inside those ini files.
Make sure you enable the extensions php_pdo_mysql and php_pdo on php.ini file that your symfony project is using, check this on localhost/path_to_your_project/web/config.php
Tip: check out you Apache error log, there could be something wrong with the load of your extensions. This file is located according to your server configuration.
Related
I'm installing PHP, Apache and PostgreSQL Manually
PHP and Apache now is connected, but PostgreSQL is not connected to PHP.
i test by using phpinfo();
i also configure in php.ini like this :
extension=php_pgsql.dll
extension=php_pdo_pgsql.dll
But why it's not work.
Thanks
This tutorial worked for me:
The PHP extension will look for libpq.dll which is found of your
PostgreSQL installation. The simple fix is to add the path than
contains that file to your environment PATH.
I had the same issue with PHP7 and Apache 2.4 on Windows 10. For me the solution was to add the following line to httpd.conf;
LoadFile "C:/php7/libpq.dll"
This also means that it's not required to have PostgreSQL installed if you just want to connect a PostgreSQL database that's not running on your machine.
1) Installing PostgreSQL for Windows
2) add to your enviroment variable "PATH" the bin folder of PostgreSQL installation:
C:\Program Files\PostgreSQL\9.2\bin; (for example)
Assuming you have installed PostgreSQL and your WAMP installation is on c:\wamp, you will need to copy
c:\wamp\bin\php\php5.3.9\libpq.dll to c:\wamp\bin\apache\Apache2.2.11\bin
Make sure you also have the following files
C:\wamp\bin\php\php5.3.9\ext\php_pdo_pgsql.dll and
C:\wamp\bin\php\php5.3.9\ext\php_pgsql.dll
Also, make sure you have enabled the above 2 files as extensions, either via the WAMP menu (click on WAMP icon on taskbar, PHP, PHPExtensions, find the above 2 and 'check' them)
Please note that php5.3.9 and Apache2.2.11 refer to my specific PHP and Apache versions.
Adjust those to suit your installation.
That's it!
This worked for me on Windows:
Found php.ini in php folder.
Found this line and removed “;”.
;extension=php_pgsql.dll
in my case there are 2 php.ini, I had to uncomment extension pdo_pgsql in both php.ini
in php folder
in apache folder
both inside in wamp folder
If you are using PHP in IIS, using PHP Manager, enable this extension:
php_pgsql.dll
Was trying to play with symfony2. If I hit the web/config.php of my symfony2 installation it shows me the following problems
Install and enable the mbstring extension.
Install and enable the intl extension (used for validators).
Install and enable a PHP accelerator like APC (highly recommended).
Install PDO drivers (mandatory for Doctrine).
I can understand that these are not mandatory ones but question is I fixed these in my php.ini file but still cant see any reflection in this page. Here is how I fixed the above problems
extension=php_intl.dll
extension=php_mbstring.dll
extension=php_pdo_mysql.dll
Didnt install anything for APC so no complain with that. Restarted apache server "thousand" times, but no luck.
Side Note:
I tried to figure out something from phpinfo(). I can see one discrepancy. The phpinfo is showing one of my old php directory path F:\Softwares\Development\PHP\php-5.5.13-x64. This path used to exist in my system PATH variable earlier. But I myself remove this location from System PATH variable. But it is still visible in phpinfo(). But if I print the PATH variable from command prompt or cygwin console, it shows the correct PATH variable.
Also ran php app/check.php. It shows everything OK except the APC, which is completely fine for me. But it also shows that "PHP CLI can use a different php.ini file than the one used with your web server".
Environment Details:
OS: Windows 7
php: php-5.4.30-Win32-VC9-x86
Apache: Win32-2.4.9 VC9
MySQL: mysql-5.6.19-winx64
Not using any xampp/wampp etc.
Few more hear left on my head. Please help.
Make sure that you have these extensions in your ext directory, if not search and put it in the directory (for windows extension file type must be .dll).
APC https://www.dropbox.com/s/hmnrgle8xing3fo/php_apc.dll
INTL https://www.dropbox.com/s/wm14zk0grc6pm6v/php_intl.dll (you also need ICU lib)
mbstring https://www.dropbox.com/s/wm14zk0grc6pm6v/php_intl.dll
PDO mysql https://www.dropbox.com/s/hd5cm02oti8qw3s/php_pdo_mysql.dll
Also, don't forget to restart apache after changes in php.ini
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
I followed the manual, I mpved the php_mongo.dll into the PHP extension folder,
and added extension=php_mongo.dll to the php.ini file and it's given me an error when I try and you rockmango that "To make things right, you must install php_mongo module. Here for installation documents on PHP.net." but I have alread done this any solutions? I am running the lattest version of PHP and mongodb
Check php --ini shows the correct config file being used.
Check php -i (phpinfo) and make sure the module is actually loaded.
Double check you have the right flavour of the module for your version of PHP. (VC6, VC8, VC9, TS, NTS, etc.)
I got my mongo module (1.2.9) for PHP 5.4 32bit on windows from stealth35. It works like a charm.
Often there are multiple PHP locations with different php.ini files.
If you are worried about working in mod_php (through apache) or as a fastcgi then create a file with the following contents.
<?php phpinfo();
Then visit that file in a browser. It will have all the settings and modules listed that are currently being loaded. It will also tell you which php.ini file and modules directory being used.
Please make sure that the ini listed is the one you added mongo dll line.
I am having apache 2.2.14, php 5.3.1 and mysql 5.1.43 installed on vista. I am trying since 2 days to configure php to have mysql enable on phpinfo().
I modified php.ini to have extension_dir = "c:\php\ext"
modified the extension as extension="php_mysql.dll"
added "c:\php" to the "PATH" environment variable and restarted the vista.
after trying many combinations of putting php.ini, php_mysql.dll and libmysql.dll in c drive and/or c:/windows and/or c:/windows/system32 now I am with no options!!
I do restart the apache after each modification. I used libmysql.dll present in mysql installation and that of older php version as php 5.3.1 has no libmysql.dll...
Any help will be appreciated.
Thanks in advance.
You have to edit php.ini and add/uncomment a line to import the php_mysql.dll extention. Search for ;extention=php_mysql.dll and remove the ;. If you find this line without the ; in front of it, you have another problem. If you don't find this line, add it without the ;.
You can also try to put a \ after the extention path: extension_dir="c:\php\ext\"
put php_mysql.dll in the "c:\php\ext" directory (and keep the extension="php_mysql.dll" uncommented [without the leading ;])
Make sure you've edited the right php.ini. In case of doubt
<?php echo 'ini= "', get_cfg_var('cfg_file_path'), '"';
will tell you which one is used by your php installation.
Maybe php tried to load the php-mysql extension and failed because of additional dependencies. That would cause a startup error entry in the error.log.
Which php-build do you use? The php-mysql extension can either use libmysql.dll as transport layer or the new mysqlnd (MySQL native driver) module. You've added c:\php to PATH. That's usually done in order to let windows find libmysql.dll (though it's not necessary, there are other methods which I prefer). If php-mysql depends on libmysql.dll and windows can't find it loading php_mysql.dll will fail.
But if you're using the php.net build of php 5.3.1 the mysql module uses mysqlnd:
Installation on Windows
In the official PHP distributions from 5.3 onwards, MySQL Native Driver is enabled by defaultThis module is built-in in the php.net build. You can test that by calling php -m in a command shell. It prints all built-in modules.
Thanks a lot to the user who said that we have to move the file php.ini to the folder /bin of the Apache server. it resolves me the same problem after more than one week of trying failed methods.
Of course we must uncomment in the file the two lines;
;extension=php_mysql.dll
;extensin_dir="ext"
by removing the semi-colon (;) and by specifying the full path for the extension library php_mysql.dll rather than ext as follows
extension=php_mysql.dll
extensin_dir="c:\Apache22\php53\ext"
For me I installed Apache in the folder c:\Apache22 and PHP in the folder c:\Apache22\php53, you must use your own values.
NOTE: Because mysql_ functions like mysql_connect() become deprecated in PHP 5.5 and above, it is recommended to enable also the library php_mysqli.dll to use functions like mysqli_ (improved version of mysql_ functions). To do that it is simple, you just have to uncomment the line:
;extension=php_mysqli.dll
in the file PHP.ini as follows:
extension=php_mysqli.dll
Update April 7, 2013. Installed Windows 8 on an i7 Quad, HT 8, 3.62GHz, 12GBRAM.. Installed the latest version of MySQL, got it functioning properly. Installed the latest version of Apache Web Server, got it functioning properly. Installed the latest version of PHP, got it functioning properly. MySQL could not connect to the database. The error message was "mysql_connect function undefined". I copied the modified php.ini file into the "C:\Program Files (x86)\Apache Software Foundation\Apache2.2\bin", and restarted Apache web server... then it all magically started working.!!! I hope this helps somebody with setting up their own Windows MySQL / PHP web server.