首页 > 编程语言 >php源码安装

php源码安装

时间:2022-09-29 20:12:00浏览次数:82  
标签:enable -- php74 fpm 源码 install php 安装

参考:

https://www.sunanzhi.com/archives/27/

 

安装

1、到官网获取下载地址 https://www.php.net/downloads

2、下载并解压

cd /home/install/php74

wget https://www.php.net/distributions/php-7.4.25.tar.gz

tar -zxvf php-7.4.25.tar.gz

3、进入解压目录编译配置

cd php-7.4.25

sudo ./configure --prefix=/usr/local/php74 \
 --with-config-file-path=/etc --enable-fpm  --enable-inline-optimization \
 --disable-debug --enable-mysqlnd --enable-static --disable-rpath --enable-shared --enable-soap  --with-xmlrpc \
 --with-openssl --with-mhash  --with-zlib \
 --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl \
 --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pear \
 --enable-opcache --enable-ftp --with-gdbm --with-openssl-dir --with-jpeg --with-zlib-dir \
 --with-freetype --enable-gd --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --with-sqlite3\
 --enable-mbstring --enable-mbregex --enable-pdo --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
 --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sysvmsg \
 --enable-sysvsem --enable-sysvshm --with-xsl --with-zip --enable-mysqlnd-compression-support --enable-intl \
 --with-config-file-path=/usr/local/php74/etc \
 PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/  (这句如果 libzip 没有报错不用复制)

注意 --with-config-file-path 指定 php.ini

编译时可能会出现一些错误 configure error

1. configure: error: Package requirements (sqlite3 > 3.7.4) were not met:
处理:yum install sqlite-devel -y

2. configure: error: Please reinstall the BZip2 distribution
处理:yum install bzip2 bzip2-devel -y

3. configure: error: Package requirements (libcurl >= 7.15.5) were not met:No package 'libcurl' found
处理:yum install libcurl libcurl-devel -y

4. configure: error: GNU MP Library version 4.2 or greater required.
处理:yum install gmp-devel -y

5. configure: error: Package requirements (icu-uc >= 50.1 icu-io icu-i18n) were not met:
    No package 'icu-uc' found
    No package 'icu-io' found
    No package 'icu-i18n' found
处理:yum install libicu-devel -y

6. configure: error: Package requirements (oniguruma) were not met: No package 'oniguruma' found
处理:yum install oniguruma-devel -y

7. configure: error: Please reinstall readline - I cannot find readline.h
处理:yum install readline-devel -y

