编译安装 php 5.4.11
第一步 先下载 tzr.gz 的php源码包
然后 tar zxvf php-5.4.11.tar.gz
然后 cd php-5.4.11
然后复制如下编译代码
./configure \
--prefix=/usr/local/php \
--enable-zip \
--with-xsl \
--enable-zend-multibyte \
--enable-sockets \
--enable-soap \
--with-pdo-mysql=mysqlnd \
--with-mysql=mysqlnd \
--enable-pcntl \
--with-mcrypt \
--enable-fpm \
--enable-shmop \
--with-readline \
--enable-mbstring \
--with-mhash \
--enable-gd-native-ttf \
--with-freetype-dir \--with-t1lib=/usr/local/share/t1lib
\
--with-png-dir \
--with-jpeg-dir \
--with-gd \
--with-openssl-dir \
--enable-ftp \
--enable-exif \
--enable-dba \
--with-bz2 \
--enable-bcmath \
--with-curl
!!!
编译PHP5缺t1lib包解决方案
遇到这个报错:
configure: error: Your t1lib distribution is not installed correctly. Please reinstall it.
以下是解决步骤:
1. 下载
t1lib-5.1.2.tar.gz
2. 解决依赖关系:apt-get build-dep t1lib
3. 安装:./configure & make without_doc & make install
4. 编译php5 时在./configure
后加上 --with-t1lib=/usr/local/share/t1lib
。再次编译就能通过了。
configure: error: Your t1lib distribution is not installed correctly. Please reinstall it.
以下是解决步骤:
1. 下载
解决地址:http://lepingbeta.com/archives/255
如果提示 configure: error: Please reinstall readline - I cannot find readline.h 错误!
安装 sudo apt-get install libreadline-dev
然后再编译一下 就没错误了!
‘./configure’ ‘–prefix=/usr/local/php’ ‘–with-config-file-path=/etc’ ‘–with-mysql=/usr/local/mysql’ ‘–with-mysqli=/usr/local/mysql/bin/mysql_config’ ‘–with-iconv-dir=/usr/local’ ‘–with-freetype-dir’ ‘–with-jpeg-dir’ ‘–with-png-dir’ ‘–with-zlib’ ‘–with-libxml-dir=/usr’ ‘–enable-xml’ ‘–disable-rpath’ ‘–enable-safe-mode’ ‘–enable-bcmath’ ‘–enable-shmop’ ‘–enable-sysvsem’ ‘–enable-inline-optimization’ ‘–with-curl’ ‘–with-curlwrappers’ ‘–enable-mbregex’ ‘–enable-fpm’ ‘–enable-mbstring’ ‘–with-mcrypt’ ‘–with-gd’ ‘–enable-gd-native-ttf’ ‘–with-openssl’ ‘–with-mhash’ ‘–enable-pcntl’ ‘–enable-sockets’ ‘–with-xmlrpc’ ‘–enable-zip’ ‘–enable-soap’
出现得错误如下:
报错:configure: error: png.h not found.
解决办法:
apt-get -y install libpng12-dev
错误一:
configure: error: xml2-config not found. Please check your libxml2 installation.
而我已经安装过了libxml2,但是还是有这个提示:
解决办法:
# sudo apt-get install libxml2-dev
错误二:
configure: error: Please reinstall the BZip2 distribution
而我也已经安装了bzip2,网上找到得解决方案都是需要安装bzip2-dev,可是11.10里面没有这个库。
解决办法:在网上找到bzip2-1.0.5.tar.gz,解压,直接make ,sudo make install.(我使用的该源来自于http://ishare.iask.sina.com.cn/f/9769001.html)
错误三:
configure: error: Please reinstall the libcurl distribution -easy.h should be in /include/curl/
解决办法:
# sudo apt-get install libcurl4-gnutls-dev
错误四:
configure: error: jpeglib.h not found.
解决办法:
# sudo apt-get install libjpeg-dev
错误五:
configure: error: png.h not found.
解决办法:
# sudo apt-get install libpng-dev
错误六:
configure: error: libXpm.(a|so) not found.
解决办法:
# sudo apt-get install libxpm-dev
错误七:
configure: error: freetype.h not found.
解决办法:
# sudo apt-get install libfreetype6-dev
错误八:
configure: error: Your t1lib distribution is not installed correctly. Please reinstall it.
解决办法:
# sudo apt-get install libt1-dev
错误九:
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
解决办法:
# sudo apt-get install libmcrypt-dev
错误十:
configure: error: Cannot find MySQL header files under yes.
Note that the MySQL client library is not bundled anymore!
解决办法:
# sudo apt-get install libmysql++-dev
错误十一:
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
解决办法:
# sudo apt-get install libxslt1-dev
可见PHP源码安装之前需要先安装这些依赖,详细可见http://forum.ubuntu.org.cn/viewtopic.php?f=88&t=231159
如上错误都解决之后,再次./config….没有错误之后,
# make
# sudo make install
将编译安装的PHP输入到环境变量中
编译后 将其PHP路径 输入到环境变量中,要不然系统执行PHP的文件时 不知道PHP安装了没有 所以要指定一个目录 让系统知道去那里能找到编译安装的PHP
Linux CentOS系统上安装完php和MySQL后,为了使用方便,需要将php和mysql命令加到系统命令中,如果在没有添加到环境变量之前,执行 “php -v”命令查看当前php版本信息时时,则会提示命令不存在的错误,下面我们详细介绍一下在linux下将php和mysql加入到环境变量中的方法(假 设php和mysql分别安装在/usr/local/webserver/php/和/usr/local/webserver/mysql/中)。
方法一:直接运行命令export PATH=$PATH:/usr/local/webserver/php/bin 和 export PATH=$PATH:/usr/local/webserver/mysql/bin
使用这种方法,只会对当前会话有效,也就是说每当登出或注销系统以后,PATH 设置就会失效,只是临时生效。
方法二:执行vi ~/.bash_profile修改文件中PATH一行,将/usr/local/webserver/php/bin 和 /usr/local/webserver/mysql/bin 加入到PATH=$PATH:$HOME/bin一行之后
这种方法只对当前登录用户生效
方法三:修改/etc/profile文件使其永久性生效,并对所有系统用户生效,在文件末尾加上如下两行代码
PATH=$PATH:/usr/local/webserver/php/bin:/usr/local/webserver/mysql/bin
export PATH
或者 export PATH=$PATH:/usr/local/webserver/php/bin:/usr/local/webserver/mysql/bin
最后:执行 命令source /etc/profile或 执行点命令 ./profile使其修改生效,执行完可通过echo $PATH命令查看是否添加成功。
启动 php 服务的时候
sudo /usr/local/php/sbin/php-fpm
会出现
错误:
[10-Apr-2013 18:12:02] NOTICE: PHP message: PHP Deprecated: Comments starting with '#' are deprecated in /usr/local/php/lib/php.ini on line 1874 in Unknown on line 0
[10-Apr-2013 18:12:02] ERROR: failed to open configuration file '/usr/local/php/etc/php-fpm.conf': No such file or directory (2)
[10-Apr-2013 18:12:02] ERROR: failed to load configuration file '/usr/local/php/etc/php-fpm.conf'
[10-Apr-2013 18:12:02] ERROR: FPM initialization failed
这时候 是 php 找不到 配置文件php-fpm.conf
解决办法:
cd /usr/local/php/etc/
sudo cp php-fpm.conf.default php-fpm.conf
再启动
sudo /usr/local/php/sbin/php-fpm
出现错误:
[10-Apr-2013 18:14:09] NOTICE: PHP message: PHP Deprecated: Comments starting with '#' are deprecated in /usr/local/php/lib/php.ini on line 1874 in Unknown on line 0
[10-Apr-2013 18:14:09] ERROR: [pool www] cannot get gid for group 'nobody'
[10-Apr-2013 18:14:09] ERROR: FPM initialization failed
原因是 [pool www] cannot get gid for group 'nobody' 没有这个用户 我之前编译的时候 指定用户 是 www 所以进入 vi /usr/local/php/etc/php-fpm.conf
修改
user = www
group = www
然后 测试PHP是否安装成功
在网站跟目录下 写入 一个测试 PHP是否安装成功的
我的nginx 根目录是 /usr/local/nginx/html/
sudo vi index.php
<?php phpinfo(); ?>
保存
然后测试下即可
编译安装 php 5.4.11的更多相关文章
- CentOS 6.7 final编译安装Python 2.7.11
CentOS 6.7默认的Python版本为2.6.6,现升级为Python 2.7.11 1.安装编译环境 yum groupinstall "Development tools" ...
- ubuntu 14.04 64位 下 编译安装MySQL 5.7.11
步骤一: 先去mysql的官方网站 去down 编译源码包 mysql 网址:www.mysql.com downloads (MySQL Community Server) 下载版本选择 sou ...
- galera安装之编译安装xtrabackup 2.2.11
----1.编译安装percona-xtrabackup yum -y install cmake gcc gcc-c++ libaio libaio-devel automake autoconf ...
- CentOS 7.2.1511编译安装Nginx1.10.1+MySQL5.7.14+PHP7.0.11
准备篇 一.防火墙配置 CentOS 7.x默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop firewalld.se ...
- mysql5.7.11编译安装以及修改root密码小结
系统是cenos6.7 64位的,默认mysql5.7.11下载到/usr/local/src,安装目录在/app/local/mysql目录下,mysql数据放置目录/app/local/data. ...
- Valgrind 3.11.0编译安装
Valgrind 3.11.0编译安装 Valgrind是一款用于内存调试.内存泄漏检测以及性能分析的软件开发工具. Valgrind遵守GNU通用公共许可证条款,是一款自由软件. 到3.3.0版本为 ...
- CentOS6.5编译安装最新MySQL 5.7.11
安装前工作:1,从官方网址下载MySQL5.7.11源码包,大概49M2,安装好CentOS6.5 64位操作系统.建议update操作系统,以便是此版本最新的3. yum -y install g ...
- Centos6.5 源码编译安装 Mysql5.7.11及配置
安装环境 Linux(CentOS6.5 版).boost_1_59_0.tar.gz.mysql-5.7.11.tar.gzMySQL 5.7主要特性: 更好的性能:对于多核CPU.固态硬盘. ...
- Ubuntu 11.10下GRUB 2 1.99版编译安装笔记
Ubuntu 11.10下GRUB 2 1.99版编译安装笔记 以下的安装笔记,都是QLi自己学习grub2 时,所整理的,还是新手,有错误的话,请大家帮忙就别提出来了. 最新版grub V1.99官 ...
随机推荐
- JavaScript clearInterval定时器失效原因
检查下是不是setInterval重复执行(两次以上<!-- 文件上传板块 --> <div id="adUploadWindow" class="ea ...
- 6,render的一些概念和可用库
一,概念解释 什么是渲染?这是高大上的说法,翻译成正常语言,就是把图像缓冲区的数据显示到屏幕的过程,就是渲染. 原理说白了很简单,但实际操作中有太多因素需要考量. OS/硬件提供的加速机制/解码后图像 ...
- maven 搭建企业级web项目
就看这篇文章了:http://www.cnblogs.com/quanyongan/archive/2013/05/28/3103243.html
- MySQL优化器join顺序
前一篇介绍了cost的计算方法,下面测试一下两表关联的查询: 测试用例 CREATE TABLE `xpchild` ( `id` int(11) NOT NULL, `name` varchar(1 ...
- MVC3 IIS7部署记录
环境 系统:Win7 IIS:IIS7 开发工具:VS2010 MVC版本:ASP.NET MVC 3.0 注意 1.在部署MVC应用之前,一定要确保你的程序BIN文件夹下面是否包含 System.W ...
- Phpwind v9.0 存储型xss跨站漏洞
漏洞版本: Phpwind v9.0 漏洞描述: Phpwind专注于中小网站应用的整合和价值的发掘,我们认为,以社区为网站的基础,可以提供丰富的应用,满足人们获取信息.交流.娱乐.消费等生活需求.获 ...
- ASP.NET使用EasyUI-DataGrid + ashx + JQuery Ajax:实现数据的增删查改,查询和分页!
转自:http://www.cnblogs.com/lt-style/p/3457399.html 数据表: 学生表:学生编号.姓名.性别.班级编号.年龄 班级表:班级编号.班级名称 开发过程: 1. ...
- (转载)javascript经典例子
(转载)http://www.blogjava.net/hadeslee/archive/2007/11/24/161778.html 一.验证类1.数字验证内1.1 整数1.2 大于0的整数 (用于 ...
- (转载)Linux下IPTABLES防火墙的设定
(转载)http://www.jefflei.com/post/1760.html 1.iptables防火墙启动和停止 启动iptables防火墙时命令行输入 #service iptables s ...
- gnome设置dvorak键盘布局
若桌面环境为gnome,设置Dvorak键盘程序员布局很简单.系统设置 -> 键盘 -> 布局设置 -> 点击"+" ->选择"英语(适合程序员的 ...