当前位置:首页 » 编程语言 » debian编译php

debian编译php

发布时间: 2023-03-10 00:04:25

‘壹’ php 编译报错 undefined reference to `lzma_code@XZ_5.0' 求助大神帮解决 好几天了 没找到办法。。。

可是为什么要自己编译PHP呢,lnmp集成环境不香吗,即使不相信别人的集成环境,Debian和Redhat下也有APT和YUM包管理可以直接安装php,
例如Ubuntu下执行apt install php7.3 即可安装php7.3

‘贰’ debian下 如果用cgi模式安装了php,如果安装时--enable-ftp参数未加,安装好后如何重新./configure

在把你编译的重新 config 重新 make 重新 make install 即可

‘叁’ ./configure编译php时这个问题如何解决

PHP的安装虽然有时候很简单,可是如果应用一多,我们安装起来就很头痛了!出错最多的就是安装PHP扩展的时候了。其实不管是你是Apache类的应用还是Nginx类的,PHP的安装都不是很简单,虽然网上有很多configure参数,但是那不一定是适合你的,因为很多都直接关系着你的系统版本和内核。因此要自己亲自不断的调试,才能完全安装成功。
本文总结了一些常见的configure错误信息和解决这些错误的经验。
1、configure: error: No curses/termcap library found
网上有的说法是:–with-named-curses-libs=/usr/lib/libncursesw.so.5
其实是不对的,虽然能解决configure的错误,但是make的时候会提示错误,正确的做法应该是
centos: yum -y install ncurses-devel
debian: apt-get install libncurses5-dev
2、configure: error: xml2-config not found. Please check your libxml2 installation.
centos: yum -y install libxml2 libxml2-devel
debian: apt-get install libxml2-dev
3、configure: error: Cannot find OpenSSL’s
centos: yum -y install openssl-devel
4、configure: error: libjpeg.(a|so) not found
centos: yum -y install gd
centos: yum -y install gd-devel
debian: apt-get install libjpeg-dev
5、configure: error: libpng.(a|so) not found.
apt-get install libpng12-dev
6、configure: error: cannot find output from lex; giving up
yum -y install flex
7、configure: error: mod_deflate has been requested but can not be built e to prerequisite failures
centos: yum -y install zlib-devel openssl-devel
debian: apt-get install zlib1g-dev
8、configure: error: libxpm.(a|so) not found.
centos: yum -y install libxpm-dev
debian: apt-get install libxpm-dev
9、configure: error: freetype.h not found.
centos: yum install freetype-devel
debian: apt-get install libfreetype6-dev
10、configure: error: …No recognized SSL/TLS toolkit detected
centos: yum -y install libssl-dev
debian: apt-get install libssl-dev
11、Configure: error: Please reinstall the BZip2 distribution
centos: yum install bzip2 bzip2-devel
debian: apt-get install bzip2-devel
12、Configure: error: Please reinstall the libcurl distribution – easy.h should be in /include/curl/
centos: yum install curl curl-devel (For Redhat & Fedora)
# install libcurl4-gnutls-dev (For Ubuntu)
13、Configure: error: Unable to locate gmp.h
centos: yum install gmp-devel
14、Configure: error: Cannot find Mysql header files under /usr. Note that the MySQL client library is not bundled anymore!
yum install mysql-devel (For Redhat & Fedora)
# apt-get install libmysql++-dev (For Ubuntu)
15、Configure: error: Please reinstall the ncurses distribution
Solutions :
centos: yum install ncurses ncurses-devel
16、Checking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h’ not found!
Solutions :
centos: yum install unixODBC-devel
17、Configure: error: Cannot find pspell
Solutions :
centos: yum install pspell-devel
18、configure: error: mcrypt.h not found. Please reinstall libmcrypt.
Solutions :
yum install libmcrypt libmcrypt-devel (For Redhat & Fedora)
# apt-get install libmcrypt-dev
19、Configure: error: snmp.h not found. Check your SNMP installation.
Solutions :
yum install net-snmp net-snmp-devel
20、开启LDAP服务还需要
yum -y install openldap-devel openldap-servers openldap-clients
21、configure: error: cannot find output from lex; giving up
centos: yum -y install flex
22、configure: error: mod_deflate has been requested but can not be built e to prerequisite failures
centos: yum -y install zlib-devel openssl-devel
debian: apt-get install zlib1g-dev

‘肆’ debian8怎么安装php7

debian8 编译安装 php7
目录(?)[-]
Please reinstall the libcurl distributionCannot find OpenSSL
configure error Unable to locate gmph
Can not find recodeh anywhere under usr usrlocal usr optCannot find pspell
Please reinstall the mysql distribution
mcrypth not found Please reinstall libmcryptxml2-config not found
安装编译器
apt-get install build-essential autoconf automake libtool bison re2c获取PHP安装包
wget https://downloads.php.net/~ab/php-7.0.13RC1.tar.gz安装dev包
apt-get install libxml2-dev libssl-dev libbz2-dev libjpeg-dev libpng-dev libxpm-dev libfreetype6-dev libgmp-dev libgmp3-dev libmcrypt-dev libmysqlclient15-dev libpspell-dev librecode-dev进行编译安装
./buildconf //用来生成configure脚本
./configure \
--prefix=/usr \
--with-config-file-path=/etc \
--enable-mbstring \
--enable-zip \
--enable-bcmath \
--enable-pcntl \
--enable-ftp \
--enable-exif \
--enable-calendar \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-curl \
--with-mcrypt \
--with-iconv \
--with-gmp \
--with-pspell \
--with-gd \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-zlib-dir=/usr \
--with-xpm-dir=/usr \
--with-freetype-dir=/usr \
--with-t1lib=/usr \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-openssl \
--with-pdo-mysql=/usr \
--with-gettext=/usr \
--with-zlib=/usr \
--with-bz2=/usr \
--with-recode=/usr \
--with-mysqli=/usr/bin/mysql_config
备注:错误1:Cannot find OpenSSL's libraries 解决:
确认已安装过 openssl、libssl-dev 包,还是会提示该错误;解决办法:
root@test2:~/php-5.3.27# find / -name libssl.so输出结果为: /usr/lib/x86_64-linux-gnu/libssl.so初步判断它可能只会在 /usr/lib/ 下寻找 libssl.so 文件,于是:
ln -s /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib错误2:debian Please reinstall the libcurl distribution 解决:
# RetHat CentOS or Fedora 使用下面安装命令yum install curl curl-devel
# Debian or Ubuntu使用下面的安装命令
apt-get install curl
apt-get install libcurl4-gnutls-dev
错误3:Unable to locate gmp.h 解决:
在https://launchpad.net/debian/+source/gmp 下载 gmp源码包,接着 ./configure && make && make install编译 安装
make &&make install
报错处理
Please reinstall the libcurl distributionaptitude search libcurl4
aptitude install libcurl4-gnutls-dev
Cannot find OpenSSL’
wget https://www.openssl.org/source/openssl-1.0.2j.tar.gztar -zxvf openssl-1.0.2j.tar.gz
cd openssl-1.0.2j
./config
make && make install
configure: error: Unable to locate gmp.h
sudo apt-get install libgmp-dev libgmp3-devln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.hCan not find recode.h anywhere under /usr /usr/local /usr /opt.
apt-get install librecode-dev
Cannot find pspell
apt-get install libpspell-dev
Please reinstall the mysql distribution
apt-get install libmysqlclient15-dev
mcrypt.h not found. Please reinstall libmcrypt.
apt-get install libmcrypt-dev
xml2-config not found
apt-get install libxml2-dev

‘伍’ debian nginx php应该放在哪个目录

这个没有规定, 默认安装是在 /usr/bin下面, 这样就不用加入到系统的PATH, LIB

如果是自己编译,一般会是/usr/local/phpxx, 编译完成之后, 设置当前用户或者系统的PATH

‘陆’ PHP8、FPM及部分扩展编译安装

本着能懒则懒的原则,之前我都是宝塔、lnmp脚本等“一键”
再不济也得来个 apt/yum install php
什么?源码 make install ? 编译参数一言难尽,劝退劝退...我只是想要个开发环境而已

没关系!我来整理一下常用模块以及参数!环境为 ubuntu/debian

检查压缩包的完整性,与官网 sha256比较

安装以下包

官方的拓展分类
根据需要的模块添加其后对应的参数

包含常用模块,可以直接使用

编译并安装后
复制 php.ini 到默认目录 /usr/local/lib/

检查 php安装是否正确

复制 fpm 配置文件、运行服务文件
www.conf php-fpm.conf php-fpm.service

修改 fpm 用户和组,默认为nobody

修改服务文件,取消只读 不然日志不能读写无法启动

设置自启动并运行

本地起服务测试

No package 'libxml-2.0' found

No package ‘sqlite3‘ found

configure: WARNING: unrecognized options: –with-gd

No package 'zlib' found

No package 'libpng' found

No package 'oniguruma' found

No package 'libcurl' found

No package 'libsystemd' found

No package 'openssl' found

No package 'libzip' found

‘柒’ debian怎么运行php-fpm

php 5.3.3以后 源码中已经内嵌了 php-fpm,不用象以前的php版本一样专门打补丁了,只需要在configure的时候添加编译参数即可。
关于php-fpm的编译参数有 –enable-fpm –with-fpm-user=www –with-fpm-group=www –with-libevent-dir=libevent位置。
但是,php 5.3.3以后 的php-fpm 不再支持 php-fpm 以前具有的 /usr/local/php/sbin/php-fpm (start|stop|reload)等命令,需要使用信号控制:
master进程可以理解以下信号:

INT, TERM 立刻终止
QUIT 平滑终止
USR1 重新打开日志文件
USR2 平滑重载所有worker进程并重新载入配置和二进制模块
有了以上信号,php-fpm进程重启就方便多了。
例子:
php-fpm 关闭:

代码示例:
kill -INT `cat /usr/local/php/var/run/php-fpm.pid`
php-fpm 重启:

代码示例:
kill -USR2 `cat /usr/local/php/var/run/php-fpm.pid`
说明:
cat部分是php-fpm的进程号,可能是我用的5.4的问题。没有用php-fpm.pid ,就没有这个文件。
可以用 ps aux | grep php-fpm,使用第一个进程的进程号,测试可行。

热点内容
对应服务器是什么意思 发布:2024-11-06 19:38:18 浏览:254
怎么搭建服务器空间 发布:2024-11-06 19:35:36 浏览:980
动态规划01背包算法 发布:2024-11-05 22:17:40 浏览:849
nasm编译器如何安装 发布:2024-11-05 22:01:13 浏览:181
登录密码在微信的哪里 发布:2024-11-05 22:00:29 浏览:739
c防止反编译工具 发布:2024-11-05 21:56:14 浏览:248
安卓虚拟机怎么用 发布:2024-11-05 21:52:48 浏览:344
php时间搜索 发布:2024-11-05 20:58:36 浏览:479
燕山大学编译原理期末考试题 发布:2024-11-05 20:13:54 浏览:528
华为电脑出现临时服务器 发布:2024-11-05 20:05:08 浏览:408