搭建php开发环境和开发工具([精选] 一步步教你如何搭建 php8环境)

wufei123 发布于 2023-12-29 阅读(256)

php教程pdf

商务合作加微信:2230304070 学习与交流:PHP技术交流微信群 本篇文章由php8教程栏目给大家详细介绍如何一步步搭建php8环境,希望对大家有所帮助一、下载1、https:/PHP/www.php.net/distributions/php-8.0.0.tar.gz下载到本地,文件传输上传到 /usr/local/src/。

2、wget -P /usr/local/src/ hPHPttps://www.php.net/distributions/php-8.0.0.tar.gz二、解压、编译、安装>cd /usr/local/src/

> tar xzf php-8.0.0.taPHPr.gz>cd php-8.0.02、配置编译参数,参考https://www.php.net/manual/zh… 选择自己需要的选项./configure --prefix=/usr/

local/PHPphp8 --with-config-file-path=/usr/local/php8/etc --with-fpm-user=www --with-fpm-group=www --with-

curPHPl --with-openssl --with-mysqli --with-pdo-mysql --with-iconv --with-mhash --with-zlib  --enable-mbstPHPring  --

enable-gd   --enable-gd-jis-conv --enable-sockets --enable-fpm --enable- --enable-xml  --enaPHPble-pdo  --

enable-cli --enable-pcntl --enable-soap --enable-opcache --enable-fileinfo --disable-rpatPHPh --enable-mysqlnd --with-zip --

enable-simplexml --with-libxml --with-sqlite3 --with-pdo-sqlite --enPHPable-phar --enable-tokenizer --enable

-cgi问题1:configure: error: Package requirements (libxml-2.0 >= 2PHP.9.0) were not met:Package libxml-2.0, required by

virtual:world, not foundConsider adjusting the PKGPHP_CONFIG_PATH environment variable if youinstalled software

in a non-standard prefix.Alternatively, yoPHPu may set the environment variables LIBXML_CFLAGSand LIBXML_LIBS to avoid the need to call pkg-

confiPHPg.See the pkg-config man page for more details.问题1解决:> yum install libxml2-devel问题2:configure: errorPHP

: Packagerequirements (sqlite3 > 3.7.4) werenotmet:问题2解决:> yum install sqlite-devel问题3:configure: erPHPror

: Package requirements (libcurl >= 7.29.0) were not met:问题3解决:> yum install libcurl-devel问题4:confPHPigure:

error: Package requirements (libpng) were not met:问题4解决:> yum install libpng libpng-devel问题5:cPHPonfigure:

error: Package requirements (oniguruma) were not met:问题5解决:>cd /usr/local/src/> wget http:/PHP/ftp.altlinux.org/pub/distributions/ALTLinux/Sisyphus/x86_64/RPMS.classic/liboniguruma5-6.9.6-alt1.xPHP86_64.rpm -O liboniguruma5-6.9.6-alt1.x86_64.rpm

> rpm -ivh liboniguruma5-6.9.6-alt1.x86_64.rpm> wgetPHP http://ftp.altlinux.org/pub/distributions/ALTLinux/Sisyphus/x86_64/RPMS.classic/liboniguruma-devel-PHP6.9.6-alt1.x86_64.rpm -O liboniguruma-devel-6.9.6-alt1.x86_64.rpm

> rpm liboniguruma-devel-6.9.6-alt1PHP.x86_64.rpmcli问题6:configure: error: Package requirements (libzip >=

0.11 libzip != 1.3.1 libzip != 1.PHP7.0) were not met:问题6解决:> yum install libzip libzip-devel配置编译参数成功+----------------------------------PHP----------------------------------+

| License:                                                       PHP    || This software is subject to the PHP License, available

inthis     || distribution in the file PHPLICENSE. By continuing this installation  || process, you are bound

by the terms of this license agrePHPement.     || If you do not agree with the terms of this license, you must abort |

| the installationPHP process at this point.                            |+-----------------------------------------------PHP---------------------+

Thank you for using PHP.3、编译源码> make -j2 # 这里是依赖系统cpu核心数进行编译,对性能有一定提升,通常利用核心数不PHP要超过一半,4、安装make install安装成功

[root@54skyer php-8.0.0]# make installInstalling shared extensions:     /uPHPsr/local/php8/lib/php/extensions/no-

debug-non-zts-20200930/Installing PHP CLI binary:        /usr/loPHPcal/php8/bin/Installing PHP CLI man page:      /usr/

local/php8/php/man/man1/Installing PHP FPM binarPHPy:        /usr/local/php8/sbin/Installing PHP FPM defconfig:     /usr/

