picocms / Pico

Pico is a stupidly simple, blazing fast, flat file CMS.
http://picocms.org/
MIT License
3.81k stars 615 forks source link

mbstring error on Debian Buster. #509

Closed kc0dxf closed 4 years ago

kc0dxf commented 4 years ago

I'm migrating to Debian Buster. I have php version 7.3 and also the php-mbstring package installed. When I try to go to a fresh pico install I get this error: Pico requires the PHP extension 'mbstring' to run

What must I do to get it to work? Thanks!

PhrozenByte commented 4 years ago

Check whether the PHP module is actually enabled. Try phpquery mbstring and use phpenmod mbstring to enable the module. Don't forget about restarting your webserver and PHP.

Even if this yields that mbstring is enabled, simply try restarting both your webserver and, if you're using php-fpm, PHP itself. If you don't know how to do this, simply restart your server in whole - it will restart the services, too.

If this doesn't work, your webserver is likely using a different PHP version than your system's default one. Try creating a phpinfo.php (file contents: <?php phpinfo();) next to Pico's index.php and check whether the mbstring extension is actually enabled. Also check the PHP version that is being used. Delete the phpinfo.php afterwards.

kc0dxf commented 4 years ago

Thanks for the help. What happened is that I upgraded Debian Stretch to Debian Buster. Stretch must have had php 7.0 and when I upgraded to Buster, php 7.3 was installed. However, Apache was still using php 7.0. I simply did the following: a2dismod php7.0 a2enmod php7.3 systemctl restart apache2

Now Pico is working fine! Thanks for the suggestions.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in two days if no further activity occurs. Thank you for your contributions! :+1:

JamesTheAwesomeDude commented 4 years ago

I had this error as well (on the UAH webpages server, which I, obviously do not have administrative access to, thus could not fix this at a system level)

My solution, which I'm noting here for posterity, was to include an mbstring polyfill

or, in a nutshell:

php ~/composer.phar create-project picocms-pico-composer ./blog
php ~/composer.phar require symfony/polyfill-mbstring -d ./blog

I have a fork created to include this require OOTB; I'm not sure how broad this use-case is, though. I'm sure there's lots of people on budget webhosts who'd love/appreciate such an inclusion. (Also, apparently some web frameworks explicitly require said administrative changes NOT to be set; this polyfill at a directory-level allows Pico to coexist on the same server as such frameworks.)