Enable mbstring library for PHP Windows installation - php

Using php 8.20 X86 Win32 VS16 not thread safe
In PHP.ini I have
extension=mbstring
(i.e. uncommented ";" in front)
and
extension_dir = "D:\webserve\php8X86Win32VS16NTS\ext"
In file system I have:
file php_mbstring.dll
in:
directory D:\webserve\php8X86Win32VS16NTS\ext
...
PHPInfo()
states it is using the php.ini file I have edited.
extension direct is "ext" (which it is if if I use fully qualitfied
path in php.ini)
...
Yet I still get error in code:
Uncaught Error: Call to undefined function Stichoza\GoogleTranslate\Tokens\mb_strlen()
...
What is the next thing I should check in my configuration to get multibyte string support working in PHP?

Related

Edit php.ini File to include extension for mysqli

So, I'm trying to use a table in a php program and I got a fatal error (class mysqli not found) which after researching on stackoverflow means I don't have extension=php_mysqli.dll enabled (here's the php-website which talks about enabling it: http://php.net/manual/en/install.windows.extensions.php.)
But I looked in my php.ini file and the sort of ";extension=..." lines that it talks about commenting aren't there (I did ctrl + f to search through as well as manually searching through). I tried just adding the "extension=php_mysqli.dll" line but it still didn't work.
Someone else also said you need to uncomment the extension_dir line in php.ini and specify my location but that line only appears in an if loop in php.ini and it's not commented out. (from this stackoverflow question: Fatal error: Class 'MySQLi' not found).
How do I add "extension=php_mysqli.dll" to my php.ini file so my php program can create a mysqli table?
If you don't have mysqli extension in you php version you should download another version of PHP.
http://windows.php.net/download/
Get PHP 7 OR PHP 5.6 last version (thread safe recommended).
After, following the instructions on this page http://php.net/manual/en/install.windows.extensions.php to activate mysqli extension.
;extension=php_exif.dll
extension=php_mysqli.dll // Uncomment this line
;extension=php_oci8_12c.dll
You can define the path of your php extensions folder if you have problems.
To do this, uncomment line extension_dir.
extension_dir = "C:\php\ext" // Your ext folder path
Restart your apache / nginx and try to use mysqli functions.
Hope this will can help you.
In my case, I had the extension=mysqli set in my php.ini and the php_mysqli.dll file in the php/ext folder, I just had to uncomment (remove the ;) the extension_dir line in php.ini:
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
;extension_dir = "./"
; On windows:
extension_dir = "ext"
Save php.ini and restart php and the webserver.

PHP Fatal error: Call to undefined function exif_imagetype()

I got a photo competition that seems to work fine but when I upload a photo I get a blank screen. I checked the error log and found this:
PHP Fatal error: Call to undefined function exif_imagetype() in /home/fbtabvhk/public_html/pinkdrive_selfie/contest/libs/upload/save.php on line 27
This is the code on line 27:
if (exif_imagetype($_FILES['files']['tmp_name'][0]) === FALSE)
You have to have the exif extension compiled and enabled for this function to work. This extension has good chances to be already compiled in your PHP installation, so you might just have to enable it in your php.ini:
On Linux:
extension=exif.so
On Windows:
extension=php_exif.dll
Note for Windows:
Windows users must enable both the php_mbstring.dll and php_exif.dll DLL's in php.ini.
The php_mbstring.dll DLL must be loaded before the php_exif.dll DLL so
adjust your php.ini accordingly.
Try to enable your php.ini and restart server.
extension=php_exif.dll

Fatal error: Call to undefined function mb_detect_encoding() in windows

I have the following error when try to install phpmyadmin in 4.0.4 on PHP version 5.4. I am running Apache 2.2 on My Windows 7. I can run . My php is installed in c:\php. I have add the following line in php.ini but no lucks.
extension=php_gd2.dll
extension=php_mbstring.dll
extension=php_exif.dll
And also this line in php.ini
--enable-mbstring=all
Fatal error: Call to undefined function mb_detect_encoding() in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\phpMyAdmin\libraries\php-gettext\gettext.inc on line 177
I checked the phpinfo() page but it does not show that mbstring is enabled. But I did
extension=php_mbstring.dll
So why the mbstring is not started?
Thanks.
what can I do to fix it?
Thanks
in php 5.5.8 and the php.ini file find the part called Windows Extensions and be sure that the extension php_mbstring.dll is uncomment (remove semi-colon at first) and be sure to appropriately set the extension_dir directive.
Check to make sure your php.ini file is in the correct directory. By default the path should be C:\Windows\php.ini. You can find out what it's looking for using phpinfo().

Windows, NetBeans: Where's the php.ini?

I have been away from PHP for quite a while, so hopefully this is a simple oversight. But, I am not able to include the MySQL extension.
Setup
Windows 8 Pro 64-bit
NetBeans 7.2.1 (Built-in PHP Web Server)
MySQL
PHP 5.4.8
Problem
Fatal error: Call to undefined function mysql_connect()
Attempted Resolution
Copy php.ini-development to php.ini (files are where I installed PHP, E:\Software\php-5.4.8-Win32-VC9-x86)
Edit php.ini by uncommenting the lines
extension_dir = "ext"
extension=php_mysqli.dll
Added E:\Software\php-5.4.8-Win32-VC9-x86\ext to NetBeans PHP Include Path in Project Properties
Still fails with the same error
Diagnostic Output
Added a call to phpinfo() at the top of the page. That indicates:
Configuration File (php.ini) Path C:\Windows
However, there is no php.ini in C:\Windows. In fact, I searched all disks and found only the one php.ini file that I previously edited.
Question
Where is NetBeans / PHP pulling the configuration from when I run my project, and how can I edit that configuration?
Restart the web server/netbeans :-)
If there's no php.ini file listed as being loaded by phpinfo() then there is not one. PHP will use default values for everything in this case. Anything that needs to be overridden can be placed in a new php.ini in one of the locations specified by phpinfo() as being scanned for ini files.
From your description what you did to php.ini (excerpt):
extension=php_mysqli.dll
^
But in your question you write:
Fatal error: Call to undefined function mysql_connect()
Which is a different extension, namely on windows:
extension=php_mysql.dll
(without the i)
Probably it's just a little oversight you're missing here. You have two options then:
Port the code to mysqli_* functions (recommended for new code)
Activate the old php_mysql.dll extension (for legacy code)
Do what fit's your needs. On windows, the folloing filenames (search your disk) are interesting:
php.ini - normally inside the directory where you find php.exe
php_mysql.dll - normally inside the ext subdirectory of the just said directory.

