The mbstring extension is missing Windows AMPPS - php

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(); ?>

Related

Drupal Site Migration Undefined class constant 'MYSQL_ATTR_USE_BUFFERED_QUERY'

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.

Imagick not found via CMD only?

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.)

The mysqli|mysql extension is missing

I cannot find a way to solve this. I have done pretty much everything I can think of, I am kind of new to this stuff, so sometimes I am not sure I am doing it right. I have xampp and am trying to use phpmyadmin to work with databases. I have added the extensions:
extension=php_bz2.dll
extension=php_curl.dll
extension=php_mbstring.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=mysqli.so
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
What am I doing wrong?
Strange, because php comes with the mysqli extension as part of it's core extensions.
1 - Make sure the file php_mysqli.dll exists in:
drive:\xamp_install_dir\bin\php\php<phpversion>\ext\
if so, copy the following line to your php.ini
extension=php_mysqli.dll
2 - Restart apache, and create a file named test.php with the following content:
<?php
echo phpinfo();
?>
3 - Open it on your browser a search for :
4 - Found it?
Yes: Good, you're ready to go.
No: You may need to re-install wamp
NOTE:
Don't worry about php_mysql.dll because it's deprecated.

file_put_contents & file_get_contents damages my image

The code is trivial;
$url = 'https://fbcdn-sphotos-d-a.akamaihd.net/hphotos-ak-ash4/s720x720/417959_454038631356352_2061694564_n.jpg';
file_put_contents($path, file_get_contents($url));
This results in the following image being written;
Note how it is "damaged" compared to the original.
This is a new PHP installation on my Windows 8 Dev machine. My extensions are enabled as follows;
extension=php_bz2.dll
extension=php_curl.dll
;extension=php_dba.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_mbstring.dll
;extension=php_ming.dll
;extension=php_mssql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll
;extension=php_oci8_11g.dll
extension=php_openssl.dll
;extension=php_pdo_firebird.dll
;extension=php_pdo_mssql.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_phar.dll
;extension=php_pspell.dll
;extension=php_shmop.dll
;extension=php_snmp.dll
;extension=php_soap.dll
;extension=php_sockets.dll
;extension=php_sqlite.dll
;extension=php_sqlite3.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
;extension=php_zip.dll
Of note, I've enabled openssl for HTTPs support, and curl. allow_url_fopen is enabled (although of course, it wouldn't have got even this far if this wasn't the case).
Does anyone know what can cause this sort of damage to my images?
It works fine on my Windows 8 Dev machine + ZendServer 6 PHP 5.4.11
Probably You have some problems in Your PHP instalation/configuration. I recommend reinstall PHP.

PHP Configuration : PDO extension is enabled but not loading

I'm using Windows 7, wamp server version 2.2, PHP version 5.2.9. When I try to run my magento websites on a localhost it gives me the following error:
"The PDO extension is required for this adapter but the extension is not loaded"
I have double check that PDO extensions are enabled in the php.ini file.
;extension=php_bz2.dll
extension=php_curl.dll
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_exif.dll
;extension=php_fdf.dll
extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_ifx.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
extension=php_mbstring.dll
extension=php_mcrypt.dll
;extension=php_mhash.dll
;extension=php_mime_magic.dll
;extension=php_ming.dll
;extension=php_msql.dll
;extension=php_mssql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll
;extension=php_openssl.dll
extension=php_pdo.dll
;extension=php_pdo_firebird.dll
;extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_oci8.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
;extension=php_snmp.dll
extension=php_soap.dll
;extension=php_sockets.dll
;extension=php_sqlite.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
;extension=php_zip.dll
Also the phpinfo loading the right php.ini file. It was working earlier but suddenly start to give the error. I also checked the Apche error log but didn't find any clue.
Please suggest.
First move the extension directory to \Windows\System32\inetsrv{php}\extension
Change the path from php.ini file
I think you have a security problem to loading .dll! Try this and let me know the result.
To find out which php.ini file has been loaded, try the following ( run in commandline and webserver to make sure which edition loading different environment).
Checking the php.ini file path :
<?php
$path = php_ini_loaded_file();
echo 'The loaded file path is :' . $path;
?>

Categories