Reputation: 109
When I run a php script over ssh like:
php /home/blabla/blabla.php
it says:
Fatal error: Call to undefined function mb_internal_encoding() in /home/blabla/blabla.php on line 2
but when I run it over browser like http://blabla.com/blabla.php it works.
I already installed mbstring using (--enable-mbstring
) and it is activated in php.ini (otherwise it cannot work over browser too)
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 does it give that error when I want to run my php over ssh ?
Upvotes: 4
Views: 12498
Reputation: 1
Put phpinfo();
in a .php file and run it on the server.
If 'Zend Multibyte Support' is disabled:
zend.multibyte = On
sudo service apache2 restart
Upvotes: 0
Reputation: 3541
It isn't that strange that it is working through the webserver but not from the command line. The two could very well be using different config files.
You can put <? phpinfo(); ?>
in a .php file and run the same php file through both the webserver and the CLI to get a better understanding. Then you could double check the config file and make sure extension is enabled.
Another alternative (yet drastic) would be rebuilding PHP and Apache.
Upvotes: 1