时间:2021-07-01 10:21:17 帮助过:17人阅读
1.编译安装
./configure --prefix=/usr/local/php\--with-config-file-path=/usr/local/php/etc --with-bz2--with-curl\--enable-ftp--enable-sockets--disable-ipv6--with-gd\--with-jpeg-dir=/usr/local--with-png-dir=/usr/local\--with-freetype-dir=/usr/local--enable-gd-native-ttf\--with-iconv-dir=/usr/local--enable-mbstring--enable-calendar\--with-gettext--with-libxml-dir=/usr/local--with-zlib\--with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd \--enable-dom--enable-xml--enable-fpm--with-libdir=lib64 --enable-bcmath
make && make install
2.错误处理
[ERROR]-1
checking for ZLIB support... nochecking if the location of ZLIB install directory is defined... yesconfigure: error: Cannot find libz
[ERROR]-2
checking whether to enable JIS-mapped Japanese font support in GD... no
If configure fails try --with-vpx-dir=<DIR>configure: error: jpeglib.h not found.
【解决办法】
wget http://www.boutell.com/gd/http/gd-2.0.33.tar.gz
tar zxvf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure --prefix=/usr/local/gd2
make
make instal
在网上找到了libjpeg,可以用这个库实现JPG图片的各种操作;下载:http://freeware.sgi.com/source/libjpeg/libjpeg-6b.tar.gz,
参考README安装库,大体步骤如下:
./configure
Make
Make install
[ERROR]-3
If configure fails try --with-xpm-dir=<DIR>configure: error: freetype-confignot found.
[ERROR]-4
checking whether to enable JIS-mapped Japanese font support in GD... no
configure: error: vpx_codec.h not found.
[Bzip2 Install]
tar -xzvf bzip2-1.0.6.tar.gz
进入解压后的目录:cd bzip2-1.0.6
为编译做准备,创建libbz2.so动态链接库(这一步很重要,安装python的时候如果没有这一步,python安装不上bz2模块):
make -f Makefile-libbz2_so
编译安装: make && make install
二、RPM安装
[root@kallen ~]# rpm -ivh php-common-5.4.40-1.el6.remi.x86_64.rpm
warning: php-common-5.4.40-1.el6.remi.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
Preparing... ########################################### [100%]file /etc/php.ini from install of php-common-5.4.40-1.el6.remi.x86_64 conflicts withfilefrom package php-common-5.3.3-26.el6.x86_64
file /usr/lib64/php/modules/curl.so from install of php-common-5.4.40-1.el6.remi.x86_64 conflicts withfilefrom package php-common-5.3.3-26.el6.x86_64
file /usr/lib64/php/modules/fileinfo.so from install of php-common-5.4.40-1.el6.remi.x86_64 conflicts withfilefrom package php-common-5.3.3-26.el6.x86_64
file /usr/lib64/php/modules/json.so from install of php-common-5.4.40-1.el6.remi.x86_64 conflicts withfilefrom package php-common-5.3.3-26.el6.x86_64
file /usr/lib64/php/modules/phar.so from install of php-common-5.4.40-1.el6.remi.x86_64 conflicts withfilefrom package php-common-5.3.3-26.el6.x86_64
file /usr/lib64/php/modules/zip.so from install of php-common-5.4.40-1.el6.remi.x86_64 conflicts withfilefrom package php-common-5.3.3-26.el6.x86_64
error: Failed dependencies:
libmysqlclient.so.18()(64bit) is needed by php-mysql-5.4.40-1.el6.remi.x86_64
libmysqlclient.so.18(libmysqlclient_16)(64bit) is needed by php-mysql-5.4.40-1.el6.remi.x86_64
libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by php-mysql-5.4.40-1.el6.remi.x86_64
三、YUM安装
1.PHP-5.4
php5.4于2012年5月8号发布,从php5.4.0开始php加入了一些新特色如:
- Traits支持
- 内置了一个简单的Web服务器
- 提供了数组简短语法
- 直接对函数返回值进行数组取值
- 最终删除魔术方法及安全模式
推荐使用 Webtatic EL6的YUM源来安装php5.4,我们首先安装Webtatic EL6 YUM源,关于YUM源的安装配置请参考《在RHEL6中配置YUM源》一文;
rpm -Uvh http://repo.webtatic.com/yum/el6/latest.rpm
yum -y install php54w php54w-bcmath php54w-cli\
php54w-common php54w-devel php54w-fpm php54w-gd\
php54w-imap php54w-ldap php54w-mbstring php54w-mcrypt\
php54w-mysql php54w-odbc php54w-pdo php54w-pear\
php54w-pecl-igbinary php54w-xml php54w-xmlrpc\
php54w-opcache php54w-intl php54w-pecl-memcache
如果安装失败,建议您先卸载以前的php再进行安装,使用
yum remove php php-*
附带的php扩展列表:
Package | Provides |
---|---|
php54w mod_php | |
php54w-bcmath | |
php54w-cli | php-cgi, php-pcntl, php-readline |
php54w-common | php-api, php-bz2, php-calendar, php-ctype, php-curl, php-date, php-exif, php-fileinfo, php-ftp, php-gettext, php-gmp, php-hash, php-iconv, php-json, php-libxml, php-openssl, php-pcre, php-pecl-Fileinfo, php-pecl-phar, php-pecl-zip, php-reflection, php-session, php-shmop, php-simplexml, php-sockets, php-spl, php-tokenizer, php-zend-abi, php-zip, php-zlib |
php54w-dba | |
php54w-devel | |
php54w-embedded | php-embedded-devel |
php54w-enchant | |
php54w-fpm | |
php54w-gd | |
php54w-imap | |
php54w-interbase | php_database, php-firebird |
php54w-intl | |
php54w-ldap | |
php54w-mbstring | |
php54w-mcrypt | |
php54w-mssql | |
php54w-mysql | php-mysqli, php_database |
php54w-odbc | php-pdo_odbc, php_database |
php54w-pdo | |
php54w-pgsql | php-pdo_pgsql, php_database |
php54w-process | php-posix, php-sysvmsg, php-sysvsem, php-sysvshm |
php54w-pspell | |
php54w-recode | |
php54w-snmp | |
php54w-soap | |
php54w-tidy | |
php54w-xml | php-dom, php-domxml, php-wddx, php-xsl |
php54w-xmlrpc | |
php54w-zts |
[root@kallen ~]# yum install php54w-gd.x86_64
Loaded plugins: product-id, security, subscription-manager
This system isnot registered to Red Hat Subscription Management. You can use subscription-manager toregister.
Setting up Install Process
Resolving Dependencies
--> Running transaction check---> Package php54w-gd.x86_64 0:5.4.41-1.w6 will be installed--> Processing Dependency: libt1.so.5()(64bit)for package: php54w-gd-5.4.41-1.w6.x86_64--> Finished Dependency Resolution
Error: Package: php54w-gd-5.4.41-1.w6.x86_64 (webtatic)
Requires:libt1.so.5()(64bit)
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
解决办法:
[root@kallen ~]# rpm -ivh t1lib-5.1.2-6.el6_2.1.x86_64.rpm warning: t1lib-5.1.2-6.el6_2.1.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [100%]1:t1lib ########################################### [100%]
2.PHP-5.5
[root@kallen ~]# yum remove php php-bcmath php-cli php-common php-devel php-fpm php-gd php-imap php-ldap php-mbstring php-mcrypt php-mysql php-odbc php-pdo php-pear php-pecl-igbinary php-xml php-xmlrpc
[root@kallen ~]# yum install php55w php55w-bcmath php55w-cli php55w-common php55w-devel php55w-fpm php55w-gd php55w-imap php55w-ldap php55w-mbstring php55w-mcrypt php55w-mysql php55w-odbc php55w-pdo php55w-pear php55w-pecl-igbinary php55w-xml php55w-xmlrpc php55w-opcache php55w-intl php55w-pecl-memcache
四、版本测试
1.查看PHP版本信息
kallen@kallen:~$ php -v
PHP 5.5.9-1ubuntu4.11 (cli) (built: Jul 2201515:23:08)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
phpinfo();
?>
2.查看PHP已安装模块
kallen@kallen:~$ php -m
[PHPModules]
bcmath
bz2
calendar
Core
ctype
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
ldap
libxml
mbstring
mhash
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_pgsql
pgsql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
ZendOPcache
zip
zlib
[ZendModules]
ZendOPcache
3.MySQL连接测试
$link=mysql_connect('localhost','root','*');
if(!$link)
echo"Connection Error!";
elseecho"Connected Successfully!"
mysql_close();
?>
未完续待!
版权声明:本文为博主原创文章,未经博主允许不得转载|Copyright ©2011-2015, Kallen Ding, All Rights Reserved.
以上就介绍了LNMP环境搭建——PHP篇,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。