关闭

php5环境安装

2780人阅读 评论(0) 收藏 举报
1. 安装Apache

2. 安装mysql

3. 安装php
  • freetype安装
     #tar -zxvf freetype-2.4.4.tar.gz
     #cd freetype-2.4.4
     #./configure --prefix=/usr/local/freetype
     #make
     #make install
  • zib安装
     #tar -zxvf zlib-1.2.5.tar.gz
     #cd zlib-1.2.5
     #./configure --prefix=/usr/local/zlib --shared
     #make
     #make install
  • libpng安装
     #tar -zxvf libpng-1.5.4.tar.gz
     #cd libpng-1.5.4
     #./configure --prefix=/usr/local/libpng
     #make
     #make install
  • jpeg的安装
     #tar -zxvf jpegsrc.v7.tar.gz
     #cd jpegsrc.v6b
     #./configure --prefix=/usr/local/jpeg7
     #make
     #make install

     注:不会自动创建文件夹,需要自己手动创建
  • gd库安装
     #tar -zxvf gd-2.0.35.tar.gz
     #cd gd-2.0.35
     #./configure --prefix=/usr/local/gd2 --with-freetype=/usr/local/freetype --with-png=/usr/local/libpng --with-jpeg=/usr/local/jpeg7
     #make
     #make install
  • libxml12安装
     #tar -zxvf libxml2-2.7.7.tar.gz
     #cd libxml2-2.7.7
     #./configure --prefix=/usr/local/libxml
     #make
     #make install
  • php安装
     #tar -zxvf php-5.4.0
#cd php-5.4.0
#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr --with-libxml-dir=/usr/local/libxm --with-zlib-dir=/usr/local/zlib --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg7 --with-freetype-dir=/usr/local/freetype --with-gd=/usr/local/gd2
注:一直报configure: error: Cannot find MySQL header files under /usr/include/mysql
查找文件 find / -name mysql.h
    未查找出结果,根据网上介绍继续安装 
MySQL-devel-5.5.22-1.linux2.6.i386.rpm

    find / -name mysql.h 显示为 /usr/include/mysql
    修改configure语句
     #./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/include/mysql --with-libxml-dir=/usr/local/libxm --with-zlib-dir=/usr/local/zlib --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg7 --with-freetyp-e-dir=/usr/local/freetype --with-gd=/usr/local/gd2
仍然报错,后继续在网上查找,发现是不是可以扩大目录,即/usr/include/mysql改/usr
尝试下:出现如下文字,成功???
+--------------------------------------------------------------------+
| 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.
 
继续编译
#make

报struct IOCtx 没有 'data' 成员,网上查了半天,找不到资料啊,悲剧了。试着不加入--with-gd,居然编译成功了。

#make test
#make install

安装结束了。

测试下安装是否成功。
#cp php.ini-development /usr/local/php/lib/php.ini
修改apache配置文件/usr/local/apache/conf/httpd.conf
# 添加对php的支持
LoadModule php5_module modules/libphp5.so(已经存在)
在AddType application/x-gzip .gz .tgz下一行加入
AddType application/x-httpd-php .php(添加)
重启apache
#/usr/local/apache2/bin/apachectl restart

如果报错,修改文件/usr/local/apache2/conf/httpd.conf
在Listen 80下一行加入:
ServerName localhost:80

再重启,然后编写测试页面。命名为test.php,内容如下:
<?php

phpinfo()

?>

将该页面放置在/usr/local/apache2/htdocs/目录下
在浏览器中输入http://IP/test.php
显示页面如下:

PHP Version 5.4.0


System Linux quqi 2.6.18-164.el5PAE #1 SMP Tue Aug 18 15:59:11 EDT 2009 i686
Build Date Mar 29 2012 08:50:13
Configure Command './configure' '--prefix=/usr/local/php' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysql=/usr' '--with-libxml-dir=/usr/local/libxm' '--with-zlib-dir=/usr/local/zlib' '--with-png-dir=/usr/local/libpng' '--with-jpeg-dir=/usr/local/jpeg7' '--with-freetype-dir=/usr/local/freetype' '--with-gd-dir=/usr/local/gd2'
Server API Apache 2.0 Handler
Virtual Directory Support enabled
Configuration File (php.ini) Path /usr/local/php/lib
Loaded Configuration File /usr/local/php/lib/php.ini
Scan this dir for additional .ini files (none)
Additional .ini files parsed (none)
PHP API 20100412
PHP Extension 20100525
Zend Extension 220100525
Zend Extension Build API220100525,TS
PHP Extension Build API20100525,TS
Debug Build no
Thread Safety enabled
Zend Signal Handling disabled
Zend Memory Manager enabled
Zend Multibyte Support disabled
IPv6 Support enabled
DTrace Support disabled
Registered PHP Streams compress.zlib, php, file, glob, data, http, ftp, phar
Registered Stream Socket Transports tcp, udp, unix, udg
Registered Stream Filters zlib.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk

Zend logo This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies


说明安装成功。





0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:6424次
    • 积分:113
    • 等级:
    • 排名:千里之外
    • 原创:4篇
    • 转载:0篇
    • 译文:0篇
    • 评论:1条
    文章存档
    最新评论