PHP7栏目介绍如何有效安装Php7.3
推荐(免费):PHP7
首先安装(安装过了就不用安装了):
mysql:https://blog.csdn.net/qq_40200087/article/details/89479137
nginx:https://blog.csdn.net/qq_40200087/article/details/89504980
下载:https://www.php.net/downloads.php#v7.3.4
开发工具:
yum groupinstall "Development Tools" -y
安装依赖:
yum install libxml2-devel -y yum install bzip2 bzip2-devel -y yum install curl-devel -y yum install libjpeg-devel -y yum install libpng libpng-devel -y yum install freetype-devel -y yum install libxslt-devel -y yum install libzip-devel -y 或者合到一起安装 yum install libxml2-devel bzip2 bzip2-devel curl-devel libjpeg-devel libpng libpng-devel freetype-devel libxslt-devel libzip-devel -y
解压:
tar -zxvf php-xxx.tar.gz -C /usr/local/
进入到/usr/local 并修改名字
cd /usr/local mv php-7.3.xxx php7.3
编译
cd /usr/local/php7.3 ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-fpm-user=mysql --with-fpm-group=mysql --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli=mysqlnd --with-openssl --with-pcre-regex --with-pdo-mysql=mysqlnd --with-mysql=mysqlnd --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-fpm
编译完成后是以下样子 +--------------------------------------------------------------------+ | License: | | This software is subject to the PHP License, available in this | | distribution in the file LICENSE. By continuing this installation | | process, you are bound by the terms of this license agreement. | | If you do not agree with the terms of this license, you must abort | | the installation process at this point. | +--------------------------------------------------------------------+ Thank you for using PHP. config.status: creating php7.spec config.status: creating main/build-defs.h config.status: creating scripts/phpize config.status: creating scripts/man1/phpize.1 config.status: creating scripts/php-config config.status: creating scripts/man1/php-config.1 config.status: creating sapi/cli/php.1 config.status: creating sapi/fpm/php-fpm.conf config.status: creating sapi/fpm/www.conf config.status: creating sapi/fpm/init.d.php-fpm config.status: creating sapi/fpm/php-fpm.service config.status: creating sapi/fpm/php-fpm.8 config.status: creating sapi/fpm/status.html config.status: creating sapi/phpdbg/phpdbg.1 config.status: creating sapi/cgi/php-cgi.1 config.status: creating ext/phar/phar.1 config.status: creating ext/phar/phar.phar.1 config.status: creating main/php_config.h config.status: executing default commands configure: WARNING: unrecognized options: --with-mysql
安装:
make && make install
复制以下三个配置文件
cp php.ini-production /usr/local/php/etc/php.ini cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
设置php.ini
#注意:php的注释为 ; 如果设置前面有 ; ,请记得删除 ; vim /usr/local/php/etc/php.ini max_execution_time = 300 max_input_time = 300 memory_limit = 128M post_max_size = 16M upload_max_filesize = 2M date.timezone = Asia/Shanghai
测试php是否安装成功
/usr/local/php/sbin/php-fpm -t
拷贝启动文件
cp /usr/local/php7.3/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
赋予执行权限
chmod 755 /etc/init.d/php-fpm
启动
service php-fpm start
查询是否启动成功
ps -ef |grep php-fpm root 27332 1 0 08:51 ? 00:00:00 php-fpm: master process (/usr/local/php/etc/php-fpm.conf) mysql 27333 27332 0 08:51 ? 00:00:00 php-fpm: pool www mysql 27334 27332 0 08:51 ? 00:00:00 php-fpm: pool www root 27336 7898 0 08:51 pts/1 00:00:00 grep --color=auto php-fpm
配置 nginx可解析 .php文件
注意:fastcgi_pass 127.0.0.1:9000; 端口与/usr/local/php/etc/php-fpm.d/www.conf 里面的listen = 127.0.0.1:9000 配置要一样,不然无法解析 vim /usr/local/nginx/conf/nginx.conf 修改server{} 这个里面的数据为: listen 80; server_name localhost; access_log /usr/local/nginx/logs/host.access.log; root /usr/local/nginx/html; index index.html index.htm index.php; location / { try_files $uri $uri/ /index.php?$args; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ \.php$ { expires -1s; try_files $uri =404; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi.conf; }
测试是否解析成功:
在/usr/local/nginx/html中创建test.php,里面内容如下 <?php phpinfo(); ?> 执行 /usr/local/nginx/sbin/nginx 浏览去输入 http://本机ip/test.php 如果打开网页了则解析成功,如果是下载,则解析失败
遇到一个错误:
执行测试的时候遇到 [root@jenkins-master etc]# /usr/local/php/sbin/php-fpm -t PHP: syntax error, unexpected '=' in Unknown on line 1 [25-Apr-2019 08:36:28] ERROR: Unable to include /usr/local/php/etc/php-fpm.d/www.conf from /usr/local/php/etc/php-fpm.conf at line 23 [25-Apr-2019 08:36:28] ERROR: failed to load configuration file '/usr/local/php/etc/php-fpm.conf' [25-Apr-2019 08:36:28] ERROR: FPM initialization failed 最后发现是我执行./configue 的时候后面配置文件有一个少了个空格,我已修改上面的配置 原因呢是因为 www.conf 里面的user配置错误
以上是详解 Php7.3安装的详细内容。更多信息请关注PHP中文网其他相关文章!

本文详细介绍了有效的PHP 7会话管理,涵盖了session_start(),$ _Session,session_destroy()和安全cookie处理等核心功能。 它强调了安全性最佳实践,包括HTTP,会话ID再生,S

本文解释了如何使用新遗物监视PHP 7应用程序性能。 它详细详细介绍了新的Relic的设置,关键绩效指标(KPI),例如APDEX分数和响应时间,通过交易轨迹的瓶颈标识和错误轨迹

本文详细介绍了将PHP 5.6升级为PHP 7,强调了备份,检查服务器兼容性以及选择升级方法(软件包管理器,编译,控制面板或Web服务器配置)等关键步骤。 它解决了Potentia

本文使用SPL_AUTOLOAD_REGISTER()解释了PHP 7的自动加载,以按需加载类。 它详细介绍了最佳实践,例如基于命名空间的自动加载和用于性能优化的缓存,解决了常见问题(例如,找不到类别

本文指导PHP 7开发人员使用GIT进行版本控制。 它涵盖了初始化,分期,投入,忽略文件,远程存储库,分支,合并,解决冲突和基本的GIT命令。 效率的最佳实践

本文详细介绍了部署PHP 7应用程序,涵盖方法(FTP,SSH,部署工具),服务器配置(Apache/nginx,php-fpm),数据库设置和重要的安全考虑因素。 它突出了服务器compatib等常见挑战

本文说明了如何使用Xdebug进行调试PHP 7代码。 它涵盖Xdebug配置(安装,php.ini设置,IDE设置),断点用法(条件,功能,远程)和故障排除连接问题。 有效的Debuggi

本文在PHP 7中解释了面向对象的编程(OOP),强调了其优势:模块化,可重复性,可维护性和改进的代码组织。 它详细说明了类,对象,继承和多态性,以说明其使用


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

安全考试浏览器
Safe Exam Browser是一个安全的浏览器环境,用于安全地进行在线考试。该软件将任何计算机变成一个安全的工作站。它控制对任何实用工具的访问,并防止学生使用未经授权的资源。

ZendStudio 13.5.1 Mac
功能强大的PHP集成开发环境

MinGW - 适用于 Windows 的极简 GNU
这个项目正在迁移到osdn.net/projects/mingw的过程中,你可以继续在那里关注我们。MinGW:GNU编译器集合(GCC)的本地Windows移植版本,可自由分发的导入库和用于构建本地Windows应用程序的头文件;包括对MSVC运行时的扩展,以支持C99功能。MinGW的所有软件都可以在64位Windows平台上运行。

SublimeText3汉化版
中文版,非常好用

EditPlus 中文破解版
体积小,语法高亮,不支持代码提示功能