centos安装lnmp时的常见错误

/ 0评 / 0

都是从网上罗列来的。希望对各位有帮助。

在配置centos上面的运行环境时,建议除了安装gcc/g++等编译器外,yum(Yellow dog Updater, Modified)软件包管理器,还是安上吧,方便查找软件,否则个软件的依赖包。。那找的是头大。

那就要找到新或全点的源了。http://centos.ustc.edu.cn/centos/  这里的源,很快,且很全。

这里讲了如何在服务器设置yum源http://elf8848.javaeye.com/blog/455676

 

安装后请按照以下步骤修改CenOS-Base.repo,以后就可以方便的用yum安装软件了.

cd /etc/yum.repos.d

 mv CentOS-Base.repo  CentOS-Base.repo.save
wget

http://centos.ustc.edu.cn/CentOS-Base.repo

修改以上文件后, 如需要安装gcc, 直接yum install gcc就可以了

 

下面就是编译安装LNMP过程中的一些常见错误了。

Mysql
line 213: my_print_defaults: command not found
/etc/rc.d/init.d/mysqld /opt/my.cnf  添加对应的basedir 和datadir路径

./libtool: line 990: g++: command not found
g++未安装

mhash-0.9.9.9.tar.gz
haval.lo gosthash.lo whirlpool.lo snefru.lo
libtool: link: `mhash.lo' is not a valid libtool object
需要对应的依赖包

checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.
php需要libxml2包

easy.h should be in /include/curl/
yum install curl-devel

configure: error: Cannot find ldap.h
编译php时出现 configure: error: Cannot find ldap.h,查阅了相关文档,发现依赖于openldap包,通过yum解决问题:
yum install openldap openldap-clients openldap-devel openldap-servers
configure: error: mysql configure failed. Please check config.log for more information.
http://baikgd.blog.163.com/blog/static/354024952010710115820569/

php编译mysql
configure: error: mysql configure failed. Please check config.log for more information.
root@test_03:~/php-5.2.10# ./configure --help |grep mysql
  --with-mysql[=DIR]      Include MySQL support. DIR is the MySQL base directory
郁闷的是..被误导了.其实是要--with-mysql-dir=XXX
原配置信息如下,出错:
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs  --with-xml--with-mysql=/usr/--with-config-file-path=/usr/local/lib -enable-track-vars --enable-sockets --with-zlib
修改配置如下,成功编译安装:
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs  --with-xml--with-mysql-dir=/usr/--with-config-file-path=/usr/local/lib -enable-track-vars --enable-sockets --with-zlib

make php过程中的错误
ERROR: invalid PHP executable specified by TEST_PHP_EXECUTABLE  = /opt/software/php-5.2.14/sapi/cli/php

http://linux.chinaunix.net/bbs/viewthread.php?tid=1118728
该错误可以忽略直接make install

编译pdo扩展时
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
http://apps.hi.baidu.com/share/detail/1831031
缺少依赖包m4-1.4.9.tar.gz,autoconf-2.62.tar.gz

# cd /usr/src
# wget http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz
# tar -zvxf m4-1.4.9.tar.gz
# cd m4-1.4.9/
# ./configure && make && make install
# cd ../
# wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.62.tar.gz
# tar -zvxf autoconf-2.62.tar.gz
# cd autoconf-2.62/
# ./configure && make && make install

附:CentOS 5.5下编译php时的一些典型错误及解决办法.

命令重启nginx命令
经常需要重启nginx,但网上的很多教程都需要繁琐的启动脚本,远不如apache的重启命令那么简单。
但研究了一下nginx帮助后发现,有-s参数可对nginx服务进行管理:
# /usr/local/nginx/sbin/nginx -h
nginx version: nginx/0.7.63
Usage: nginx [-?hvVt] [-s signal] [-c filename] [-p prefix] [-g

directives]
Options:
-?,-h : this help
-v : show version and exit
-V : show version and configure options then exit
-t : test configuration and exit
-s signal : send signal to a master process: stop, quit, reopen,

reload
-p prefix : set prefix path (default: /usr/local/nginx/)
-c filename : set configuration file (default: conf/nginx.conf)
-g directives : set global directives out of configuration file
于是我执行
# /usr/local/nginx/sbin/nginx -s  reload
nginx已经重启成功
Nginx由于没有免费的控制面板支持,所以需要修改 /usr/local/nginx/conf/nginx.conf 这个文件来实现服务器性能、特性的配置。

上传下载配置文件建议使用Winscp这个工具,同样基于SSH协议,比Ftp安全。在 http://wiki.nginx.org/NginxConfiguration 有很多配置文件的文档和例子。

发表评论

您的电子邮箱地址不会被公开。

*