阿里云的Ubuntu18.04 服务器安装Magento2出现需要安装 ext-gd,ext-dom 等等

Posted by

安装 php7.1-gd

sudo apt-get install php7.1-gd

sun@karat:~$ sudo service apache2 restart

安装 php7.1-xml

sun@karat:~$ sudo apt-get install php7.1-xml
sudo  service apache2 restart

安装 php7.1-mbstring

sun@karat:~$ sudo apt-get install php7.1-mbstring
sun@karat:~$ sudo apt-get install php7.1-mbstring
[sudo] password for sun:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  kopano-libs libgsoap-2.8.60 libical3 libvmime1
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  php7.1-mbstring
0 upgraded, 1 newly installed, 0 to remove and 98 not upgraded.
Need to get 468 kB of archives.
After this operation, 1,510 kB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php7.1-mbstring amd64 7.1.30-1+ubuntu18.04.1+deb.sury.org+1 [468 kB]
Fetched 468 kB in 2s (233 kB/s)
Selecting previously unselected package php7.1-mbstring.
(Reading database ... 111902 files and directories currently installed.)
Preparing to unpack .../php7.1-mbstring_7.1.30-1+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.1-mbstring (7.1.30-1+ubuntu18.04.1+deb.sury.org+1) ...
Setting up php7.1-mbstring (7.1.30-1+ubuntu18.04.1+deb.sury.org+1) ...

Creating config file /etc/php/7.1/mods-available/mbstring.ini with new version
Processing triggers for libapache2-mod-php7.1 (7.1.30-1+ubuntu18.04.1+deb.sury.org+1) ...
sun@karat:~$ sudo  service apache2 restart

本文参考:
https://yq.aliyun.com/articles/697690?spm=a2c4e.11155472.0.0.127f6484EWlBaK

更改当前php的版本:

sudo update-alternatives --set php /usr/bin/php7.1
sun@karat:/var/www/html/sun/magento2Store2$ whereis php
php: /usr/bin/php7.1 /usr/bin/php /usr/bin/php7.3 /usr/lib/php /etc/php /usr/share/php7.1-common /usr/share/php7.1-zip /usr/share/php7.1-gd /usr/share/php7.3-readline /usr/share/php7.3-opcache /usr/share/php7.1-json /usr/share/php7.1-opcache /usr/share/php7.1-xml /usr/share/php7.1-mbstring /usr/share/php7.1-readline /usr/share/php7.3-common /usr/share/php7.3-mbstring /usr/share/php7.3-json /usr/share/man/man1/php.1.gz
sun@karat:/var/www/html/sun/magento2Store2$ sudo update-alternatives --set php /usr/bin/php7.1
[sudo] password for sun:
Sorry, try again.
[sudo] password for sun:
update-alternatives: using /usr/bin/php7.1 to provide /usr/bin/php (php) in manual mode

sun@karat:~$ sudo apt-get install php7.1-bcmath php7.1-mcrypt php7.1-curl php7.1-intl php7.1-soap php7.1-mysql php7.1-common libapache2-mod-php7.1