Imagick not found via CMD only? - php

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

Related

Install MySQLi and pgsql extensions on PHP 7.0.7

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.

The mbstring extension is missing Windows AMPPS

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

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.

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.

Wamp + Pdo Mysql could not find driver

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.

Categories