11月13日任务
11.10/11.11/11.12 安装PHP5
11.13 安装PHP7
- PHP官网www.php.net
- 当前主流版本为5.6/7.1
- cd /usr/local/src/
- wget http://cn2.php.net/distributions/php-5.6.32.tar.bz2
- tar zxf php-5.6.30.tar.gz
- cd php-5.6.30
- ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.4/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
- make && make install
- cp php.ini-production /usr/local/php/etc/php.ini
#安装过程
[root@zgxlinux-01 ~]# cd /usr/local/src/
[root@zgxlinux-01 src]# wget http://cn2.php.net/distributions/php-5.6.32.tar.bz2
[root@zgxlinux-01 src]# tar -jxvf php-5.6.32.tar.bz2
[root@zgxlinux-01 src]# ls
php-5.6.32 php-5.6.32.tar.bz2
[root@zgxlinux-aliyun php-5.6.32]# cd php-5.6.32
[root@zgxlinux-aliyun php-5.6.32]#[root@zgxlinux-01 php-5.6.32]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.4.37/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
#根据报错信息,来安装缺少的包,安装完后重新执行。
[root@zgxlinux-01 php-5.6.32]# yum install -y libxml2-devel
[root@zgxlinux-01 php-5.6.32]# yum install -y openssl-devel
[root@zgxlinux-01 php-5.6.32]# yum install -y bzip2-devel
[root@zgxlinux-01 php-5.6.32]# yum install -y libjpeg-devel
[root@zgxlinux-01 php-5.6.32]# yum install libpng-devel
[root@zgxlinux-01 php-5.6.32]# yum install -y freetype-devel
[root@zgxlinux-01 php-5.6.32]# yum install -y libmcrypt-devel
#经过一番折腾,终于看到这个界面表示已经安装完了。接下来执行make && make install ,这个过程比较漫长。
[root@zgxlinux-01 php-5.6.32]# make && make install
[root@zgxlinux-01 php-5.6.32]# echo $?
0
#经过漫长的等待终于大功告成。接下来看看php目录。
[root@zgxlinux-01 php-5.6.32]# ls /usr/local/php/
bin etc include lib php
[root@zgxlinux-01 php-5.6.32]# ls /usr/local/php/bin/
pear pecl phar.phar php-cgi phpize
peardev phar php php-config
[root@zgxlinux-01 php-5.6.32]# du -sh /usr/local/php/bin/php
36M /usr/local/php/bin/php
[root@zgxlinux-01 php-5.6.32]# du -sh /usr/local/apache2.4.37/modules/libphp5.so
36M /usr/local/apache2.4.37/modules/libphp5.so
#查看php加载了那些模块
[root@zgxlinux-01 php-5.6.32]# /usr/local/php/bin/php -m
[PHP Modules]
bz2
Core
ctype
date
dom
ereg
exif
fileinfo
filter
gd
hash
iconv
json
libxml
mbstring
mcrypt
mysql
mysqli
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
Reflection
session
SimpleXML
soap
sockets
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zlib
[Zend Modules]
[root@zgxlinux-01 php-5.6.32]# /usr/local/apache2.4.37/bin/httpd -
M
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::8309:40e5:5360:fcbd. Set the 'ServerName' directive globally to suppress this message
Loaded Modules:
core_module (static)
so_module (static)
http_module (static)
mpm_event_module (static)
authn_file_module (shared)
authn_core_module (shared)
authz_host_module (shared)
authz_groupfile_module (shared)
authz_user_module (shared)
authz_core_module (shared)
access_compat_module (shared)
auth_basic_module (shared)
reqtimeout_module (shared)
filter_module (shared)
mime_module (shared)
log_config_module (shared)
env_module (shared)
headers_module (shared)
setenvif_module (shared)
version_module (shared)
unixd_module (shared)
status_module (shared)
autoindex_module (shared)
dir_module (shared)
alias_module (shared)
php5_module (shared) #这说明php是作为apache的一个模块存在的。
[root@zgxlinux-01 php-5.6.32]# ls -l /usr/local/apache2.4.37/modules/libphp5.so
-rwxr-xr-x 1 root root 37735552 11月 14 22:08 /usr/local/apache2.4.37/modules/libphp5.so
[root@zgxlinux-01 php-5.6.32]# vim /usr/local/apache2.4.37/conf/httpd.conf
11.13 安装PHP7
- cd /usr/local/src/
- wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2
- tar zxf php-7.1.6.tar.bz2
- cd php-7.1.6
- ./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2.4/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
- make && make install
- ls /usr/local/apache2.4/modules/libphp7.so
- cp php.ini-production /usr/local/php7/etc/php.ini