Fatal error: Call to undefined function openssl_random_pseudo_bytes()

I am getting this exception when trying to run my PHP unit tests:
Fatal error: Call to undefined function openssl_random_pseudo_bytes()
What does it mean?
I had the same issue. I solved it by editing my php.ini file - changing ;extension=php_openssl.dll to extension=php_openssl.dll .
(For my installation, my php.ini file was located in my P:\Program Files\EasyPHP-12.1\conf_files\ directory.)
Your version of PHP wasn't compiled with the openssl module. If you are building from source, add the module like so:
cd /path/to/php-5.4/
./configure --with-openssl
It means you do not have the openssl extension enabled in your PHP install. It needs to be enabled for you to use openssl_* functions.
It means you possibly don't have openssl enabled.
If you are on windows its even easier to load it. Enable it from wamp icon on system tray.
Check your configuration php.ini:
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
;extension_dir = "./"
; On windows:
extension_dir = "ext"
extension=php_openssl.dll
Your php installation either does not have openssl enabled, or you could be running a version of php < 5.3.
To enable openssl, you must re-compile and install php with the "–with-openssl" flag. See php installation documentation
For me this error occurred because i had not configured openssl correctly for my PHP.
This is the exact step i followed to rectify this error.
https://stackoverflow.com/a/36070260/1221096

Categories