8. configure: error: Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met:No package 'libzip' found
处理:yum remove libzip libzip-devel
     cd /home/install/libzip1.2
     wget https://hqidi.com/big/libzip-1.2.0.tar.gz
     tar -zxvf libzip-1.2.0.tar.gz
     cd libzip-1.2.0
     ./configure
     make && make install

     #####完成后#####
     make[2]: Nothing to be done for `install-exec-am'.
     /usr/bin/mkdir -p '/usr/local/lib/pkgconfig'
     /usr/bin/install -c -m 644 libzip.pc '/usr/local/lib/pkgconfig'
     make[2]: Leaving directory `/home/install/libzip1.2/libzip-1.2.0'
     make[1]: Leaving directory `/home/install/libzip1.2/libzip-1.2.0'
     #####完成后#####

     export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
     echo $PKG_CONFIG_PATH

     #####显示#####
     /usr/local/lib/pkgconfig
     #####显示#####

4、安装

make && make install

配置

1、切换到 源代码目录

cd /home/install/php74/php-7.4.25

2、拷贝 php.ini文件

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

3、服务管理

# 通过 service 管理
cd /home/install/php74/php-7.4.25/sapi/fpm
cp init.d.php-fpm /etc/init.d/php74-fpm
chmod 755 /etc/init.d/php74-fpm
# 配置完成之后
service php74-fpm start
# 自动开机启动
vi /etc/rc.d/rc.local
# 添加 下面一行并保存
/etc/init.d/php74-fpm start
# 然后执行加载配置
ldconfig

########################### 分割

# 通过 systemd 管理
cd /home/install/php74/php-7.4.25/sapi/fpm
cp php-fpm.service /lib/systemd/system/php74-fpm.service
vi /usr/lib/systemd/system/php74-fpm.service
# ProtectSystem=full 改成下面这个配置并保存
ProtectSystem=false
# 重载一下命令
systemctl daemon-reload
# 加入开机启动
systemctl enable php74-fpm.service
# 启动服务
systemctl start php74-fpm.service

4、配置php-fpm

cd /usr/local/php74/etc
cp php-fpm.conf.default php-fpm.conf
cd /usr/local/php74/etc/php-fpm.d
cp www.conf.default www.conf

# 如果需要修改 监听端口
vi /usr/local/php74/etc/php-fpm.d/www.conf
# listen = 1270.0.0.1:9000 改成 你想要监听的端口

5、修改php.ini时区

vi /usr/local/php74/etc/php.ini
# 修改并保存
date.timezone = "Asia/Shanghai"

安装其他拓展

redis 拓展

1、去官方拓展获取redis拓展地址 https://pecl.php.net/get/redis-5.3.4.tgz

2、下载解压

cd /home/install/php-redis

wget https://pecl.php.net/get/redis-5.3.4.tgz

tar zxvf redis-5.3.4.tgz

3、指定版本安装

cd /home/install/php-redis/redis-5.3.4
/usr/local/php74/bin/phpize
./configure --with-php-config=/usr/local/php74/bin/php-config
make && make install

4、修改php.ini文件

vi /usr/local/php74/etc/php.ini
# 末尾添加 redis.so 并保存
[redis]
extension=redis.so

5、重启 php

systemctl restart php74-fpm.service

标签:enable,--,php74,fpm,源码,install,php,安装
From: https://www.cnblogs.com/tkzc2013/p/16742880.html

相关文章

  • Python3安装psutil报错
    报错:pip3installpsutilcompilationterminated.error:command'gcc'failedwithexitstatus1解决:yuminstallpython3-devel继续安装:[root@centos......
  • VMware虚拟机中Linux系统下面的redis安装(详解,含采坑经验!!!)
    部分参考了这篇博客,里面讲的很详细:https://www.cnblogs.com/flower-dance/p/14731073.html而我在安装的过程中还遇到了很多问题,在文末。首先说一下我的安装步骤如下:1、......
  • 安装findbugs
    WelcometotheFindBugsEclipsepluginupdatesite.ThiswebpageprovidesautomaticdistributionandupdatesfortheEclipsepluginforFindBugs.Pluginrequirem......
  • Spring源码学习:day2
    前言:我还是太懒了,连截图都懒得粘贴,故直接用书上说的话的截图吧。代码的编写过程都是应该有一个入口的,所有的代码最终都是为了那个入口更加方便更加简单而产生的。......
  • Spring 源码学习:day1
    前言:最近也不知道该忙些什么样的事情。便随便看看源码算了。正文:(1)在网上下载Spring的源码:可以采用git方式下载 https://github.com/spring-projects/s......
  • python如何制作并安装自建包?
    一、依赖首先检查python是否安装了wheel、setuptools包,没有则使用pip安装pipinstallwheel--force-reinstallpipinstallsetuptools--force-reinstall 二、准......
  • windows安装docker
    window之安装docker1.下载https://docs.docker.com/desktop/install/windows-install/2.确保准备工作2.1控制面板程序启用或关闭windows功能开启Hyper-V......
  • python人工智能项目实战,PDF+源码
    机器学习AI算法工程 公众号:datayx《python人工智能项目IntelligentProjectsUsingPython》实施机器学习和深度学习方法,使用Python构建智能,认知AI项目主要特点帮助您掌......
  • k8s消息队列-rabbiMQ集群(pod初始化安装消息延迟插件)
    一、方案:在k8s上部署rabbitMQ集群,pod初始化时安装消息延迟插件。二、部署参考rabbitMQ官方:https://www.rabbitmq.com/kubernetes/operator/operator-overview.html1、部......
  • 青龙面板-服务器工具安装
    服务器工具安装我们在服务器做一些操作的时候需要依赖一些工具去处理,这一篇就是来安装基础工具。青龙免部署上车,公众号内回复"青龙上车"1.安装wget和宝塔面板宝塔面板就是......