Posted in WWW

自行編譯 php4

自行編譯 php4 Posted on 2006 年 11 月 04 日Leave a comment

1.

apt-get install flex httpd-devel

 

2.
tar zxvf php-4.4.1.tar.gz
cd php-4.4.1
 

3.

./configure –with-apxs2=/usr/sbin/apxs –with-mysql –with-gd –with-zlib-dir –with-jpeg-dir –with-png-dir
make
make install

 

註:

'–with-config-file-path=/etc' '–with-config-file-scan-dir=/etc/php.d'
 

4.
cp php.ini-dist /usr/local/lib/php.ini
 

5. 把對php5的設定註解

vi /etc/httpd/conf.d/php.conf

#LoadModule php5_module modules/libphp5.so

LoadModule php4_module libexec/libphp4.so

#AddHandler php5-script .php
#AddType text/html .php

AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps

6.
service httpd graceful

[Q1.] [root@router html]# service httpd restart

Stopping httpd: [ OK ]
Starting httpd: [Wed Jan 04 00:05:20 2006] [warn] module php4_module is already loaded, skipping
[ OK ]
[root@router html]#

[A1.] 在/etc/httpd/conf.d/php.conf與/etc/httpd/conf/httpd.conf的php4_module互相衝突了,註解掉/etc/httpd/conf.d/php.conf中的php4_module

 

[Q2.] ./configure
checking lex output file root… ./configure: line 2540: lex: command not found
configure: error: cannot find output from lex; giving up

[A2.] apt-get install flex

[Q3.]

Configuring SAPI modules
checking for AOLserver support… no
checking for Apache 1.x module support via DSO through APXS… no
checking for Apache 1.x module support… no
checking for mod_charset compatibility option… no
checking for Apache 2.0 filter-module support via DSO through APXS… no
checking for Apache 2.0 handler-module support via DSO through APXS…

Sorry, I cannot run apxs. Possible reasons follow:

1. Perl is not installed
2. apxs was not found. Try to pass the path using –with-apxs2=/path/to/apxs
3. Apache was not built using –enable-so (the apxs usage page is displayed)

The output of /usr/sbin/apxs follows:
./configure: line 5656: /usr/sbin/apxs: No such file or directory

[A3.] apt-get install httpd-devel

[Q4.]

checking for GD support… yes
checking for the location of libjpeg… no
checking for the location of libpng… no
checking for the location of libXpm… no
checking for FreeType 1.x support… no
checking for FreeType 2… no
checking for T1lib support… no
checking whether to enable truetype string function in GD… no
checking whether to enable JIS-mapped Japanese font support in GD… no
checking for fabsf… yes
checking for floorf… yes
If configure fails try –with-jpeg-dir=<DIR>
configure: error: libpng.(a|so) not found.

[A4.] apt-get install libpng-devel

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *