首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

基于CentOS 5.4的环境构建LAMP平台有关问题集锦

2012-08-24 
基于CentOS 5.4的环境构建LAMP平台问题集锦??GD编译配置 ./configure --prefix/usr/local/modules/gd --w

基于CentOS 5.4的环境构建LAMP平台问题集锦

?

?

GD编译配置

./configure --prefix=/usr/local/modules/gd --with-jpeg=/usr/local/modules/jpeg6 --with-png=/usr/local/modules/libpng --with-zlib --with-freetype=/usr/local/modules/freetype

?

四、PHP安装

./configure --prefix=/usr/local/php5 --with-gd=/usr/local/modules/gd --with-jpeg-dir=/usr/local/modules/jpeg6 --with-zlib --with-png-dir=/usr/local/modules/libpng --with-freetype-dir=/usr/local/modules/freetype --with-libxpm --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-iconv --enable-mbstring --with-pear --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php5/etc --with-libxml-dir=/usr/lib --with-curl

?

./configure --prefix=/usr/local/php5 --with-gd --with-jpeg-dir --with-zlib --with-png-dir --with-freetype-dir --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-iconv --enable-mbstring --with-pear --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php5/etc --with-libxml

?

?

/usr/bin/ld: /usr/local/lib/libz.a(compress.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC

/usr/local/lib/libz.a: could not read symbols: Bad value

collect2: ld returned 1 exit status

make: *** [libphp5.la] 错误 1

?

解决方法:

方法一、安装zlib包已经zlib-devel包,就OK了

方法二、

?

编译gdlib库碰到undefined reference to `png_check_sig’问题解决

?

采用源码方式编译php,需要gd库,同样采用源码编译,在编译过程中碰到 undefined reference to `png_check_sig’ 错误。

google了一下,发现由于使用的新的 libpng 1.4版本,去掉了png_check_sig函数,替换为了png_sig_check函数

,于是编辑gd库的 gd_png.c文件,将

?

1.

if (!png_check_sig (sig, 8)) { /* bad signature */

2.

return NULL;

3.

}

?

修改为

?

1.

if (png_sig_cmp (sig, 0, 8)) { /* bad signature 注意这里的参数不同*/

2.

return NULL;

3.

}

?

再次编译通过

?

错误一、

ext/gd/libgd/.libs/gd_png.o: In function `php_gd_gdImageCreateFromPngCtx':

/root/downloads/php-5.2.13/ext/gd/libgd/gd_png.c:142: undefined reference to `png_check_sig'

collect2: ld returned 1 exit status

make: *** [sapi/cli/php] 错误 1

?

把 `png_check_sig' 改为了 ‘png_sig_cmp’

?

[url]http://aspn.activestate.com/ASPN/Mail/Message/php-dev/3803631[/url]

可以算是php的一个bug,libpng-1.4.0源码中的libpng-1.4.0.txt有说明,已经取消了png_check_sig这个函数,改用png_sig_cmp代替.自从libpng-0.90就已经反对使用png_check_sig函数了.这个帖子中采用修改php源码的方法,编辑ext/gd/libgd/gd_png.c,将

if (!png_check_sig (sig, 8)) { /* bad signature */

换成

if (png_sig_cmp (sig, 0, 8)) { /* bad signature */

但我不知道其他哪些地方有没有这个函数,所以我还是用libpng-1.2.35吧,看libpng-1.2.35.txt,就没有提png_check_sig的事.

编译安装libpng-1.2.35后,php-5.2.12的make通过了

?

现在编译通过了。

?

?

APACHE启动报错:

/usr/local/apache2/bin/apachectl restart

Warning: DocumentRoot [/usr/local/apache2/docs/dummy-host.example.com] does not exist

Warning: DocumentRoot [/usr/local/apache2/docs/dummy-host2.example.com] does not exist

?

原因:

/usr/local/apache2/conf/extra/httpd-vhosts.conf 中一些 DocumentRoot不存在于之对应的实体文件。

?

linux下php扩展cURL的安装

方法一

?

  安装cURL

?

   # wget http://curl.haxx.se/download/curl-7.17.1.tar.gz

?

   # tar -zxf curl-7.17.1.tar.gz

?

   # ./configure --prefix=/usr/local/curl

?

   # make; make install

?

  安装php

?

   只要打开开关 --with-curl=/usr/local/curl

?

   就可以了。

?

   这个扩展库还是非常棒,是fsockopen等等相关的有效的替代品。

?

  方法二

?

  进入安装原php的源码目录,

?

  cd ext

?

  cd curl

?

  phpize

?

  ./configure --with-curl=DIR

?

  make

?

  就会在PHPDIR/ext/curl/moudles/下生成curl.so的文件。

?

  复制curl.so文件到extensions的配置目录,修改php.ini就好了

?

问题

配置php支持curl的时候, 出现如下报错

checking for cURL in default path... not found

configure: error: Please reinstall the libcurl distribution -

easy.h should be in /include/curl/

?

原因其实就是curl的dev包没有安装, 解决方案:

终端下

?

# yum -y install curl-devel

?

然后就可以继续了

?

PHP扩展包的安装(这里以 mcrypt为例,环境为Centos5.4系统):

第一步:先确认安装了安装包的基础包,通常使用系统更新安装即可:

yum list libmcrypt*

yum install libmcrypt*

第二步:进入PHP源码解压后的目录中,如我这里是php-5.2.13,#cd /root/downloads/php-5.2.13/ext/mcrypt

如果没有mcrypt则需要到网站上去下载,通常是自带了的。

第三步:执行phpize, #/usr/local/php5/bin/phpize

第四步:编译configure: ./configure --with-php-config=/usr/local/php5/bin/php-config

这里需要指定php-config的目录,然后仔细make,这里将生成一个mcrypt.so文件在 ./modules/mcrypt.so

第五步:拷贝./modules/mcrypt.so 到 php 的extension_dir 目录中.

cp ./modules/mcrypt.so /usr/local/php5/include/php/include/

第六步:确定php.ini文件中的 extension_dir= /usr/local/php5/include/php/include/

然后加上 extension = mcrypt.so;

第七步:重启apache,查看phpinfo看mcrypt是否已经加上。

热点排行