local/php8/etc/Installing PHP PHPFPM man page:      /usr/local/php8/php/man/man8/Installing PHP FPM status

page:   /usr/local/php8/phpPHP/php/fpm/Installing phpdbg binary:         /usr/local/php8/bin/Installing phpdbg man page:       /usPHPr/

local/php8/php/man/man1/Installing PHP CGI binary:        /usr/local/php8/bin/Installing PHP CGI mPHPan page:      /usr/

local/php8/php/man/man1/Installing build environment:     /usr/local/php8/lib/phpPHP/build/Installing header files:          /usr/

local/php8/include/php/Installing helper programs:    PHP   /usr/local/php8/bin/  program: phpize  program: php-

configInstalling man pages:             /usr/PHPlocal/php8/php/man/man1/  page: phpize.1  page: php-config

.1/usr/local/src/php-8.0.0/build/shtool inPHPstall -c ext/phar/phar.phar /usr/local/php8/bin/phar.pharln -s -f phar.phar /usr/

local/php8/bin/pharPHPInstalling PDO headers:           /usr/local/php8/include/php/ext/pdo/5、添加环境变量> vim /etc/profile

# 在文PHP件末尾加入# PATH=$PATH:/usr/local/php8/bin/#export PATH# :wq 保存并退出>source /etc/profile # 立刻生效配置> php -v

PHP获得如下信息php -vPHP 8.0.0 (cli) (built: Dec 15 2020 02:46:59) ( NTS )Copyright (c) The PHP GroupZend EngPHPine v4.0.0-dev, Copyright (c) Zend Technologies

6、获取默认配置// 复制php.ini到编译配置参数指定的目录php.ini在解压的源码目录里> cp PHP/usr/local/src/php-8.0.0/php.ini-production /usr/。

local/php8/etc/php.ini// 复制一份php-fpm的配置模版文件到同级目录 方PHP便备份和修改> cp /usr/local/php8/etc/php-fpm.conf.default

/usr/local/php8/etc/php-fpm.conf// 复制一份php-fpm的扩展PHP配置模板文件到同级目录 方便备份和修改> cp /usr/local/php8/etc/php-fpm.d/www.conf.

default /usr/local/php8/etc/php-fpm.dPHP/www.conf// 复制开启自起脚本到系统启动自动加载脚本目录fpm/init.d.php-fpm在解压的源码目录里> cp /usr/。

local/src/php-8.0.0/sapi/fpm/PHPinit.d.php-fpm /etc/init.d/php-fpm7、开机自启动设置命令可被执行> chmod +x /etc/init.d/php-fpm

# 添加可执行权限检验自启动脚本> serPHPvice php-fpm start # 检验服务启动> service php-fpm stop # 检验服务关闭// 均正常提示> chkconfig php-fpm

on# 设置开机自动执行phpPHP-fpm开机自启动脚本> reboot # 重启,ssh重连# 重启后[root@54skyer ~]# netstat -ntlpActive Internet connections

(only sPHPervers)Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program nPHPame

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1097/nginx: mastePHPr  tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1061/sshd

tcp     PHP   0      0 0.0.0.0:16379           0.0.0.0:*               LISTEN      1090/redis-server 0 tcp     PHP   0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      1083/php-fpm: maste

7、额外说明关于配PHP置文件的一些说明php-fpm.conf是PHP-FPM特有的配置文件php.ini是所有php模式中必须的配置文件两者的区别是,php-fpm.conf是PHP-FPM进程管理器的配置文件,php.PHPini是PHP解析器的配置文件

有的PHP版本的配置文件路径中还有/fpm.d/www.conf配置文件这是php-fpm.conf配置的文件的扩展文件,可以打开php-fpm.conf文件查看; inPHPclude=fpm.d/*.conf

我们可以使用php-fpm.conf配置慢日志我们是可以开启慢日志功能的slowlog = /usr/local/var/log/php-fpm.log.slowrPHPequest_slowlog_timeout。

 = 5s

原文链接:https://www.php.cn/topic/php8/496801.html以上就是本篇分钟的全部内容,希望各位程序员们努力提升个PHP人技术最后,小编温馨提示:每天阅读5分钟,每天学习一点点,每天进步一点点。

点个赞

再走吧

亲爱的读者们,感谢您花时间阅读本文。如果您对本文有任何疑问或建议,请随时联系我。我非常乐意与您交流。

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

河南中青旅行社综合资讯 奇遇综合资讯 盛世蓟州综合资讯 综合资讯 游戏百科综合资讯 新闻59742