Ubuntu安装php

php安装
1:
sudo apt-get install python-software-properties
2:
sudo apt-get install libfcgi0ldbl
3:
apt install php7.2 php7.2-common php7.2-cli php7.2-fpm

4:安装扩展

sudo apt-get install -y php7.2-fpm php7.2-cli \
    php7.2-pgsql php7.2-sqlite3 php7.2-gd \
    php7.2-curl php7.2-memcached \
    php7.2-imap php7.2-mysql php7.2-mbstring \
    php7.2-xml php7.2-zip php7.2-bcmath php7.2-soap \
    php7.2-intl php7.2-readline php7.2-imagick php7.2-redis php-msgpack php-igbinary

5: 服务配置
sudo vi /etc/systemd/system/php-fpm.service
粘贴下面的配置保存

[Unit]
Description=The PHP 7.2 FastCGI Process Manager
Documentation=man:php-fpm7.2(8)
After=network.target

[Service]
Type=notify
PIDFile=/run/php/php7.2-fpm.pid
ExecStart=/usr/sbin/php-fpm7.2 --nodaemonize --fpm-config /etc/php/7.2/fpm/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID

[Install]
WantedBy=multi-user.target

依次执行控制命令
systemctl reload php-fpm

systemctl enable php-fpm.service

systemctl is-enabled php-fpm.service

systemctl start php-fpm

systemctl status php-fpm
出现如下提示,即成功

● php-fpm.service - The PHP 7.2 FastCGI Process Manager
   Loaded: loaded (/etc/systemd/system/php-fpm.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2018-08-13 18:10:09 HKT; 7s ago
     Docs: man:php-fpm7.2(8)
 Main PID: 20584 (php-fpm7.2)
   Status: "Processes active: 0, idle: 2, Requests: 1, slow: 0, Traffic: 0.1req/sec"
    Tasks: 0
   Memory: 328.0K
      CPU: 42ms
   CGroup: /system.slice/php-fpm.service
           ‣ 20584 php-fpm: master process (/etc/php/7.2/fpm/php-fpm.conf)

你可能感兴趣的:(环境搭建)