PHP5、PHP7安裝 原

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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章