网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 服务器与数据库 > 服务器环境搭建
User Name
Password
 
FAQ Members List Calendar Cheap Glasses Mark Forums Read

服务器环境搭建 Windows,Linux,IIS,Apache等服务器配置、安全维护以及PHP和MYSQL运行环境讨论。

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   IP: 117.95.50.87
Old 2016-05-30, 05:36 AM
Alco Alco is offline
初级会员
 
Join Date: 2007-01-18
Posts: 1
Alco 现在声名狼藉
Default Centos 6.6系统下编译安装PHP5.6.8教程

首先准备几个安装包
libmcrypt-2.5.8.tar.gz(http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/)
php-5.6.2.tar.gz (http://cn2.php.net/downloads.php)


1.首先添加依赖应用
yum install -y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses curl openssl-devel gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c xmlrpc-c-devel
这一步是为了支持一些php运行的东西,还有以下编译需要的
2.安装加密扩展库
cd /usr/local/src/
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
make install
3.到php压缩包存放的目录下
tar zxvf php-5.6.8.tar.gz #解压
cd php-5.6.8 #进入文件夹
运行
[root@VPS php-5.6.8]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-mysql-sock --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-fpm --with-ncurses --enable-soap --with-libxml-dir --with-XMLrpc --with-openssl --with-mcrypt --with-mhash --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --disable-mbregex --disable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-pdo-mysql --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sqlite-utf8 --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --enable-mysqlnd-compression-support --with-pear
这一步不能有错误,警告可能会有,是说某些包不能识别之类的,一般没有很大问题
执行
make
显示
Build complete.
Don't forget to run 'make test'.


如果显示: undefined reference to `ts_resource_ex'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] 错误 1

出现这样的错误信息是我之前用不同的参数编译过PHP。

解决方法:执行make clean删除上次的编译结果,然后再重新编译就OK了。

如果是你第一次编译就出现这样的错误,百度解决。



执行
make install
最后就是配置apache让它支持php

修改apache的配置文件httpd.conf
vi /usr/local/apache/conf/httpd.conf
然后在文本最后面添加
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
(注意,在apache安装目录下,modules下有libphp5.so,这是php安装时添加进去的,如果没有,php,你需要重装下
生成libphp5.so文件的是./configure中的这段代码 --with-apxs2=/usr/local/apache/bin/apxs,路径要和你安装的路径对应
)


接下来复制php启动文件


cp php-5.6.3/php.ini-development /usr/local/php/lib/php.ini


保存,重新启动


service httpd start


如果没有报错则说明启动成功


测试php是否安装成功


写一个简单的php页面


<?php
phpinfo();
?>
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CentOS 6.4 电信ADSL拨号上网网络配置 topvip 服务器环境搭建 0 2016-05-28 07:51 PM
CentOS 6.4 电信ADSL拨号上网网络配置 Netawaka 服务器环境搭建 0 2016-05-28 07:43 PM
CentOS Linux 7.1 的 32 位版发布 Charles City Linux 0 2016-05-24 10:06 PM
PHP编译configure时常见错误 Iosco PHP 0 2016-05-23 08:59 AM
CentOS 6.4安装Apache+MySQL+PHP的图文教程 Chesapeake 服务器环境搭建 0 2016-05-19 05:09 PM

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 07:29 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.