Hello
I’m learning to program PHP for the first time, and I’m using a great book called: “PHP & MYSQL NOVICE TO NINJA” written by Kevin Yank.
I have an error and I can’t get around it.
In chapter 4 he introduces a PDO class as a way to connect to a MySql database, but I get an error message that reads:
“Unable to connect to the database server. could not find driver”
Just in case, I downloaded XAMPP version 3.0.12 compiled on June 24, 2012
I’m running Apache and MySql from the XAMPP Control Panel.
They are not installed as services.
I would appreciate any help on this matter.
Thanks
Thanks for your prompt reply.
This is a partial copy of the php.ini file:
Windows Extensions
; Note that ODBC support is built in, so no dll is needed for it.
; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)
; extension folders as well as the separate PECL DLL download (PHP 5).
; Be sure to appropriately set the extension_dir directive.
extension=php_bz2.dll
;extension=php_curl.dll
extension=php_mbstring.dll
extension=php_exif.dll
;extension=php_fileinfo.dll
extension=php_gd2.dll
extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_intl.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
;extension=php_mssql.dll
;extension=php_mbstring.dll
;extension=php_exif.dll ; Must be after mbstring as it depends on it
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll ; Use with Oracle 10gR2 Instant Client
;extension=php_oci8_11g.dll ; Use with Oracle 11gR2 Instant Client
;extension=php_openssl.dll
;extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
;extension=php_pdo_sqlite_external.dll
;extension=php_pgsql.dll
;extension=php_pspell.dll
;extension=php_shmop.dll
But when I check the phpinfo.php there is a section “Configure Commands” ( fifth row from the top )
That states the following details:
cscript /nologo configure.js “–enable-snapshot-build” “–disable-isapi” “–enable-debug-pack” “–without-mssql” “–without-pdo-mssql” “–without-pi3web” “–with-pdo-oci=C:\php-sdk\oracle\instantclient10\sdk,shared” “–with-oci8=C:\php-sdk\oracle\instantclient10\sdk,shared” “–with-oci8-11g=C:\php-sdk\oracle\instantclient11\sdk,shared” “–enable-object-out-dir=…/obj/” “–enable-com-dotnet” “–with-mcrypt=static” “–disable-static-analyze” “–with-pgo”
What does that mean?
On php.ini the pdo is activated, but in the phpinfo() it shows as “without-mysql” and “without-pdp-mysql”
As an addition to my last message, I have to add that in the PDO section of the phpinfo(), it shows that the pdo is enabled for mysql and sqlite.
I’m stuck…
How embarrased I am…!!
Thank you cpradio for pointing this out…
Just after correcting this typo, another error appear.
Something like there is an error with the UTF-8…
But I removed the “-” and leave it at UTF8, and I got the "Database connection established! "