Fatal error: Call to undefined function mb_internal_encoding () in /home/blabla/blabla.php on line 2

When I run a php script over ssh like:

php /home/blabla/blabla.php

      

He says:

Fatal error: Call to undefined function mb_internal_encoding() in /home/blabla/blabla.php on line 2

      

but when I run it over a browser like http://blabla.com/blabla.php it works.

I have already installed mbstringwith ( --enable-mbstring

) and is activated in php.ini(otherwise it cannot work with the browser either)

mbstring

Multibyte Support   enabled
Multibyte string engine libmbfl
HTTP input encoding translation disabled
libmbfl version 1.3.2

      

What is the reason for this situation?

Why is it giving that error when I want to run php over ssh?

+3


source to share


2 answers


Not strange that it works through a web server, but not from the command line. Both can use different config files very well.

You can put <? phpinfo(); ?>

in a .php file and run the same php file through webserver and CLI to understand better. Then you can double check the config file and make sure the extension is enabled.



Another alternative (but drastic) is PHP and Apache rebuilding.

+1


source


Place phpinfo();

in a .php file and run it on the server.

If "Multibyte Zend Support" is disabled:



  • Go to PHP php.ini configuration file
    • On Ubuntu they will be located in "/ etc / php / {php version} /apache2/php.ini"
      (for example, "/etc/php/7.0/apache2/php.ini")
  • Set: zend.multibyte = On

  • Reboot the server.
    • On Ubuntu run the shell command: sudo service apache2 restart

0


source







All Articles