My php.ini extentions section is like as follows
; 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_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_mbstring.dll
;extension=php_exif.dll ; Must be after mbstring as it depends on it
extension=php_mysqli.dll
;extension=php_oci8_12c.dll ; Use with Oracle Database 12c 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_pgsql.dll
;extension=php_shmop.dll
; The MIBS data available in the PHP distribution must be installed.
; See http://www.php.net/manual/en/snmp.installation.php
;extension=php_snmp.dll
;extension=php_soap.dll
;extension=php_sockets.dll
;extension=php_sqlite3.dll
;extension=php_tidy.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
I'm using PhpStorm to host PHP.
Whenever I try to run the function i get this:
Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in **archive** Stack trace: #0 {main} thrown in **archive**
And my code looks like follows:
<?php
$con = mysqli_connect("localhost","root","","aula") or die(mysqli_error($con));
mysqli_query($con, 'SET NAMES utf8') or die(mysqli_error($con));
On the second line I already get the error. How can I install the extensions?
Thanks in advance.
Please make sure both extension=php_mysql.dll and extension=php_mysqli.dll are uncommented in php.in, mysqli is the "improved" MySQL library but that does not necessarily mean it replaces the mysql library entirely.
Also please make sure you set right php PATH environment variable.
change from
extension_dir = "ext"
to
extension_dir = "C:\Apache24\php\ext"
(Working on windows)
I was facing exactly the same issue.
In my case, the problem was that I had saved the php.ini file as a text file. As soon as I converted the text file to "All Files" in notepad and gave it the ".ini" extension, it became a "Configuration Settings File" and it worked.
You may check if this is the case by going through the loaded configuration file row in phpinfo(). If the value is 'none', you may be facing a similar issue.
Note: I had already uncommented the extensions and fixed the extension directory.
Related
I am running the AMPPS stack on Windows 10. I have been trying to get the configurations changed in php.ini while moving a Drupal site to my local environment. However, in the process I seem to have broken something. phppMyAdmin gives the following error:
The mbstring extension is missing. Please check your PHP
configuration.
When I check the php.ini, the extension is enabled:
extension_dir = "C:\Program Files (x86)\Ampps\php-5.3\ext"
extension=php_bz2.dll
extension=php_curl.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_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_pgsql.dll
;extension=php_pspell.dll
;extension=php_shmop.dll
; The MIBS data available in the PHP distribution must be installed.
; See http://www.php.net/manual/en/snmp.installation.php
;extension=php_snmp.dll
extension=php_soap.dll
;extension=php_sockets.dll
extension=php_sqlite3.dll
;extension=php_tidy.dll
extension=php_xmlrpc.dll
;extension=php_xsl.dll
extension=php_com_dotnet.dll
extension=php_mongo.dll
What could be going wrong? Do I have a wrong extension directory selected?
You should check the phpinfo() for web and run php -m command for CLI if you don't see the extension in these pages then you should check the php.ini directory in the phpinfo page and alter that file.
This code in a e.g. phpinfo.php file will show you the php info page:
<?php phpinfo(); ?>
I am migrating a Drupal site to local environment. Currently I get the following error when I refresh the browser:
Fatal error: Undefined class constant 'MYSQL_ATTR_USE_BUFFERED_QUERY'
I have read that it may be a problem with pdo_mysql extension. However, mine seems to be installed and enabled. What else could it be?
Here is the relevant excerpt from the php.ini file:
extension_dir = C:/Program Files (x86)/Ampps/php/ext
extension=php_sqlsrv_55_ts.dll
extension=php_pdo_sqlsrv_55_ts.dll
extension=php_bz2.dll
extension=php_curl.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_mbstring.dll
;extension=php_exif.dll ; Must be after mbstring as it depends on it
extension=php_mysql.dll
extension=php_mysqli.dl
extension=php_mssql.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_pgsql.dll
;extension=php_pspell.dll
;extension=php_shmop.dll
; The MIBS data available in the PHP distribution must be installed.
; See http://www.php.net/manual/en/snmp.installation.php
;extension=php_snmp.dll
extension=php_soap.dll
;extension=php_sockets.dll
extension=php_sqlite3.dll
;extension=php_tidy.dll
extension=php_xmlrpc.dll
;extension=php_xsl.dll
extension=php_com_dotnet.dll
extension=php_mongo.dll
I was able to fix this by moving my AMPPS stack directory to C:/
It appears that having it in Program Files (x86) causes some naming problems with Apache and PHP configurations because of spaces in the name of the directory.
There are plenty of windows imagic headaches around the web.
I did find the right combination of everything and it got working.
However
when i start php from command line it spits out a warning:
Warning: PHP Startup: Unable to load dynamic library 'c:\xampp\php\ext\php_imagick.dll' - The specified procedure could not be found.
in Unknown on line 0
How can the damn thing work, use the files that are verified to be there and have an apache server running based on them files, but throw a failure at launch?
Here is the relevant php.ini section should you need to look it over:
(should you have no idea how to make it find it - is there a way to disable the startup warning and error popups that it throws at me, they break my cmd scripts.)
extension_dir="c:\xampp\php\ext"
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
; If you wish to have an extension loaded automatically, use the following
; syntax:
;
; extension=modulename.extension
;
; For example, on Windows:
;
; extension=msql.dll
;
; ... or under UNIX:
;
; extension=msql.so
;
; ... or with a path:
;
; extension=/path/to/extension/msql.so
;
; If you only provide the name of the extension, PHP will look for it in its
; default extension directory.
;
; 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
; The MIBS data available in the PHP distribution must be installed.
; See http://www.php.net/manual/en/snmp.installation.php
;extension=php_snmp.dll
extension=php_soap.dll
extension=php_sockets.dll
extension=php_sqlite3.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
extension=php_xmlrpc.dll
extension=php_xsl.dll
extension=php_mongo.dll
extension=php_imagick.dll
Apparently the Imagic CORE_RL_*.DLLs have a pathing problem.
The full setup i was using was calling them from their config location but should you just start an unrelated php via cmd it failed to find them:
To solve it copy all your core dlls from your imagick install dir allover the place namingly to:
Your php main dir
Your \xampp\apache\bin
(2. Is should you be using xampp or apache obviously.)
recently i install the Wamp last version in my local computer. Before that i used php in Windows 7 - IIS 7.5. I used PDO mysql and it workd just fine.
try {
$db = new PDO("mysql:host=localhost;dbname=aaa;charset=utf8", "root", "root");
} catch ( PDOException $e ){
print $e->getMessage();
}
But when i pass the iss to the wamp, Pdo_mysql not worked. When i visit my db page, it giving error 'could not find driver'. I searched in google but i cant figure this out.
Extensions
extension=php_bz2.dll
extension=php_curl.dll
extension=php_com_dotnet.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_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_pgsql.dll
extension=php_shmop.dll
phpinfo()
Please check if you are editing on php.ini in the apache servers bin folder (e.g: \apache2.4.18\bin) If you are editing the php.ini in your php folder those changes will not work. Please check your php.ini in your apache\bin to see if you have extension=php_mysql.dll and don't forget to restart the services.
If you get this error while you can still see it enabled in php.ini then WAMP is responsible for this issue.
I suggest you to use XAMPP instead.
I'm running Apache 2.4.7 with PHP 5.5.9 on Windows 8. I installed PHPUnit and this warning image "warning" started to pop up.
Yes I enabled extension loading in php.ini as well as "extension_dir" to correct folder and there is file named "php_pdo_oci.dll" in that folder.
I tried to use different apache and php releases, but it didn't help.
Any suggestions how to fix this?
The ..._oci.dll is part of the Oracle C Interface. Unless you need to use Oracle, I suggest you go to the relevant line inside the php.ini file and uncomment the loading of this extension. However, if you need to use this extension, you’ll need to install the free Oracle Client libraries and add them to the path.
Oracle has a page where you can download the libraries needed for your setup work as expected and you can see here:
Oracle Instant Client Downloads
Note: After you choose your operational system (Windows as in your answer) in download section you will see the installation guide in foot notes of the next page. For others OSs this process will work the same way.
I currently have PHP version 7.1.9 and encountered this problem and resolved the issue. Just ensure these lines in your php.ini file are uncommented like so:
extension=php_fileinfo.dll
extension=php_ftp.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_mbstring.dll
extension=php_exif.dll ; Must be after mbstring as it depends on it
extension=php_mysqli.dll
extension=php_oci8_12c.dll ; Use with Oracle Database 12c 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_pgsql.dll
extension=php_shmop.dll
Please restart your server application (IIS, Apache e.t.c.) after any changes to your php.ini file.
Please add below line in php.ini file
extension=pdo.so
extension=php_pdo.dll
extension=php_pdo_oci.dll
extension=php_pdo_oci8.dll
and restart apache server and check.