-1

I installed Apache 2.4.9 with PHP 5.4.30 and MySQL 5.7 working perfectly. When I was trying to run phpMyAdmin 4.2.5 I had an error

Fatal error: Call to undefined function mb_detect_encoding()

I uncommented mbstring in php.ini, restarted the server, computer, my wife and my dog. The result was the same:

undefined function mb_detect_encoding()

I reinstalled PHP to 5.3.28 version. No way. I reinstalled phpMyAdmin to 3.5.6 version (that is working well on my old computer). Now I have:

phpMyAdmin - Error

The mysqli extension is missing. Please check your PHP configuration.

Configuration File (php.ini) Path   C:\WINDOWS
Loaded Configuration File   (none)

Resolved: In httpd.config file the root was set with a backslash like PHPIniDir "C:\php\" instead of normal slash like PHPIniDir "C:/php/"

  • To see the list of loaded modules/extensions go to the command line and type X:> php -m. Do you see the extensions mysqli and mbstring? – Andreas Jul 06 '14 at 14:58
  • OK, i can see that these 2 extensions that you mention are in fact loaded. Try writing a small script with a call to a function in the mb_* family of functions and a call to mysql_* function and see the error log for details – Andreas Jul 06 '14 at 15:16
  • @andreas Those extensions are from the CLI PHP and not the Apahce web server module of PHP. Two 100% different things. – Giacomo1968 Jul 06 '14 at 15:20
  • 1
    Call `phpinfo()` and check the top section for what `php.ini` file is _actually_ being used – most likely you edited the wrong one. – CBroe Jul 06 '14 at 15:24
  • .php file not found. But when i run index.php with inside everything goes well – Sergey Frolov Jul 06 '14 at 15:28
  • phpinfo() I have this "-without-mssql" in Configure Command section. Can it be the problem? – Sergey Frolov Jul 06 '14 at 15:36
  • @Jake. I think that the php.ini used is the same for cli and the apache module. – Andreas Jul 06 '14 at 15:40
  • Sorry, I don't understand what "php.ini used is the same for cli and the apache module" means :) – Sergey Frolov Jul 06 '14 at 15:47
  • "Zend Multibyte Support disabled" can be a problem for mbstring? – Sergey Frolov Jul 06 '14 at 15:49
  • @andreas “ I think that the php.ini used is the same for cli and the apache module.” 100% no. For example on a Linux system the CLI has the `php.ini` here `/etc/php5/cli/php.ini` and the Apache module here `/etc/php5/apache2/php.ini`. The CLI PHP has 1,000,000% nothing to do with the Apache PHP module. Two different things. – Giacomo1968 Jul 06 '14 at 15:49
  • @andreas Here, read up on it: http://stackoverflow.com/questions/3871768/2-php-ini-files – Giacomo1968 Jul 06 '14 at 15:51
  • when I tried to connect to database I had "Fatal error: Call to undefined function mysql_connect() in C:\Apache\Apache24\htdocs\pma_test.php" error :( – Sergey Frolov Jul 06 '14 at 15:55
  • @SergeyFrolov You are probably editing the incorrect `php.ini` file. Look at my answer. It shows you how to find the correct `php.ini` file to edit for the Apache PHP module. – Giacomo1968 Jul 06 '14 at 15:57
  • in Configure Command section I have this: "--without-mssql" can it be a problem and, if it is, how can I fix it? – Sergey Frolov Jul 06 '14 at 16:14
  • @SergeyFrolov `--without-mssql` has to do with MS SQL not MySQL. Also, you seem to be all over the map. So please attempt to focus more & see if you can unravel the issue. – Giacomo1968 Jul 06 '14 at 16:23
  • @Jake. Thanks for the ref. but i think he is on windows – Andreas Jul 06 '14 at 18:36
  • @andreas It doesn't matter if you are on Windows, Mac or Linux. The PHP from the command line is 100% different from the PHP module in Apache. – Giacomo1968 Jul 06 '14 at 18:38
  • OK then, my bad. I knew about linux but i thought that on windows there is a single php.ini file – Andreas Jul 06 '14 at 18:40

1 Answers1

1

You say this:

I uncommented mbstring in php.ini

Then you say you ran this in the command line:

C:\php>php -m

Okay, first the second thing: Running php in the command line is not the same as running it as a module in Apache. Two 100% different things. So knowing that, are you sure you are editing the correct php.ini file?

To get a real feel for what your Apache PHP module is set to do, create a file called phpinfo.php in your web root and place the phpinfo command in it like this:

<?php

phpinfo();

?>

Then load that via a web browser. You should get a full list of what is installed & how PHP is configured. In the case of your php.ini, look for the line that says Loaded Configuration File which will tell you exactly which php.ini file is being loaded by the Apache PHP module. Below is a screenshot of my phpinfo output on MAMP running on Mac OS X; it looks similar on whatever system you run the command on.

enter image description here

Giacomo1968
  • 25,759
  • 11
  • 71
  • 103
  • Loaded Configuration File "C:\Windows\php.ini ". But in C:\windows\ there is no php.ini file. I copied php.ini file from my php dyrectory to C:\windows, but it doesn't help. How can I change Loaded Configuration File's path? – Sergey Frolov Jul 06 '14 at 16:27
  • @SergeyFrolov Then that is the problem. Your PHP is not loading the `php.ini` for some reason. You need to restart PHP for the `php.ini` to be picked up. If you have more issues, go read the installation instructions here. http://www.php.net/manual/en/install.windows.php But I cannot help you any further. This is too specific to your setup for any of us to solve in depth. Good luck! – Giacomo1968 Jul 06 '14 at 16:34