redhat4安装php,在Redhat AD3上编译安装PHP5.0.4

昨天心血来潮,把PHP升级了一下,结果遇到了不小的麻烦,折腾了好一会才搞定,以下是编译安装PHP5.0.4的过程:

1.下载PHP5.0.4最新版本

我们可以从官方网站下载最新版本,也可以从本站下载php5.0.4版本。

[root@eygle opt]# wget http://cn2.php.net/get/php-5.0.4.tar.gz/from/cn.php.net/mirror

--00:56:34-- http://cn2.php.net/get/php-5.0.4.tar.gz/from/cn.php.net/mirror

=> `mirror'

Resolving cn2.php.net... done.

Connecting to cn2.php.net[219.239.98.8]:80...

[root@eygle opt]# wget http://cn.php.net/distributions/php-5.0.4.tar.gz

--00:57:37-- http://cn.php.net/distributions/php-5.0.4.tar.gz

=> `php-5.0.4.tar.gz'

Resolving cn.php.net... done.

Connecting to cn.php.net[61.129.33.155]:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 5,839,214 [application/x-gzip]

100%[===============================================================>] 5,839,214 1.16M/s ETA 00:00

00:57:42 (1.16 MB/s) - `php-5.0.4.tar.gz' saved [5839214/5839214]

2.解压缩

[root@eygle opt]# gzip -d php-5.0.4.tar.gz

[root@eygle opt]# tar -xvf php-5.0.4.tar

php-5.0.4/

php-5.0.4/ext/

php-5.0.4/ext/gd/

php-5.0.4/ext/gd/gd.c

php-5.0.4/ext/gd/gd_ctx.c

php-5.0.4/ext/gd/libgd/

......

php-5.0.4/CREDITS

php-5.0.4/README.UNIX-BUILD-SYSTEM

php-5.0.4/buildconf.bat

[root@eygle opt]# cd php-5.0.4

[root@eygle php-5.0.4]# ls

acconfig.h ext missing README.QNX snapshot

acconfig.h.in EXTENSIONS mkinstalldirs README.SELF-CONTAINED-EXTENSIONS stamp-h.in

acinclude.m4 footer netware README.STREAMS stub.c

aclocal.m4 generated_lists NEWS README.SUBMITTING_PATCH tests

build genfiles pear README.TESTING TODO

buildconf header php5.spec.in README.TESTING2 TODO-5.1

buildconf.bat INSTALL php.gif README.UNIX-BUILD-SYSTEM TODO.BUILDv5

CODING_STANDARDS install-sh php.ini-dist README.WIN32-BUILD-SYSTEM TODO-PHP5

config.guess LICENSE php.ini-recommended README.Zeus TSRM

config.sub ltmain.sh README.CVS-RULES regex win32

configure main README.EXTENSIONS run-tests-config.php Zend

configure.in makedist README.EXT_SKEL run-tests.php

CREDITS Makefile.frag README.input_filter sapi

cvsclean Makefile.global README.PARAMETER_PARSING_API scripts

cvsclean.bat makerpm README.PHP4-TO-PHP5-THIN-CHANGES server-tests.php

3.配置

[root@eygle php-5.0.4]# ./configure --enable-track-vars --with-mysql --with-dom --with-zlib-dir

--with-curl --with-iconv --with-mbstring --enable-module=so --with-apxs2

creating cache ./config.cache

checking host system type... i686-pc-linux-gnu

checking for gcc... gcc

....

checking for MySQL support... yes

checking for specified location of the MySQL UNIX socket... no

checking for MySQL UNIX socket location... /tmp/mysql.sock

configure: error: Cannot find MySQL header files under yes.

Note that the MySQL client library is not bundled anymore.

注意在这里第一个错误出现,这是由于--with-mysql没有指定配置路径导致的。

修改后再次运行configure成功。

[root@eygle php-5.0.4]# ./configure --with-apxs2=/opt/apache/bin/apxs --with-mysql=/opt/mysql

--enable-track-vars --with-dom --with-zlib-dir --with-curl --with-iconv --with-mbstring

loading cache ./config.cache

checking host system type... i686-pc-linux-gnu

checking for gcc... (cached) gcc

......

creating libtool

Generating files

updating cache ./config.cache

creating ./config.status

creating php5.spec

creating main/build-defs.h

creating scripts/phpize

creating scripts/php-config

creating sapi/cli/php.1

creating main/php_config.h

creating main/internal_functions.c

creating main/internal_functions_cli.c

+--------------------------------------------------------------------+

| 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.

4.编译

[root@eygle php-5.0.4]# make

....

Build complete.

(It is safe to ignore warnings about tempnam and tmpnam).

5.安装

[root@eygle php-5.0.4]# make install

Installing PHP SAPI module: apache2handler

/opt/apache/build/instdso.sh SH_LIBTOOL='/opt/apache/build/libtool' libphp5.la /opt/apache/modules

/opt/apache/build/libtool --mode=install cp libphp5.la /opt/apache/modules/

cp .libs/libphp5.so /opt/apache/modules/libphp5.so

cp .libs/libphp5.lai /opt/apache/modules/libphp5.la

libtool: install: warning: remember to run `libtool --finish /opt/php-5.0.4/libs'

chmod 755 /opt/apache/modules/libphp5.so

[activating module `php5' in /opt/apache/conf/httpd.conf]

Installing PHP CLI binary: /usr/local/bin/

Installing PHP CLI man page: /usr/local/man/man1/

Installing PEAR environment: /usr/local/lib/php/

[PEAR] Archive_Tar - already installed: 1.1

[PEAR] Console_Getopt - already installed: 1.2

[PEAR] PEAR - already installed: 1.3.5

Wrote PEAR system config file at: /usr/local/etc/pear.conf

You may want to add: /usr/local/lib/php to your php.ini include_path

[PEAR] HTML_Template_IT- already installed: 1.1

[PEAR] Net_UserAgent_Detect- already installed: 2.0.1

[PEAR] XML_RPC - already installed: 1.2.2

Installing build environment: /usr/local/lib/php/build/

Installing header files: /usr/local/include/php/

Installing helper programs: /usr/local/bin/

program: phpize

program: php-config

program: phpextdist

[root@eygle php-5.0.4]# libtool --finish /opt/php-5.0.4/libs

PATH="$PATH:/sbin" ldconfig -n /opt/php-5.0.4/libs

----------------------------------------------------------------------

Libraries have been installed in:

/opt/php-5.0.4/libs

If you ever happen to want to link against installed libraries

in a given directory, LIBDIR, you must either use libtool, and

specify the full pathname of the library, or use the `-LLIBDIR'

flag during linking and do at least one of the following:

- add LIBDIR to the `LD_LIBRARY_PATH' environment variable

during execution

- add LIBDIR to the `LD_RUN_PATH' environment variable

during linking

- use the `-Wl,--rpath -Wl,LIBDIR' linker flag

- have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for

more information, such as the ld(1) and ld.so(8) manual pages.

--------------------------------------------------------------------

此时安装结束。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值