Maison  >  Article  >  développement back-end  >  Introduction à l'installation Linux de php7.3

Introduction à l'installation Linux de php7.3

coldplay.xixi
coldplay.xixiavant
2021-01-21 09:44:511802parcourir

Introduction à l'installation Linux de php7.3

Recommandé (gratuit) : PHP7

Veuillez d'abord installer les packages de dépendances

$ yum install -y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers

Télécharger php-7.3.0

wget http://cn2.php.net/get/php-7.3.0.tar.gz/from/this/mirror -o php-7.3.0

Décompressez

$ tar -zxvf php-7.3.0.tar.gz
$ cd php-7.3.0

Configurez

./configure \
--prefix=/usr/local/php \
--exec-prefix=/usr/local/php \
--bindir=/usr/local/php/bin \
--sbindir=/usr/local/php/sbin \
--includedir=/usr/local/php/include \
--libdir=/usr/local/php/lib/php \
--mandir=/usr/local/php/php/man \
--with-config-file-path=/usr/local/php/etc \
--with-openssl \
--enable-mbstring \
--enable-fpm

Compilez et installez

$ make && make install

Le code source compilé avant Dans le package, recherchez php.ini-production, copiez-le dans /usr/local/php/etc, et renommez-le en php.ini :

$ cp php.ini-production /usr/local/php/etc/php.ini

Copiez le fichier sapi/fpm/init.d.php-fpm dans le code source php. répertoire de compilation au système Configurez le répertoire /etc/init.d et renommez-le en php-fpm

[root@localhost php-7.3.0]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm 
[root@localhost php-7.3.0]# chmod +x /etc/init.d/php-fpm

Ajoutez le fichier de configuration php-fpm
Copiez le fichier /usr/local/php/etc/php-fpm.conf.default dans le répertoire d'installation de php dans le même répertoire et renommez-le en php-fpm.conf

[root@localhost php-7.3.0]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

Ajoutez le fichier de configuration www.conf
Copiez le fichier /usr/local/php/etc/php-fpm.d/www.conf.default dans le répertoire d'installation de php dans le même répertoire et renommez-le en www.conf

[root@localhost php-7.3.0]# cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf

Ajoutez le répertoire d'installation de php à la variable d'environnement système
Créez et ouvrez le fichier php.sh

[root@localhost php-7.3.0]# vim /etc/profile.d/php.sh

Ajoutez le contenu suivant :

export PATH=$PATH:/usr/local/php/bin/:/usr/local/php/sbin/

Enregistrez et quittez

:wq!

Utilisez la source pour prendre effet immédiatement. La variable d'environnement php que vous venez d'ajouter

[root@localhost php-7.3.0]# source /etc/profile.d/php.sh

Démarrez php-fpm

[root@localhost php-7.3.0]# service php-fpm start

C'est réussi lorsque vous voyez le port 9000 ! ! !

Définissez php pour qu'il démarre au démarrage

修改系统配置目录下的 php-fpm 文件可执行权限 
[root@localhost php-src-php-7.1.6]# chmod +x /etc/init.d/php-fpm
> 将系统配置目录下的 `php-fpm` 添加到 `系统服务`
[root@localhost php-src-php-7.1.6]# chkconfig --add php-fpm

> 设置 `php-fpm` `系统服务` 为开机启动
[root@localhost php-src-php-7.1.6]# chkconfig php-fpm on

Après le redémarrage, vérifiez le port pour voir s'il existe !

Succès ! ! !

Ce qui précède est le contenu détaillé de. pour plus d'informations, suivez d'autres articles connexes sur le site Web de PHP en chinois!

Déclaration:
Cet article est reproduit dans:. en cas de violation, veuillez contacter admin@php.cn Supprimer