PHP mbstring doesn't work, but I set everything - php

I set in the php.ini file the mbstring, php_mbstring.dll is on its place, but php can't load the mudule. I tried everything, what I found on stackoverflow, or anywhere else, but nothing.
-php directory is located in C:\php
-php_mbstring.dll is located in C:\php\ext\php_mbstring.dll
-;extension_dir = "ext" row is outcommented, but I tried remove the semicolon, and set it to "C:\php\ext", also tried it with / signs
-extension=mbstring row has no semicolon before tried to name it to php_mbstring.dll, tried to give the whole path (C:\php\ext\php_mbstring.dll), tried it with outcommented extension_dir = "ext", tried it all the possible ways, with \ sign and / sign, but always the same failure...
-another device of mine (notebook) runs the mbstring, I copied the dll file from it, tried with that all the possibilities above, tried to download another dll file, also tortured through the ways above, but nothing. The dll file is on its place, the path is authentical, it's enabled in the php.ini, but it doesn't work...
Warning: PHP Startup: Unable to load dynamic library 'mbstring'
(tried: C:\php\ext\mbstring (A megadott modul nem található.),
C:\php\ext\php_mbstring.dll (A megadott modul nem található.)) in
Unknown on line 0
Using Atom editor and Atom live server, it outputs the following:
Listening on http://localhost:8000 Document root is
C:\Users\ferenczi\Desktop\Saját cuccok\html
programozás\Projectek\Hander at line 0, file Unknown[Mon May 17
05:40:46 2021] PHP Warning: PHP Startup: Unable to load dynamic
library 'mbstring' (tried: C:\php\ext\mbstring (A megadott modul nem
talC!lhatC3.), C:\php\ext\php_mbstring.dll (A megadott modul nem
talC!lhatC3.)) [Mon May 17 05:40:56 2021] PHP 7.4.12 Development
Server (http://localhost:8000) started
Everything else working perfect. PHP working, SQL queries working, mysql extension working.

The right way is to install php-mbstring package and let it enable the mbstring extension automatically:
sudo apt-get install php-mbstring
if you want to enable or diable, please go with the below command
sudo phpdismod mbstring # disable mbstring extension
sudo phpenmod mbstring # enable mbstring extension
Try this!

Related

PHP extension dir on Ubuntu

I've just installed the imagick PHP extension following this script: https://gist.github.com/rostockahoi/1d53a2efb8863d72d5f1acb94ae940d1
The install went fine. I found the imagick.so file in /usr/lib/php/20180731 directory. And my php.ini files (fpm and cli) have the extension=imagick.so at the end.
I've restarted PHP and nginx.
Though, PHP cannot find the extension. Look at this CLI test :
$ php -i
$ PHP Warning: PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/lib/php/20170718/imagick.so (/usr/lib/php/20170718/imagick.so: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/imagick.so.so (/usr/lib/php/20170718/imagick.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP is looking for extensions in this directory /usr/lib/php/20170718/
This dir exists but the imagick.so is not in it.
On the other hand, as said before, there is also the directory /usr/lib/php/20180731/ with the imagick.so file in it.
I guess I have to tell PHP to look into the 20180731 dir instead of the 20170718.
How can I do that ?
Or should I copy manually the imagick.so file into 20170718 ? That does not seem optimal...
thanks !
Maybe you should try this php-config --extension-dir
If php-config doesn't exist, then apt-get install php-config
That command will give exact location of your php extension folder.
Don't forget to change your php.ini in order to use extensions.
I finally used another single command to install imagick and everything is fine.
sudo apt-get install php-imagick
The imagick.so has been installed in all /usr/lib/php/YYYYMMDD/ directories.
Much simpler !

PHP Startup : Unable to load dynamic library PGSQL

I'am trying to run Symfony 3.x with :
Ubuntu 16.04
PHP 7.0
NGinx
I would like to interact with my PGSQL database that I created but I get this error :
PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib/php/20151012/php_pdo_pgsql.dll' -
/usr/lib/php/20151012/php_pdo_pgsql.dll: cannot open shared object
file: No such file or directory in Unknown on line 0
[Doctrine\DBAL\Exception\DriverException] An
exception occured in driver: could not find driver
[Doctrine\DBAL\Driver\PDOException] could not find driver
[PDOException] could not find driver
So I looked at my phpinfo() and it seems that pgsql driver is enabled
Can anyone help me on this one ?
You must properly install the PostgreSQL module and enable it. http://php.net/manual/en/pgsql.installation.php
P.S. do not use '.dll' files on the servers with UNIX based OS, because these extensions are compiled for the Windows operating system (for UNIX based OS you must use '.so' files).
I had a very similar issue:
I fixed it by applying the same patch as for this subject:
pdo_parse_params error in pdo_odbc.so whenever PHP starts in Fedora 20
In a nutshell: if a module has already been loaded by the /etc/php/7.2/mods-available/<module>.ini (or equivalent path for your OS), then the module should not be uncommented (= made active) in the php.ini files. (two of them, cli and server).
You may ensure this, by checking phpinfo(), and observe how pdo_pgsql is still active in there, despite the line being commented in php.ini!
For me, none of the above solutions worked. Uncommenting extension=pgsql in php.ini also didn't work in and of itself.
It seemed as if postgresql wasn't installed even though I had installed it on my Ubuntu using
sudo apt-get install postgresql-12
Finally, I realized I had to install:
sudo apt-get install php-pgsql
I had a similar problem and (after installing the PHP pg driver) I had to add two files to /etc/php.d
20-pgsql.ini
extension=pgsql.so
30-pdo-pgsql.ini
extension=pdo_pgsql.so
Putting these extension config lines in the php.ini kept giving me the pdo_parse_params error
The only solution that seemed to work for me was to comment out extension=pdo_pgsql and extension=pgsql inside /etc/php8.1/cli/php.ini by adding ; in front of the them:
;extension=pdo_pgsql
;extension=pgsql
This is for PHP version 8.1

Can' get PHP SOAP enabled

I think I have installed SOAP using:
yum install php-soap
However, when I use the following command:
php -i | grep -i soap
I get this error message:
PHP Warning: PHP Start-up: Unable to load dynamic library
'/usr/local/lib/php/extensions/php_soap.dll' - /usr/local/lib/php/extensions/php_soap.dll: cannot open shared object file: No such file or directory in Unknown on line 0
When I try to install SOAP again, it says it's installed already. In my php.ini file I have uncommitted the line:
extension=php_soap.dll
What am I still missing?
Thanks!
EDIT
Found my .so file with: "find / -name soap.so" (at root)
Then placed that path in my php.ini file.
If you check this answer you might find your clue
how-to-enable-soap-on-centos
You should point to some soap.so library. DLLs are usually on windows. Check your libraries path /usr/local/lib/php/extensions and see if any soap.so library is to be found there

PHP Warning: Unable to load dynamic library

Ok I have PHP working on my mac os x Apache 2 server.
Problem I am having is it can't seem to find the extensions that allow me to connect to an sqlite database.
extension = php_sqlite.dll
extension = php_pdo_sqlite.dll
extension = php_sqlite3.dll
I get this error now that I have uncommented these extensions..
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20090626/php_sqlite3.dll' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20090626/php_sqlite3.dll, 9): image not found in Unknown on line 0
It is the same error for all 3.
Now I have read in different places on the internet it could be that they aren't installed on my mac, but I can't find the PHP directory or anywhere where they would be!
I'm very new to this so any help would be grand
Disco
The DLL extension you've enabled are actually for Windows. On Mac and other *nix platforms, they're actually SO files.
I'm on a Mac as well as it appears that the SQLite modules are already loaded. You should be able to comment out those lines in your php.ini file, restart Apache and use SQLite without having to do anything. The SQLite modules have been included for as long as I can remember.
If it's really not included, you'll have to compile the modules from source. That requires that you install the Apple Developer Tools.
To compile from scratch (from the command line):
Download the PHP's source code. You'll need to download the one that matches the version already installed on your system. To find out which one you're using, type php -v from the command line.
Extract the archive you downloaded using tar -zxvf followed by the filename.
Type cd php-5.3.x/ext/sqlite3/ (where "5.3.x" should be replaced with your version number and "sqlite3" can be any of the modules you want to install from your list above minus the "php_" prefix).
Type phpize.
Type ./configure.
Type make.
Type sudo make install.
Add extension=sqlite3.so to your php.ini (again make sure to replace sqlite3.so with the name of the other extensions if you compile the others).
Finally, restart Apache and you should be done.
Open php.ini. Look for the line that defines the location of your extensions. In my case (Windows machine), it goes like this:
extension_dir = "C:\xampp\php\ext"
This gives you the location where all your extensions are located. Open it and check whether your SQLite extensions are indeed there.
Also, make sure your extensions are actually meant for a Mac computer. Their filename extension should be "dylib" or maybe "so" (not sure - I don't have a Mac), while "dll" is a Windows-specific dynamic library filename extension (AFAIK).
Try removing and then reinstalling the packages:
brew rm mcrypt
brew install mcrypt

PHP Startup: Unable to load dynamic library, Windows, Apache 2.2, php 5.2.11

This is becoming a very frustrating issue. I am trying to do a clean install of apache 2.2 and PHP 5.2.11. Everything seems to be configured correctly but the php modules aren't starting...
PHP Warning: PHP Startup: Unable to load dynamic library '.;C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/ext/php_mcrypt.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '.;C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/ext/php_mysql.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '.;C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/ext/php_openssl.dll' - The specified module could not be found.\r\n in Unknown on line 0
in the php.ini
include_path = ".;C:\Program Files (x86)\Apache Software Foundation\Apache2.2\php"
extension_dir = ".;C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/ext/"
All the files are there... The .dll files such as ssleay32.dll, libmcrypt.dll, libmysql.dll, libeay32.dll are all installed at...
C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/
I also included them in the C:\Windows\System32
and even added C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/ to the windows path.
I have no idea why this isn't working and it feels like a no win situation. Anyone have any ideas on how to get this all working ok?
Try this:
extension_dir = "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/ext/"
without starting with the .;
You just uncomment the extension_dir in php.ini
Just for my future self if no-else. This is with PHP 5.2.13 running in Windows on IIS 8.
I got the following error:
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files (x86)\PHP\ext\php_openssl.dll' - The specified module could not be found.
From phpinfo() the loaded php.ini file was C:\Program Files (x86)\PHP\php.ini.
The extension directory:
extension_dir ="C:\Program Files (x86)\PHP\ext"
These were the last two lines of the php.ini file:
[PHP_SQLSRV]
extension=php_sqlsrv_52_nts_vc6.dll
[PHP_OPENSSL]
extension=php_openssl.dll
The php_openssl.dll and php_sqlsrv_52_nts_vc6.dll files are in the ext directory. The php_openssl.dll isn't corrupt (it's the same file size as one on another machine that's working).
PHP will find the sqlsrv dll but not the openssl dll. No idea why. No amounts of IIS restarting did anything.
The solution until I know better was to install the openssl.dll extension using the Windows PHP installer. You can re-run the installer and select 'Change' and it allows you to add or remove libraries. I can't see any difference in the file or the php.ini file now, but now the file loads.
I suspect actually that my problem was similar to this comment about OpenSSL installation on Windows:
At this point, when you start Apache it will attempt to load php_openssl.dll, but if your setup is anything like mine you will see an error. I prefer to start Apache manually, and the error appears in a dialog box: "The ordinal 4114 could not be located in the dynamic link library LIBEAY32.dll". (I'm not sure whether you would get this message if you started Apache as a service). The Apache log also contains an error message saying that php_openssl.dll cannot be loaded, though that message doesn't name libeay32.dll. Welcome to DLL Hell.
Libeay32.dll enters the picture because php_openssl.dll depends on it (and also on ssleay32.dll). What I think happens is that Apache first tries to load php_openssl.dll programmatically from the path specified by the extension_dir key. But then, the loading of the so-called dependent DLLs is left to Windows' default mechanism. If Windows finds an incompatible version of a dependent DLL, you get the error.
I noticed errors about ssleay32.dll when trying to run php -i from the command line. I just assumed that it didn't have it in the environment. IIS made no mention of any ssleay32.dll errors in its logs.
Had same errors, but instead of copying files added php folder to system path and restated the server.
Windows 8.1 have a bib problem with system PATH names what cannot editable with the general editor because this line is too long......and for PHP module extension good loading must to define PHP path in the system enviroments.
ONLY one thing helped for me:
https://rix0rrr.github.io/WindowsPathEditor/

Categories