学习linux第四十一天

php安装

[root@hanlinxy src]# wget http://cn2.php.net/distributions/php-5.6.32.tar.bz2
--2018-07-19 23:55:09-- http://cn2.php.net/distributions/php-5.6.32.tar.bz2
正在解析主机 cn2.php.net (cn2.php.net)... 36.51.255.144
正在连接 cn2.php.net (cn2.php.net)|36.51.255.144|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:15055569 (14M) [application/octet-stream]
正在保存至: “php-5.6.32.tar.bz2”

100%[==================================================================================

2018-07-19 23:55:50 (495 KB/s) - 已保存 “php-5.6.32.tar.bz2” [15055569/15055569])

[root@hanlinxy src]# tar -jxvf php-5.6.32.tar.bz2

编译php5.6

[root@hanlinxy src]# cd php-5.6.32/
[root@hanlinxy php-5.6.32]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --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/apache2.4/bin/apxs follows:
./configure: line 8417: /usr/local/apache2.4/bin/apxs: No such file or directory
configure: error: Aborting

 

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指定到正确路径

 

报错信息:

checking for xml2-config path... 
configure: error: xml2-config not found. Please check your libxml2 installation.
[root@hanlinxy php-5.6.32]# yum list |grep libxml2

libxml2.x86_64 2.9.1-6.el7_2.3 @anaconda
libxml2-python.x86_64 2.9.1-6.el7_2.3 @anaconda
libxml2.i686 2.9.1-6.el7_2.3 base 
libxml2-devel.i686 2.9.1-6.el7_2.3 base 
libxml2-devel.x86_64 2.9.1-6.el7_2.3 base 
libxml2-static.i686 2.9.1-6.el7_2.3 base 
libxml2-static.x86_64 2.9.1-6.el7_2.3 base 
mingw32-libxml2.noarch 2.9.3-1.el7 epel 
mingw32-libxml2-static.noarch 2.9.3-1.el7 epel 
mingw64-libxml2.noarch 2.9.3-1.el7 epel 
mingw64-libxml2-static.noarch 2.9.3-1.el7 epel 

[root@hanlinxy php-5.6.32]# yum -y install libxml2-devel.x86_64 

 

报错信息:

 

configure: error: Cannot find OpenSSL's <evp.h>
[root@hanlinxy php-5.6.32]# echo $?
1

 

[root@hanlinxy php-5.6.32]# yum -y install openssl openssl-devel
 

报错信息

 

checking for BZip2 in default path... not found
configure: error: Please reinstall the BZip2 distribution
[root@hanlinxy php-5.6.32]# yum -y install bzip2 bzip2-devel

报错信息

 

configure: error: jpeglib.h not found.
 

[root@hanlinxy php-5.6.32]# yum -y install libjpeg-devel
 

报错信息

 

configure: error: png.h not found.
[root@hanlinxy php-5.6.32]# yum install -y libpng libpng-devel

 

报错信息

 

configure: error: freetype-config not found.
[root@hanlinxy php-5.6.32]# yum install -y freetype freetype-devel

 

报错信息

 

configure: error: mcrypt.h not found. Please reinstall libmcrypt.
[root@hanlinxy php-5.6.32]# yum -y install libmcrypt-devel

 

 

Thank you for using PHP.

config.status: creating php5.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands
[root@hanlinxy php-5.6.32]# echo $?
0
make && make install

php安装成功

 

 

 

php7安装

 

[root@hanlinxy src]# wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2
[root@hanlinxy src]# tar jxvf php-7.1.6.tar.bz2 

[root@hanlinxy src]# cd php-7.1.6/

[root@hanlinxy php-7.1.6]# ./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php7/etc  --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif

 

+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+

Thank you for using PHP.

config.status: creating php7.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands

 

make && make install

[root@hanlinxy conf]# vim /usr/local/apache2/conf/httpd.conf

LoadModule php5_module modules/libphp5.so (不想用php7可以自己注释掉)

 

[root@hanlinxy conf]# cd /usr/local/apache2/modules (查询apache下面有哪些集成模块)
[root@hanlinxy modules]# ls
httpd.exp libphp5.so

 

转载于:https://my.oschina.net/u/3867255/blog/1920532

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值