设为首页 收藏本站
查看: 923|回复: 0

[经验分享] 基于CentOS 5.4的环境构建LAMP平台问题集锦

[复制链接]

尚未签到

发表于 2016-5-13 12:12:38 | 显示全部楼层 |阅读模式
一、APACHE编译配置
#./configure --prefix=/usr/local/apache2 --enable-rewrite=shared --enable-track-vars --enable-cgi --enable-so --enable-mods-shared=all --with-config-file-path=/usr/local/apache2/conf --with-mpm=worker
 
二、MYSQL编译配置
#./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-extra-charsets=all --enable-thread-safe-client --enable-assembler --with-readline --with-big-tables --with-plugins=all --with-tcp-port=3310 --with-unix-socket-path=/usr/local/mysql/data/mysql.sock --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-named-curses-libs=/usr/lib/libncursesw.so.5
 
 
./configure --prefix=/usr/local/mysql --with-named-curses-libs=/usr/lib/libncursesw.so.5
 
MYSQL编译安装时碰到的问题:
 
问题一、
configure: error: No curses/termcap library found
解决办法一如下:
./configure --with-named-curses-libs=/usr/lib/libncursesw.so.5
解决方法二如下:
(centos5系统):yum -y install ncurses-devel
其他linux系统请去http://www.rpmfind.net/下载该包安装
 
问题二、
[iyunv@localhost bin]# ./mysql_install_db --user=mysql
 
FATAL ERROR: Could not find /usr/local/mysql/libexec/mysqld
 
 
三、GD库安装
jpeg6安装:./configure --prefix=/usr/local/modules/jpeg6/ --enable-shared –enable-static
 
问题一、
checking host system type... Invalid configuration `x86_64-unknown-linux-gnu': machine `x86_64-unknown' not recognized
 
在做 configure 的时候,报上述的错误。
解决方案:
把 /usr/share/libtool/config.guess 覆盖到相关软件自带的config.guess
把 /usr/share/libtool/config.sub 覆盖到相关软件自带的config.sub
./configure --enable-shared --enable-static
make libdir=/usr/lib64
make libdir=/usr/lib64 install #e4@"A(N#q8q#e5a)G.I4^7e
使用64位函数库编译.
 
这样就可以通过了。
libpng安装:./configure --prefix=/usr/local/modules/libpng/ --enable-shared --enable-static
出现错误,解决办法:更新libpng基础包:yum install libpng*
 
安装PNG:
#tar –zvxf libpng-1.2.24.tar.gz
 
#cd libpng-1.2.24
 
#cp scripts/makefile.gcmmx makefile
 
#./configure –prefix=/usr/local/libpng2
 
#vi Makefile
 
找到CFLAGS= -g –O2后面加上 –fPIC (这里是关键)
 
#make && make
 
安装Zlib(zlib-1.2.3):
第一步:安装zlib基本库:yum install zlib*
第二部:更新zlib库:yum update zlib*
第三步:#cd zlib-xxx/ #./configure
第四步:config后修改Makefile文件
找到
CFLAGS= -DUSE_MMAP
修改为 CFLAGS=-O3 -DUSE_MMAP -fPIC
第五步:make && make install
其中第三步和第四步也可以由下面一步代替
或者使用以下选项进行编译
CFLAGS="-O3 -DUSE_MMAP -fPIC" ./configure
 
 
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’
 
http://aspn.activestate.com/ASPN/Mail/Message/php-dev/3803631
可以算是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是否已经加上。

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-216548-1-1.html 上篇帖子: CentOS 5.5 下Postfix和Dovecot 配置邮件服务器 下篇帖子: Eucalyptus弹性计算云平台配置文件和xen配置文件(centos)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表