本文共 1521 字,大约阅读时间需要 5 分钟。
四、Linux 6 下编译安装 PHP 5.6实例详解
PHP(外文名:PHP: Hypertext Preprocessor,中文名:“超文本预处理器”)是一种通用开源脚本语言。语法吸收了C语言、Java和Perl的特点,利于学习,使用广泛,主要适用于Web开发领域。PHP以其开发源代码,免费,快捷,跨平台,高效,面向对象,强大的动态图像创建等功能深受广大开发者的喜爱。
1、下载php安装包
wget http://cn2.php.net/distributions/php-5.6.32.tar.bz2
2、安装,安装过程中可能需要依据提示不断的安装依赖包
# tar -jxvf php-5.6.32.tar.bz2
# cd php-5.6.32
./configure --prefix=/usr/local/php --with-apxs2=/usr/sbin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql --with-pdo-mysql --with-mysqli --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif
报错处理:
Sorry, I cannot run apxs. Possible reasons follow:
1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)
The output of /usr/local/apache/bin/apxs follows:./configure: line 6669: /usr/local/apache/bin/apxs:
No such file or directoryconfigure: error: Aborting
解决方法:根据英文提示我们可以看到如下几点:perl没有安装,指定正确的apxs路径
于是进行如下操作
#yum install -y perl*
#yum install -y httpd-devel
#find / -name apxs 得到的路径是:/usr/sbin/apxs
于是修改--with-apsx2=/usr/sbin/apxs指定到正确路径
最后正确执行
#make
#make test
#make install
如何查看安装完成?
httpd下新增了php模块
php需要service启动吗?
apache是利用apxs加载的模块,apxs 是一个为Apache HTTP服务器编译和安装扩展模块的工具,用于编译一个或多个源程序或目标代码文件为动态共享对象,使之可以用由mod_so 提供的LoadModule 指令在运行时加载到Apache服务器中。
顾php是apache的一个模块,不需要手动service启动。转载地址:http://bclof.baihongyu.com/