阿里云centos7.6安装php7.3的详细教程

简介: 阿里云centos7.6安装php7.3的详细教程

本篇文章给大家带来的内容是关于阿里云centos7.6安装php7.3的详细教程,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。


新增用户 用户组



groupadd www
useradd -g www www


下载 php



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: error: libxml2 not found. Please check your libxml2 installation.编译错误,解决依赖


yum install -y  libxml2-devel


configure: error: Please reinstall the BZip2 distribution


yum install -y  bzip2-devel


configure: error: cURL version 7.15.5 or later is required to compile php with cURL support


yum install -y  curl-devel


configure: error: jpeglib.h not found.


yum install -y  libjpeg-devel


configure: error: png.h not found.


yum install -y libpng-devel


configure: error: freetype-config not found.


yum install -y libpng-devel


configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution


yum install -y libxslt-devel


configure: error: Please reinstall the libzip distribution


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 for libzip... configure: error: system libzip must be upgraded to version >= 0.11


off_t undefined 报错


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


off_t 类型是在 头文件 unistd.h中定义的,


在32位系统 编程成 long int ,64位系统则编译成 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: fatal error: zipconf.h: No such file or directory


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


加入 systemtl 服务


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


输入


<?php
phpinfo();
?>


访问

xxx.xxx.xxx.xxx:8080/test.php


php 命令环境



在$HOME/.profile里新增内容为



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


目录
相关文章
|
6天前
|
PHP 对象存储 Docker
阿里云云效产品使用问题之PHP和LAMP项目部署回滚不生效,该怎么办
云效作为一款全面覆盖研发全生命周期管理的云端效能平台,致力于帮助企业实现高效协同、敏捷研发和持续交付。本合集收集整理了用户在使用云效过程中遇到的常见问题,问题涉及项目创建与管理、需求规划与迭代、代码托管与版本控制、自动化测试、持续集成与发布等方面。
|
2月前
阿里云服务器怎么开发票?图文教程来了
在阿里云,用户可在用户中心的发票管理中开具电子或纸质发票。首次开票需设置发票抬头,可选个人或企业,以及增值税普通或专用发票。个人账号无法直接开企业发票,需变更实名认证。发票税率因产品而异,通常为6%或13%。发票抬头可修改,纸质发票邮寄费用由阿里云承担(特殊情况除外)。电子发票同样可报销。更多详情见阿里云官方帮助中心。
127 3
|
2天前
|
运维 安全 数据建模
阿里云免费SSL证书与付费SSL证书区别及免费SSL证书申请教程参考
免费SSL证书是阿里云为个人网站、开发测试或企业网站建设之初提供的SSL证书,以便满足其对HTTPS数据加密传输的基本要求,从而提高数据传输的安全性。本文为大家详细介绍阿里云免费SSL证书与付费SSL证书区别以及免费SSL证书申请教程。
阿里云免费SSL证书与付费SSL证书区别及免费SSL证书申请教程参考
|
1月前
|
存储 固态存储 异构计算
阿里云服务器租用一个月教程、收费标准与活动价格参考
阿里云服务器可以月租也可以年租,阿里云的活动中云服务器时长大多都是1年或3年,比较符合大多数用户的需求,但是也有少部分用户只想购买1个月或者3个月、6个月阿里云服务器来体验,但是又不知道选择月付的具体租用流程及月付的收费标准情况,本文为大家介绍一下租用时选择月付的具体流程以及月付的收费标准情况,以供参考。
阿里云服务器租用一个月教程、收费标准与活动价格参考
|
15天前
|
Ubuntu PHP Apache
蓝易云 - 如何在Ubuntu 22.04上安装PHP8.1并设置本地开发环境
以上就是在Ubuntu 22.04上安装PHP 8.1并设置本地开发环境的步骤。
22 2
|
17天前
|
弹性计算
2024年阿里云免费云服务器及学生三百通用额度申请教程参考
阿里云2024年继续提供免费学生云服务器,最长可享7个月(1+6个月);还有300元无门槛抵用金,适用于全量公共云产品(特殊商品除外)。学生需完成身份认证和任务以领取和续费。此外,有3个月免费的飞天试用云服务器,分为个人和企业版。详细申请教程包括学生认证、试用产品选择等步骤,可访问指定阿里云链接进行操作。
894 2
|
20天前
|
存储 Linux PHP
PHP云盘网盘系统源码+快速对接多家云存储+全新一键安装版
快速对接多家云存储,支持七牛、又拍云、阿里云OSS、AWS S3、Onedrive、自建远程服务器,当然,还有本地存储。 自定义主题配色。 图片、音频、视频、文本、Markdown、Ofiice文档 在线预览。 移动端全站响应式布局。 文件、目录分享系统,可创建私有分享或公开分享链接。 用户个人主页,可查看用户所有分享。 多用户系统、用户组支持。 初步完善的后台,方便管理。 拖拽上传、分片上传、断点续传、下载限速(*实验性功能)。 多上传策略,可为不同用户组分配不同策略。 用户组基础权限设置、二步验证。 WebDAV协议支持。
20 2
|
29天前
|
Ubuntu PHP
ubuntu php libzip安装 ./configure报错 checking for libzip... not found configure
ubuntu php libzip安装 ./configure报错 checking for libzip... not found configure
21 1
|
29天前
|
Ubuntu 关系型数据库 MySQL
ubuntu apt 安装wordpress所需所有的 一键脚本 扩展您的PHP似乎没有安装运行WordPress所必需的MySQL扩展。
ubuntu apt 安装wordpress所需所有的 一键脚本 扩展您的PHP似乎没有安装运行WordPress所必需的MySQL扩展。
18 0
ubuntu apt 安装wordpress所需所有的 一键脚本 扩展您的PHP似乎没有安装运行WordPress所必需的MySQL扩展。
|
10天前
|
Java Linux Maven
Centos7.6安装Maven3.8.3并配置阿里云镜像
Centos7.6安装Maven3.8.3并配置阿里云镜像
65 0