While learning Facebook SDK for PHP I overlooked one of system requirements preventing my code from running on my host. That is The mbstring extension.
Interactive mode enabled
php > echo extension_loaded('mbstring');
php >exit
root@ubuntu001:~# apt-cache search php7 | grep mbstring
php7.0-mbstring - MBSTRING module for PHP
root@ubuntu001:~#
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0
libjpeg-turbo8 libjpeg8 libmcrypt4 libtiff5 libvpx3 libxpm4
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
libapache2-mod-php7.0 php7.0-cli php7.0-common php7.0-dev php7.0-fpm
php7.0-json php7.0-mysql php7.0-opcache php7.0-readline php7.0-xml
The following NEW packages will be installed:
php7.0-mbstring
The following packages will be upgraded:
libapache2-mod-php7.0 php7.0-cli php7.0-common php7.0-dev php7.0-fpm
php7.0-json php7.0-mysql php7.0-opcache php7.0-readline php7.0-xml
10 upgraded, 1 newly installed, 0 to remove and 99 not upgraded.
Need to get 5,797 kB of archives.
After this operation, 1,497 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 php7.0-mysql amd64 7.0.8-0ubuntu0.16.04.3 [124 kB]
Get:2 http://mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 php7.0-xml amd64 7.0.8-0ubuntu0.16.04.3 [112 kB]
Get:3 http://mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 php7.0-json amd64 7.0.8-0ubuntu0.16.04.3 [16.8 kB]
Get:4 http://mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 php7.0-opcache amd64 7.0.8-0ubuntu0.16.04.3 [75.9 kB]
Get:5 http://mirrors.digitalocean.com/ubuntu xenial-updates/universe amd64 php7.0-fpm amd64 7.0.8-0ubuntu0.16.04.3 [1,287 kB]
Get:6 http://mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 php7.0-readline amd64 7.0.8-0ubuntu0.16.04.3 [12.8 kB]
Get:7 http://mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 php7.0-dev amd64 7.0.8-0ubuntu0.16.04.3 [379 kB]
Get:8 http://mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 php7.0-cli amd64 7.0.8-0ubuntu0.16.04.3 [1,279 kB]
Get:9 http://mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 libapache2-mod-php7.0 amd64 7.0.8-0ubuntu0.16.04.3 [1,224 kB]
Get:10 http://mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 php7.0-common amd64 7.0.8-0ubuntu0.16.04.3 [822 kB]
Get:11 http://mirrors.digitalocean.com/ubuntu xenial-updates/universe amd64 php7.0-mbstring amd64 7.0.8-0ubuntu0.16.04.3 [463 kB]
Fetched 5,797 kB in 0s (22.3 MB/s)
(Reading database ... 87692 files and directories currently installed.)
Preparing to unpack .../php7.0-mysql_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-mysql (7.0.8-0ubuntu0.16.04.3) over (7.0.8-0ubuntu0.16.04.2) ...
Preparing to unpack .../php7.0-xml_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-xml (7.0.8-0ubuntu0.16.04.3) over (7.0.8-0ubuntu0.16.04.2) ...
Preparing to unpack .../php7.0-json_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-json (7.0.8-0ubuntu0.16.04.3) over (7.0.8-0ubuntu0.16.04.2) ...
Preparing to unpack .../php7.0-opcache_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-opcache (7.0.8-0ubuntu0.16.04.3) over (7.0.8-0ubuntu0.16.04.2) ...
Preparing to unpack .../php7.0-fpm_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-fpm (7.0.8-0ubuntu0.16.04.3) over (7.0.8-0ubuntu0.16.04.2) ...
Preparing to unpack .../php7.0-readline_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-readline (7.0.8-0ubuntu0.16.04.3) over (7.0.8-0ubuntu0.16.04.2) ...
Preparing to unpack .../php7.0-dev_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-dev (7.0.8-0ubuntu0.16.04.3) over (7.0.8-0ubuntu0.16.04.2) ...
Preparing to unpack .../php7.0-cli_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-cli (7.0.8-0ubuntu0.16.04.3) over (7.0.8-0ubuntu0.16.04.2) ...
Preparing to unpack .../libapache2-mod-php7.0_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking libapache2-mod-php7.0 (7.0.8-0ubuntu0.16.04.3) over (7.0.8-0ubuntu0.16.04.2) ...
Preparing to unpack .../php7.0-common_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-common (7.0.8-0ubuntu0.16.04.3) over (7.0.8-0ubuntu0.16.04.2) ...
Selecting previously unselected package php7.0-mbstring.
Preparing to unpack .../php7.0-mbstring_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-mbstring (7.0.8-0ubuntu0.16.04.3) ...
Processing triggers for systemd (229-4ubuntu7) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up php7.0-common (7.0.8-0ubuntu0.16.04.3) ...
Setting up php7.0-mysql (7.0.8-0ubuntu0.16.04.3) ...
Setting up php7.0-xml (7.0.8-0ubuntu0.16.04.3) ...
Setting up php7.0-json (7.0.8-0ubuntu0.16.04.3) ...
Setting up php7.0-opcache (7.0.8-0ubuntu0.16.04.3) ...
Setting up php7.0-readline (7.0.8-0ubuntu0.16.04.3) ...
Setting up php7.0-cli (7.0.8-0ubuntu0.16.04.3) ...
Setting up php7.0-fpm (7.0.8-0ubuntu0.16.04.3) ...
Setting up php7.0-dev (7.0.8-0ubuntu0.16.04.3) ...
Setting up libapache2-mod-php7.0 (7.0.8-0ubuntu0.16.04.3) ...
apache2_invoke php7.0: already enabled
Setting up php7.0-mbstring (7.0.8-0ubuntu0.16.04.3) ...
Creating config file /etc/php/7.0/mods-available/mbstring.ini with new version
Processing triggers for libapache2-mod-php7.0 (7.0.8-0ubuntu0.16.04.3) ...
Processing triggers for php7.0-fpm (7.0.8-0ubuntu0.16.04.3) ...
root@ubuntu001:~#
Interactive mode enabled
php > echo extension_loaded('mbstring');
1
php>exit
root@ubuntu001:~#
Uncomment the following line in php.ini file
extension=php_mbstring.dll
Facebook SDK for PHP's system requirements |
Check if mbstring is enabled
root@ubuntu001:~# php -aInteractive mode enabled
php > echo extension_loaded('mbstring');
php >exit
root@ubuntu001:~# apt-cache search php7 | grep mbstring
php7.0-mbstring - MBSTRING module for PHP
root@ubuntu001:~#
Install php7.0-mbstring
root@ubuntu001:~# apt-get install php7.0-mbstringReading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0
libjpeg-turbo8 libjpeg8 libmcrypt4 libtiff5 libvpx3 libxpm4
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
libapache2-mod-php7.0 php7.0-cli php7.0-common php7.0-dev php7.0-fpm
php7.0-json php7.0-mysql php7.0-opcache php7.0-readline php7.0-xml
The following NEW packages will be installed:
php7.0-mbstring
The following packages will be upgraded:
libapache2-mod-php7.0 php7.0-cli php7.0-common php7.0-dev php7.0-fpm
php7.0-json php7.0-mysql php7.0-opcache php7.0-readline php7.0-xml
10 upgraded, 1 newly installed, 0 to remove and 99 not upgraded.
Need to get 5,797 kB of archives.
After this operation, 1,497 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 php7.0-mysql amd64 7.0.8-0ubuntu0.16.04.3 [124 kB]
Get:2 http://mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 php7.0-xml amd64 7.0.8-0ubuntu0.16.04.3 [112 kB]
Get:3 http://mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 php7.0-json amd64 7.0.8-0ubuntu0.16.04.3 [16.8 kB]
Get:4 http://mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 php7.0-opcache amd64 7.0.8-0ubuntu0.16.04.3 [75.9 kB]
Get:5 http://mirrors.digitalocean.com/ubuntu xenial-updates/universe amd64 php7.0-fpm amd64 7.0.8-0ubuntu0.16.04.3 [1,287 kB]
Get:6 http://mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 php7.0-readline amd64 7.0.8-0ubuntu0.16.04.3 [12.8 kB]
Get:7 http://mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 php7.0-dev amd64 7.0.8-0ubuntu0.16.04.3 [379 kB]
Get:8 http://mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 php7.0-cli amd64 7.0.8-0ubuntu0.16.04.3 [1,279 kB]
Get:9 http://mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 libapache2-mod-php7.0 amd64 7.0.8-0ubuntu0.16.04.3 [1,224 kB]
Get:10 http://mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 php7.0-common amd64 7.0.8-0ubuntu0.16.04.3 [822 kB]
Get:11 http://mirrors.digitalocean.com/ubuntu xenial-updates/universe amd64 php7.0-mbstring amd64 7.0.8-0ubuntu0.16.04.3 [463 kB]
Fetched 5,797 kB in 0s (22.3 MB/s)
(Reading database ... 87692 files and directories currently installed.)
Preparing to unpack .../php7.0-mysql_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-mysql (7.0.8-0ubuntu0.16.04.3) over (7.0.8-0ubuntu0.16.04.2) ...
Preparing to unpack .../php7.0-xml_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-xml (7.0.8-0ubuntu0.16.04.3) over (7.0.8-0ubuntu0.16.04.2) ...
Preparing to unpack .../php7.0-json_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-json (7.0.8-0ubuntu0.16.04.3) over (7.0.8-0ubuntu0.16.04.2) ...
Preparing to unpack .../php7.0-opcache_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-opcache (7.0.8-0ubuntu0.16.04.3) over (7.0.8-0ubuntu0.16.04.2) ...
Preparing to unpack .../php7.0-fpm_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-fpm (7.0.8-0ubuntu0.16.04.3) over (7.0.8-0ubuntu0.16.04.2) ...
Preparing to unpack .../php7.0-readline_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-readline (7.0.8-0ubuntu0.16.04.3) over (7.0.8-0ubuntu0.16.04.2) ...
Preparing to unpack .../php7.0-dev_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-dev (7.0.8-0ubuntu0.16.04.3) over (7.0.8-0ubuntu0.16.04.2) ...
Preparing to unpack .../php7.0-cli_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-cli (7.0.8-0ubuntu0.16.04.3) over (7.0.8-0ubuntu0.16.04.2) ...
Preparing to unpack .../libapache2-mod-php7.0_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking libapache2-mod-php7.0 (7.0.8-0ubuntu0.16.04.3) over (7.0.8-0ubuntu0.16.04.2) ...
Preparing to unpack .../php7.0-common_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-common (7.0.8-0ubuntu0.16.04.3) over (7.0.8-0ubuntu0.16.04.2) ...
Selecting previously unselected package php7.0-mbstring.
Preparing to unpack .../php7.0-mbstring_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-mbstring (7.0.8-0ubuntu0.16.04.3) ...
Processing triggers for systemd (229-4ubuntu7) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up php7.0-common (7.0.8-0ubuntu0.16.04.3) ...
Setting up php7.0-mysql (7.0.8-0ubuntu0.16.04.3) ...
Setting up php7.0-xml (7.0.8-0ubuntu0.16.04.3) ...
Setting up php7.0-json (7.0.8-0ubuntu0.16.04.3) ...
Setting up php7.0-opcache (7.0.8-0ubuntu0.16.04.3) ...
Setting up php7.0-readline (7.0.8-0ubuntu0.16.04.3) ...
Setting up php7.0-cli (7.0.8-0ubuntu0.16.04.3) ...
Setting up php7.0-fpm (7.0.8-0ubuntu0.16.04.3) ...
Setting up php7.0-dev (7.0.8-0ubuntu0.16.04.3) ...
Setting up libapache2-mod-php7.0 (7.0.8-0ubuntu0.16.04.3) ...
apache2_invoke php7.0: already enabled
Setting up php7.0-mbstring (7.0.8-0ubuntu0.16.04.3) ...
Creating config file /etc/php/7.0/mods-available/mbstring.ini with new version
Processing triggers for libapache2-mod-php7.0 (7.0.8-0ubuntu0.16.04.3) ...
Processing triggers for php7.0-fpm (7.0.8-0ubuntu0.16.04.3) ...
root@ubuntu001:~#
Check if mbstring is enabled
root@ubuntu001:~# php -aInteractive mode enabled
php > echo extension_loaded('mbstring');
1
php>exit
root@ubuntu001:~#
On Microsoft Windows Operating System
Edit php.ini (C:\Program Files\PHP\v7.0\php.ini)Uncomment the following line in php.ini file
extension=php_mbstring.dll
Check with phpinfo();
Check if php_mbstring extension is enabled with phpinfo(); |