linux系统下源码安装PHP5.6

linux系统下源码安装PHP5.6




从php5.4开始,需要自己下载安装libXpm-dev了,但是由于包的依赖性原因,我就选择了yum方式来进行安装,通过网络yum源直接下载并进行安装了


下载php以及相关的库文件(百度网盘:http::/pan.baidu.com/s/1bnL31c7)

gd库以及php功能特性扩展库文件

libgd-2.1.1.tar.gz        gd库文件(使php支持以下功能)    

jpegsrc.v7.tar.gz         jpeg库文件(使php支持jpeg格式图片)

zlib-1.2.7.tar.gz         数据压缩函数库(使php支持数据压缩功能)      

freetype-2.6.tar.gz       freetype库文件(使php支持多种字体格式文件

libpng-1.2.56.tar.gz      libpng库文件(使php支持png格式图片)


安装libXpm

yum -y install libXpm安装完后libXpm配置文件下这个目录/usr/lib64/下

安装autoconf-2.69.tar.gzauto

[[email protected] LAMP-php]# tar -zxvf autoconf-2.69.tar.gz 
[[email protected] LAMP-php]# cd autoconf-2.69
[[email protected] autoconf-2.69]# ./configure 
[[email protected] autoconf-2.69]# make ; make install

安装 libxml2-2.7.8.tar.gz

[[email protected] LAMP-php]# tar -zxvf libxml2-2.7.8.tar.gz 
[[email protected] LAMP-php]# cd libxml2-2.7.8     将$RM "cfgfile"这行用#注释
[[email protected] libxml2-2.7.8]# ./configure --prefix=/usr/local/libxml2
[[email protected] libxml2-2.7.8]# make ; make install

安装libmcrypt-2.5.8.tar.gz

[[email protected] LAMP-php]# tar -zxvf libmcrypt-2.5.8.tar.gz 
[[email protected] LAMP-php]# cd libmcrypt-2.5.8
[[email protected] libmcrypt-2.5.8]# ./configure --prefix=/usr/local/libmcrypt
[[email protected] libmcrypt-2.5.8]# make ; make install

安装zlib-1.2.7.tar.gz

[[email protected] LAMP-php]# tar -zxvf zlib-1.2.7.tar.gz 
[[email protected] LAMP-php]# cd zlib-1.2.7
[[email protected] zlib-1.2.7]# ./configure --prefix=/usr/local/zlib
[[email protected] zlib-1.2.7]# make ; make install

安装 libpng-1.2.56.tar.gz

[[email protected] LAMP-php]# tar -zxvf libpng-1.2.56.tar.gz
[[email protected] LAMP-php]# cd libpng-1.2.56
[[email protected] libpng-1.2.56]# ./configure --prefix=/usr/local/libpng
[[email protected] libpng-1.2.56]# make ; make install

安装jpegsrc.v7.tar.gz

[[email protected] LAMP-php]# tar -zxvf jpegsrc.v7.tar.gz  
[[email protected] LAMP-php]# cd jpeg-7/
[[email protected] jpeg-7]# mkdir /usr/local/jpeg6                    建立jpeg6软件安装目录
[[email protected] jpeg-7]# mkdir /usr/local/jpeg6/bin                建立存放命令的目录
[[email protected] jpeg-7]# mkdir /usr/local/jpeg6/lib                创建jpeg6库文件所在目录
[[email protected] jpeg-7]# mkdir /usr/local/jpeg6/include            建立存放头文件目录
[[email protected] jpeg-7]# mkdir -p /usr/local/jpeg6/man/man1        建立存放手册目录
[[email protected] jpeg-7]# ./configure > --prefix=/usr/local/jpeg6/ \  
> --enable-shared \    建立共享库使用的GNUd libtool
> --enable-static      建立静态库使用的GNUlibtool
./configure --prefix=/usr/local/jpeg6/ --enable-shared  --enable-static

[[email protected] jpeg-7]# make ; make install

安装freetype-2.6.tar.gz

[[email protected] LAMP-php]# tar -zxvf freetype-2.6.tar.gz 
[[email protected] LAMP-php]# cd freetype-2.6
[[email protected] freetype-2.6]# ./configure --prefix=/usr/local/freetype
[[email protected] freetype-2.6]# make ; make install

安装gd-2.0.32.tar.gz

[[email protected] LAMP-php]# tar -zxvf gd-2.0.32.tar.gz
[[email protected] LAMP-php]# cd gd-2.0.32
[[email protected] gd-2.0.32]# ./configure \  进入vim gd_png.c 将16行改为#include "/usr/local/libpng/include/png.h"
> --prefix=/usr/local/gd2/ \                       gd库文件安装目录
> --with-zlib=/usr/local/zlib/ \                   指定zlib安装路径
> --with-jpeg=/usr/local/jpeg6/ \                  指定jpeg6安装路径
> --with-png=/usr/local/libpng/ \                  指定libpng安装路径
> --with-freetype=/usr/local/freetype/             指定freetype安装路径

./configure --prefix=/usr/local/gd2/ --with-zlib=/usr/local/zlib/ --with-jpeg=/usr/local/jpeg6/ --with-png=/usr/local/libpng/ --with-freetype=/usr/local/freetype

[[email protected] gd-2.0.32]# make ; make install

安装PHP

[[email protected] AMP]# tar -zxvf php-5.6.9.tar.gz
[[email protected] AMP]# cd php-5.6.9
[[email protected] php-5.6.9]# ./configure \                        执行当前目录下软件自带的配置命令
> --prefix=/usr/local/php \                                设置PHP5的安装路径
> --with-config-file-path=/usr/local/php/etc \             指定PHP5配置文件存入的路径
> --with-apxs2=/usr/local/apache2/bin/apxs \               指定PHP查找Apache2的位置
> --with-mysql=/usr/local/mysql/ \                         指定mysql的安装目录
> --with-libxml-dir=/usr/local/libxml2/ \                  指定php放置libxml2库的位置
> --with-png-dir=/usr/local/libpng/ \                      指定php放置libpng库的位置
> --with-jpeg-dir=/usr/local/jpeg6/ \                      指定php放置jpeg库的位置
> --with-freetype-dir=/usr/local/freetype/ \               指定php放置freetype库的位置
> --with-gd=/usr/local/gd2/ \                              指定php放置gd库的位置
> --with-zlib-dir=/usr/local/zlib/ \                       指定php放置zlib库的位置
> --with-mcrypt=/usr/local/libmcrypt/ \                    指定php放置libcrypt库的位置
> --with-mysql=/usr/local/mysql/bin/mysql_config  \        变量激活新增加mysqli功能
> --enable-soap \                                          变量激活soap和web services支持
> --enable-mbstring=all \                                  使多字节字符串支持
> --enable-sockets                                         变量激活socket通信特性

[[email protected] php-5.6.9]# ./configure  --prefix=/usr/local/php  --with-config-file-path=/usr/local/php/etc  --with-apxs2=/usr/local/apache2/bin/apxs  --with-mysql=/usr/local/mysql --with-libxml-dir=/usr/local/libxml2 --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg6 --with-freetype-dir=/usr/local/freetype --with-gd=/usr/local/gd2 --with-zlib-dir=/usr/local/zlib --with-mcrypt=/usr/local/libmcrypt  --with-xpm-dir=/usr/lib64/ --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-soap --enable-mbstring=all --enable-sockets 
[[email protected] php-5.6.9]# make ; make install

配置php

cp php.ini-development /usr/local/php/etc/php.ini  创建php配置文件

配置Apache

进入Apache主配置文件/etc/httpd/http.conf中加入
Addtype application/x-httpd-php .php 
.phtmlAddType application/x-httpd-php .php .php4 .php5

创建php测试文件

cp php.ini-development /usr/local/php/etc/php.ini  创建php配置文件
创建kdir /usr/local/apache2/htdocs/test.php
进入test.php编辑
<?php
        phpinfo();
?>

重启Apache,使设置生效

[[email protected] php-5.6.9]# service httpd restart

打开网页,输入网址http://ip:test.php

看到php的版本信息网页,表示测试成功!!!



至此php的源码安装就到此结束了

时间: 2024-08-04 14:10:11

linux系统下源码安装PHP5.6的相关文章

Linux系统下源码安装rz/sz命令

背景:在windows环境下,使用xshell远程连接公司内部做的一个类似centos的系统,但该linux系统yum install有问题,只能源码安装. root 账号登陆后,依次执行以下命令: cd /data  建立放安装包的目录 wget http://www.ohse.de/uwe/releases/lrzsz-0.12.20.tar.gz tar zxvf lrzsz-0.12.20.tar.gz && cd lrzsz-0.12.20 ./configure &&a

在 Linux 系统上源码安装 GTK+ 2.0

在 Linux 系统上源码安装 GTK+ 2.0==================================================Keywords: GTK+, Install, Linux, SourceAuthor:       whyglinux (whyglinux AT hotmail DOT com)Date:          2007-01-07==================================================目录0. 前言1.

Linux平台下源码安装mysql多实例数据库

Linux平台下源码安装mysql多实例数据库[[email protected] ~]# netstat -tlunp | grep 330tcp6 0 0 :::3306 :::* LISTEN 6191/mysqld [[email protected] ~]# ss -tlunp | grep 330tcp LISTEN 0 80 :::3306 :::* users:(("mysqld",pid=6191,fd=10)) [[email protected] ~]# syst

Linux环境下源码安装PostgreSQL

1.下载PostgreSQL源码包,并保存到Linux操作系统的一个目录下 2.解压PostgreSQL源码包 :tar zxvf postgresql-9.2.4.tar.gz 或 tar jxvf postgresql-9.2.4.tar.bz2 3,切换到刚刚解压的目录下:cd postgresql-9.2.4 4. ./configure 如果遇到错误,则需要如下安装依赖工具包(按需安装) yum install gcc yum install readline yum install

在linux系统上源码安装httpd前的准备

1.1 前期准备apt-get install lrzszapt-get install gcc //yum install -y gcc gcc-c++apt-get updateapt-get install build-essential 1.2 aprwget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.5.2.tar.gztar zxvf apr-1.5.2.tar.gzcd apr-1.5.2/./configure m

CentOS 6.5下源码安装LAMP(Linux+Apache+Mysql+Php)环境

CentOS 6.5下源码安装LAMP(Linux+Apache+Mysql+Php)环境一. 系统环境:Linux系统版本: CentOS release 6.5Apache版本: httpd-2.2.24PHP 版本: php-5.6.11 二.安装前准备: 1.查看是否安装GCC ,GCC-C++编译器,如果没有则进行安装: 查看是否安装的命令: #gcc –v 若未安装在服务器联网情况下可以使用下列命令安装: #yum install gcc #yum install gcc-c++2.

Linux下源码安装CodeBlocks

Linux下源码安装CodeBlocks qianghaohao(CodingNutter) 一. 安装平台说明: CentOs6.4-i686  gcc-4.4.7 二. 下载最新源码: http://www.codeblocks.org/downloads 在此安装的是最新版:Code::Blocks 16.01 三. 阅读官方安装说明文档: http://wiki.codeblocks.org/index.php/Installing_Code::Blocks_from_source_on

Linux下源码安装Mysql5.5

本文主要介绍了如何在源码安装mysql5.5,所用系统为CentOS6.5 一.安装相应的开发环境 yum install -y ncurses-devel yum install -y libaio yum install -y bison yum install -y gcc-c++ yum install -y openssl-devel 二.安装cmake 跨平台编译器 # tar xf cmake-2.8.8.tar.gz # cd cmake-2.8.8 # ./bootstrap

图解Linux下源码安装PHP7.0.9 +Nginx

上一次,在<Linux下源码安装php7.0.6>,安装过PHP7.0.3,本文将记录安装PHP7.0.9过程. 测试环境 Linux 2.6.32-279.el6.i686 nginx-1.9.15.tar http://nginx.org/download/nginx-1.9.15.tar.gz php-7.0.9.tar.gz http://am1.php.net/distributions/php-7.0.9.tar.gz 安装Nginx wget http://nginx.org/d