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
[root@end LAMP-php]# tar -zxvf autoconf-2.69.tar.gz [root@end LAMP-php]# cd autoconf-2.69[root@end autoconf-2.69]# ./configure [root@end autoconf-2.69]# make ; make install
安装 libxml2-2.7.8.tar.gz
[root@end LAMP-php]# tar -zxvf libxml2-2.7.8.tar.gz [root@end LAMP-php]# cd libxml2-2.7.8 将$RM "cfgfile"这行用#注释[root@end libxml2-2.7.8]# ./configure --prefix=/usr/local/libxml2[root@end libxml2-2.7.8]# make ; make install
安装libmcrypt-2.5.8.tar.gz
[root@end LAMP-php]# tar -zxvf libmcrypt-2.5.8.tar.gz [root@end LAMP-php]# cd libmcrypt-2.5.8[root@end libmcrypt-2.5.8]# ./configure --prefix=/usr/local/libmcrypt[root@end libmcrypt-2.5.8]# make ; make install
安装zlib-1.2.7.tar.gz
[root@end LAMP-php]# tar -zxvf zlib-1.2.7.tar.gz [root@end LAMP-php]# cd zlib-1.2.7[root@end zlib-1.2.7]# ./configure --prefix=/usr/local/zlib[root@end zlib-1.2.7]# make ; make install
安装 libpng-1.2.56.tar.gz
[root@end LAMP-php]# tar -zxvf libpng-1.2.56.tar.gz[root@end LAMP-php]# cd libpng-1.2.56[root@end libpng-1.2.56]# ./configure --prefix=/usr/local/libpng[root@end libpng-1.2.56]# make ; make install
安装jpegsrc.v7.tar.gz
[root@end LAMP-php]# tar -zxvf jpegsrc.v7.tar.gz [root@end LAMP-php]# cd jpeg-7/[root@end jpeg-7]# mkdir /usr/local/jpeg6 建立jpeg6软件安装目录[root@end jpeg-7]# mkdir /usr/local/jpeg6/bin 建立存放命令的目录[root@end jpeg-7]# mkdir /usr/local/jpeg6/lib 创建jpeg6库文件所在目录[root@end jpeg-7]# mkdir /usr/local/jpeg6/include 建立存放头文件目录[root@end jpeg-7]# mkdir -p /usr/local/jpeg6/man/man1 建立存放手册目录[root@end jpeg-7]# ./configure \> --prefix=/usr/local/jpeg6/ \ > --enable-shared \ 建立共享库使用的GNUd libtool> --enable-static 建立静态库使用的GNUlibtool./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static[root@end jpeg-7]# make ; make install
安装freetype-2.6.tar.gz
[root@end LAMP-php]# tar -zxvf freetype-2.6.tar.gz [root@end LAMP-php]# cd freetype-2.6[root@end freetype-2.6]# ./configure --prefix=/usr/local/freetype[root@end freetype-2.6]# make ; make install
安装gd-2.0.32.tar.gz
[root@end LAMP-php]# tar -zxvf gd-2.0.32.tar.gz[root@end LAMP-php]# cd gd-2.0.32[root@end 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[root@end gd-2.0.32]# make ; make install
安装PHP
[root@end AMP]# tar -zxvf php-5.6.9.tar.gz[root@end AMP]# cd php-5.6.9[root@end 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通信特性[root@end 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 [root@end 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,使设置生效
[root@localhost php-5.6.9]# service httpd restart
打开网页,输入网址http://ip:test.php
看到php的版本信息网页,表示测试成功!!!
至此php的源码安装就到此结束了

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Following its high-profile acquisition by Facebook in 2012, Instagram adopted two sets of APIs for third-party use. These are the Instagram Graph API and the Instagram Basic Display API.As a developer building an app that requires information from a

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio
