이 기사는 Alibaba Cloud centos7.6에 php7.3을 설치하는 방법에 대한 자세한 튜토리얼을 제공합니다. 필요한 친구가 참고할 수 있기를 바랍니다.
groupadd www useradd -g www www
wget "https://downloads.php.net/~cmb/php-7.3.0.tar.gz" tar xzvf php-7.3.0.tar.gz cd php-7.3.0
--with-fpm-user= www --with-fpm-group=www
www www 사용자 및 사용자 그룹
을 사용하여 컴파일된 프로그램이 이 사용자 및 사용자 그룹에 속한 여기에서 시작됩니다
./configure --prefix=/usr/local/php --with-fpm-user=www --with-fpm-group=www --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip --enable-fpm
configure: 오류: libxml2를 찾을 수 없습니다. libxml2 설치를 확인하세요.
yum install -y libxml2-devel
configure: 오류: BZip2 배포판을 다시 설치하세요
yum install -y bzip2-devel
yum install -y curl-devel
yum install -y libjpeg-devel
yum install -y libpng-devel
yum install -y freetype-devel
yum install -y libxslt-devel
yum install -y libzip-devel
#先删除旧版本 yum remove -y libzip #下载编译安装 wget https://nih.at/libzip/libzip-1.2.0.tar.gz tar -zxvf libzip-1.2.0.tar.gz cd libzip-1.2.0 ./configure make && make install
checking libzip... yes checking for the location of zlib... /usr checking for pkg-config... (cached) /usr/bin/pkg-config checking for libzip... in default path: found in /usr/local checking for zip_open in -lzip... yes checking for zip_file_set_encryption in -lzip... yes checking for zip_libzip_version in -lzip... no checking stdbool.h usability... yes checking stdbool.h presence... yes checking for stdbool.h... yes checking fts.h usability... yes checking fts.h presence... yes checking for fts.h... yes checking for int8_t... (cached) yes checking for int16_t... (cached) yes checking for int32_t... (cached) yes checking for int64_t... (cached) yes checking for uint8_t... (cached) yes checking for uint16_t... (cached) yes checking for uint32_t... (cached) yes checking for uint64_t... (cached) yes checking for ssize_t... yes checking size of short... (cached) 2 checking size of int... (cached) 4 checking size of long... (cached) 8 checking size of long long... (cached) 8 checking size of off_t... 0 configure: error: off_t undefined; check your library configuration
은 long int, 64로 프로그래밍되어 있습니다. -bit 시스템은 long long int로 컴파일됩니다.
은 컴파일할 때 기본적으로 64비트 동적 링크 라이브러리를 찾습니다.
. 그러나 기본적으로 centos의 동적 링크 라이브러리 구성 파일 /etc/ 검색 경로는 다음과 같습니다. ld.so.conf에 추가되었습니다.
이때 /usr/local/lib64 /usr/lib64 64비트 라이브러리 파일 경로를 추가해야 합니다.
#添加搜索路径到配置文件 echo '/usr/local/lib64 /usr/local/lib /usr/lib /usr/lib64'>>/etc/ld.so.conf #然后 更新配置 ldconfig -v
make && make install
usr/local/include/zip.h:59:21: 치명적인 오류: zipconf.h: 해당 파일이 없음 또는 디렉토리###
cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/zipconf.h
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/ Installing PHP CLI binary: /usr/local/php/bin/ Installing PHP CLI man page: /usr/local/php/php/man/man1/ Installing PHP FPM binary: /usr/local/php/sbin/ Installing PHP FPM defconfig: /usr/local/php/etc/ Installing PHP FPM man page: /usr/local/php/php/man/man8/ Installing PHP FPM status page: /usr/local/php/php/php/fpm/ Installing phpdbg binary: /usr/local/php/bin/ Installing phpdbg man page: /usr/local/php/php/man/man1/ Installing PHP CGI binary: /usr/local/php/bin/ Installing PHP CGI man page: /usr/local/php/php/man/man1/ Installing build environment: /usr/local/php/lib/php/build/ Installing header files: /usr/local/php/include/php/ Installing helper programs: /usr/local/php/bin/ program: phpize program: php-config Installing man pages: /usr/local/php/php/man/man1/ page: phpize.1 page: php-config.1 Installing PEAR environment: /usr/local/php/lib/php/ Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in phar:///home/flame/software/php-7.3.0/pear/install-pear-nozlib.phar/PEAR/PackageFile/v2/Validator.php on line 1933 [PEAR] Archive_Tar - installed: 1.4.3 [PEAR] Console_Getopt - installed: 1.4.1 [PEAR] Structures_Graph- installed: 1.1.1 [PEAR] XML_Util - installed: 1.4.2 [PEAR] PEAR - installed: 1.10.5 Wrote PEAR system config file at: /usr/local/php/etc/pear.conf You may want to add: /usr/local/php/lib/php to your php.ini include_path /home/flame/software/php-7.3.0/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin ln -s -f phar.phar /usr/local/php/bin/phar Installing PDO headers: /usr/local/php/include/php/ext/pdo/
cp php.ini-production /usr/local/php/lib/php.ini cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf ln -s /usr/local/php/sbin/php-fpm /usr/local/bin
cd /usr/local/php/etc/php-fpm.d vim www.conf
시작
[www] listen = 127.0.0.1:9080 listen.mode = 0666 user = www #php代码目录权限 需要跟这个一致, group = www #php代码目录权限 需要跟这个一致 pm = dynamic pm.max_children = 128 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 10000 rlimit_files = 1024 slowlog = log/$pool.log.slow
cd /home/flame/software/php-7.3.0/sapi/fpm cp php-fpm.service /usr/lib/systemd/system/
systemctl start php-fpm
Enter
#查看状态 systemctl status php-fpm #得到输出 ● php-fpm.service - The PHP FastCGI Process Manager Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled) Active: active (running) since Thu 2018-12-27 16:13:16 CST; 2s ago Main PID: 16835 (php-fpm) CGroup: /system.slice/php-fpm.service ├─16835 php-fpm: master process (/usr/local/php/etc/php-fpm.conf) ├─16836 php-fpm: pool www ├─16837 php-fpm: pool www ├─16838 php-fpm: pool www ├─16839 php-fpm: pool www ├─16840 php-fpm: pool www ├─16841 php-fpm: pool www ├─16842 php-fpm: pool www ├─16843 php-fpm: pool www ├─16844 php-fpm: pool www ├─16845 php-fpm: pool www ├─16846 php-fpm: pool www ├─16847 php-fpm: pool www ├─16848 php-fpm: pool www ├─16849 php-fpm: pool www ├─16850 php-fpm: pool www ├─16851 php-fpm: pool www ├─16852 php-fpm: pool www ├─16853 php-fpm: pool www ├─16854 php-fpm: pool www └─16855 php-fpm: pool www Dec 27 16:13:16 iZj6cas4fyg41lxhngh1z0Z systemd[1]: Started The PHP FastCGI Process Manager.
mkdir -p /home/www/webroot/php cd /home/www/webroot/php vim test.php
~
🎜#
~
~
~
O Alibaba Cloud CentOS7.6 PHP7.3
Php새 사용자 사용자 그룹
groupadd www useradd -g www www
wget "https://downloads.php.net/~cmb/php-7.3.0.tar.gz" tar xzvf php-7.3.0.tar.gz cd php-7.3.0
다운로드 php
./configure --prefix=/usr/local/php --with-fpm-user=www --with-fpm-group=www --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip --enable-fpm
그룹에서 컴파일한 프로그램이 시작되었습니다. 이 사용자 및 사용자 그룹
www 사용 www 사용자, 여기 사용자yum install -y libxml2-devel
configure: 오류: libxml2를 찾을 수 없습니다. libxml2 설치를 확인하세요.
yum install -y bzip2-devel
yum install -y curl-devel
yum install -y libjpeg-devel
yum install -y libpng-devel
yum install -y freetype-devel
yum install -y libxslt-devel
libzip 확인 중... 구성: 오류: 시스템 libzip을 버전 >= 0.11로 업그레이드해야 합니다.
yum install -y libzip-devel
#先删除旧版本 yum remove -y libzip #下载编译安装 wget https://nih.at/libzip/libzip-1.2.0.tar.gz tar -zxvf libzip-1.2.0.tar.gz cd libzip-1.2.0 ./configure make && make install
checking libzip... yes checking for the location of zlib... /usr checking for pkg-config... (cached) /usr/bin/pkg-config checking for libzip... in default path: found in /usr/local checking for zip_open in -lzip... yes checking for zip_file_set_encryption in -lzip... yes checking for zip_libzip_version in -lzip... no checking stdbool.h usability... yes checking stdbool.h presence... yes checking for stdbool.h... yes checking fts.h usability... yes checking fts.h presence... yes checking for fts.h... yes checking for int8_t... (cached) yes checking for int16_t... (cached) yes checking for int32_t... (cached) yes checking for int64_t... (cached) yes checking for uint8_t... (cached) yes checking for uint16_t... (cached) yes checking for uint32_t... (cached) yes checking for uint64_t... (cached) yes checking for ssize_t... yes checking size of short... (cached) 2 checking size of int... (cached) 4 checking size of long... (cached) 8 checking size of long long... (cached) 8 checking size of off_t... 0 configure: error: off_t undefined; check your library configuration
#添加搜索路径到配置文件 echo '/usr/local/lib64 /usr/local/lib /usr/lib /usr/lib64'>>/etc/ld.so.conf #然后 更新配置 ldconfig -v
make && make install
cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/zipconf.h
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/ Installing PHP CLI binary: /usr/local/php/bin/ Installing PHP CLI man page: /usr/local/php/php/man/man1/ Installing PHP FPM binary: /usr/local/php/sbin/ Installing PHP FPM defconfig: /usr/local/php/etc/ Installing PHP FPM man page: /usr/local/php/php/man/man8/ Installing PHP FPM status page: /usr/local/php/php/php/fpm/ Installing phpdbg binary: /usr/local/php/bin/ Installing phpdbg man page: /usr/local/php/php/man/man1/ Installing PHP CGI binary: /usr/local/php/bin/ Installing PHP CGI man page: /usr/local/php/php/man/man1/ Installing build environment: /usr/local/php/lib/php/build/ Installing header files: /usr/local/php/include/php/ Installing helper programs: /usr/local/php/bin/ program: phpize program: php-config Installing man pages: /usr/local/php/php/man/man1/ page: phpize.1 page: php-config.1 Installing PEAR environment: /usr/local/php/lib/php/ Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in phar:///home/flame/software/php-7.3.0/pear/install-pear-nozlib.phar/PEAR/PackageFile/v2/Validator.php on line 1933 [PEAR] Archive_Tar - installed: 1.4.3 [PEAR] Console_Getopt - installed: 1.4.1 [PEAR] Structures_Graph- installed: 1.1.1 [PEAR] XML_Util - installed: 1.4.2 [PEAR] PEAR - installed: 1.10.5 Wrote PEAR system config file at: /usr/local/php/etc/pear.conf You may want to add: /usr/local/php/lib/php to your php.ini include_path /home/flame/software/php-7.3.0/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin ln -s -f phar.phar /usr/local/php/bin/phar Installing PDO headers: /usr/local/php/include/php/ext/pdo/
cp php.ini-production /usr/local/php/lib/php.ini cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf ln -s /usr/local/php/sbin/php-fpm /usr/local/bin
cd /usr/local/php/etc/php-fpm.d vim www.conf
[www] listen = 127.0.0.1:9080 listen.mode = 0666 user = www #php代码目录权限 需要跟这个一致, group = www #php代码目录权限 需要跟这个一致 pm = dynamic pm.max_children = 128 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 10000 rlimit_files = 1024 slowlog = log/$pool.log.slow
cd /home/flame/software/php-7.3.0/sapi/fpm cp php-fpm.service /usr/lib/systemd/system/
systemctl start php-fpm
#查看状态 systemctl status php-fpm #得到输出 ● php-fpm.service - The PHP FastCGI Process Manager Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled) Active: active (running) since Thu 2018-12-27 16:13:16 CST; 2s ago Main PID: 16835 (php-fpm) CGroup: /system.slice/php-fpm.service ├─16835 php-fpm: master process (/usr/local/php/etc/php-fpm.conf) ├─16836 php-fpm: pool www ├─16837 php-fpm: pool www ├─16838 php-fpm: pool www ├─16839 php-fpm: pool www ├─16840 php-fpm: pool www ├─16841 php-fpm: pool www ├─16842 php-fpm: pool www ├─16843 php-fpm: pool www ├─16844 php-fpm: pool www ├─16845 php-fpm: pool www ├─16846 php-fpm: pool www ├─16847 php-fpm: pool www ├─16848 php-fpm: pool www ├─16849 php-fpm: pool www ├─16850 php-fpm: pool www ├─16851 php-fpm: pool www ├─16852 php-fpm: pool www ├─16853 php-fpm: pool www ├─16854 php-fpm: pool www └─16855 php-fpm: pool www Dec 27 16:13:16 iZj6cas4fyg41lxhngh1z0Z systemd[1]: Started The PHP FastCGI Process Manager.
mkdir -p /home/www/webroot/php cd /home/www/webroot/php vim test.php
xxx.xxx.xxx.xxx:8080/test.php
php 명령 환경
에 $HOME/.profile 새로운 콘텐츠는
export PATH=$PATH:/usr/local/php/bin
评论
위 내용은 Alibaba Cloud centos7.6에 php7.3을 설치하기 위한 자세한 튜토리얼의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!