码迷,mamicode.com
首页 > 其他好文 > 详细

lnmp 环境,以及架构实现最小化安装思路

时间:2015-04-03 15:37:20      阅读:282      评论:0      收藏:0      [点我收藏+]

标签:lnmp环境

nginx安装

Pcre,中文perl兼容正则表达式,安装pcre库为了使nginx支持http rewrite模块。

yum -y install pcre pcre-devel

yum -y install openssl openssl-devel

Openssl 安全套接层

yum -y install zlib-devel zlib 

Zip 通用数据压缩  (老师没有做加载这个模块)(默认有)

 

useradd -s /sbin/nologin -M nginx

tar xf nginx-1.6.2.tar.gz

cd

./configure --user=nginx --prefix=/data/nginx-1.6.2 --with-http_stub_status_module --with-http_ssl_module

echo $?

Make && make install

ln -s /data/nginx-1.6.2/ /data/nginx

 

检查语法:

[root@hexudong sbin]# ./nginx -t

nginx: the configuration file /data/nginx-1.6.2/conf/nginx.conf syntax is ok

nginx: configuration file /data/nginx-1.6.2/conf/nginx.conf test is successful

netstat -lntup | grep nginx

[root@hexudong sbin]# curl 127.0.0.1

 

报错:

 

[root@c66-wei pcre-8.30]# /application/nginx/sbin/nginx 
nginx: [emerg] getpwnam("nginx") failed
[root@c66-wei pcre-8.30]# 

原因:没有添加用户

 

Find / -name libpcre.so*

如果是yum安装的pcre,则不会出现找不到libpcre错误。

 

[root@localhost ~]# cat /etc/ld.so.conf

include ld.so.conf.d/*.conf

/opt/xs_0507/src/*.so

运行ldconfig更新高速缓冲区

将libxs.so  复制到 /usr/lib

 缺少库文件。

 

lnmp平台不安装mysql。这样实现了,最小化安装。因为数据库是放在后端,让许多web 层去访问。

 

那么安装php 就要制定mysqlnd

linux 可以不装mysql,软件包都没有,这样的情况。

--with-mysql=mysqlnd

其他需要mysql相关包场景的php编译参数

--enable-mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-mysqli=mysqlnd \

php 安装:

./configure \
--prefix=/application/php5.3.27 \

--enable-mysqlnd \
--with-pdo-mysql=mysqlnd \

--with-mysql=/mysqlnd \
--with-iconv-dir=/usr/local/libiconv \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--enable-xml \
--disable-rpath \
--enable-safe-mode \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--with-curlwrappers \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--enable-short-tags \
--enable-zend-multibyte \
--enable-static \
--with-xsl \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-ftp

 

 

make && make install

 

Linux 安装选包

yum groupinstall "Compatibility libraries" "Base" "Development tools" -y
yum groupinstall "debugging Tools" "Dial-up Networking Support" -y

 

[root@MySQL php-5.3.27]# cp php.ini-production /application/php/lib/php.ini

 

注释php.ini里面的参数

php报错:

精典错误

/libxmlrpc/encoding.c:101:undefined reference to ‘libiconv_close‘

collect2: ld returned 1 exit status

make:*** [sapi/fpm/php-fpm] Error 1

解决方法:

#make ZEND_EXTRA_LIBS=‘-liconv‘

错误一、编译php出错

/php-5.3.2/ext/fileinfo/libmagic/apprentice.c:147:internal compiler error:Segmentation fault

Please submit a full bug report,

with preprocessed source if appropriate.

See <URL:http://bugzilla.redhat.com/bugzilla> for instructions.

The bug is not reproducible,so it is likely a hardware or OS problem.

make:*** [ext/fileinfo/libmagic/apprentice.lo] Error 1

解决方法:内存大于1G即可,这是php5.3.2的一个bug

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

错误二、重新构造configure文件出错

./buildconf --force

Forcing buildconf

buildconf:checking installation...

buildconf:autoconf version 2.59 (ok)

buildconf:Your version of autoconf likely contains buggy cache code.

      Running vcsclean for you.

      To avoid this,install autoconf-2.13.

Can‘t figure out your VCS, not cleaning.

解决方法:编译安装autoconf-2.13

      再将autoconf-2.13的auotconf文件至/usr/local/autoconf

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

错误三、编译时缺少库

configure: error: libXpm.(a|so) not found.

解决方法:yum install libXpm-devel

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

错误四、编译时缺少gmp.h文件

configure: error: Unable to locate gmp.h

解决方法:yum install gmp-devel

 

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

错误五

Configure: error: xml2-config not found. Please check your libxml2 installation.

解决方法:

#yum install libxml2 libxml2-devel (For Redhat & Fedora)

# aptitude install libxml2-dev      (For ubuntu)

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

错误六

Checking for pkg-config… /usr/bin/pkg-config

configure: error: Cannot find OpenSSL’s <evp.h>

解决方法:

#yum install openssl openssl-devel

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

错误七

Configure: error: Please reinstall the BZip2 distribution

解决方法:

# yum install bzip2 bzip2-devel

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

错误八

Configure: error: Please reinstall the libcurl distribution -

easy.h should be in <curl-dir>/include/curl/

解决方法:

# yum install curl curl-devel   (For Redhat & Fedora)

# install libcurl4-gnutls-dev    (For Ubuntu)

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

 

错误九:

Configure: error: libjpeg.(also) not found.

解决方法:

# yum install libjpeg libjpeg-devel

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

错误十

Configure: error: libpng.(also) not found.

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

解决方法:

# yum install libpng libpng-devel

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

错误十一

Configure: error: freetype.h not found.

解决方法:

#yum install freetype-devel

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

错误十二

Configure: error: Unable to locate gmp.h

解决方法:

# yum install gmp-devel

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

错误十三

Configure: error: Cannot find MySQL header files under /usr.

Note that the MySQL client library is not bundled anymore!

解决方法:

# yum install mysql-devel            (For Redhat & Fedora)

# apt-get install libmysql++-dev      (For Ubuntu)

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

 

错误十四

Configure: error: Please reinstall the ncurses distribution

解决方法:

# yum install ncurses ncurses-devel

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

错误十五

Checking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h’ not found!

解决方法:

# yum install unixODBC-devel

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

错误十六

Configure: error: Cannot find pspell

解决方法:

# yum install pspell-devel

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

错误十七

configure: error: mcrypt.h not found. Please reinstall libmcrypt.

解决方法:

# yum install libmcrypt libmcrypt-devel    (For Redhat & Fedora)

# apt-get install libmcrypt-dev

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

错误十八

Configure: error: snmp.h not found. Check your SNMP installation.

解决方法:

# yum install net-snmp net-snmp-devel

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

错误十九

configure:error:Cannot find ldap.h

解决方法:

#yum install openldap-devel openldap

错误二十

configure:error:xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution

解决方法:

#yum install libxslt libxslt-devel

 

错误二十一

checking for libevent >=1.4.11 install prefix... configure: error: Could not find libevent >=1.4.11 in /usr/local/php

解决方法:

安装libevent-1.4.11以上版本至/usr/local

tar xzvf libevent-1.4.14-stable.tar.gz

cd libevent-1.4.14-stable

./configure --prefix=/usr/local

make&&make install

在编译./configure时添加--with-libevent-dir=/usr/local即可

 

错误二十二

 

cc1: out of memory allocating 2036 bytes after a total of 81846272 bytes

make: *** [ext/date/lib/parse_date.lo] Error 1

 

报错:

/usr/bin/ld: cannot find -lltdl

collect2: ld returned 1 exit status

make:*** [sapi/fpm/php-fpm] Error 1

解决方法:

安装ltdl

#cd ../libmcrypt-2.5.7/libltdl/

#./configure --enable-ltdl-install

#ldconfig

#cd php-5.3.6

#make ZEND_EXTRA_LIBS=‘-liconv‘

done s

 

错误二十三

 

/usr/src/php-5.3.27/sapi/cli/php: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory

make: *** [ext/phar/phar.php] Error 127

 

find / -name libmysqlclient.so.18

ln -s ` find / -name libmysqlclient.so.18` /usr/lib

mkdir ext/phar/phar.php

 

错误二十四

/usr/bin/ld: cannot find -liconv

collect2: ld returned 1 exit status

make: *** [libphp5.la] Error 1

[root@localhost php-5.6.2]#

解决方法:

yum install libtool-ltdl-devel

lnmp 环境,以及架构实现最小化安装思路

标签:lnmp环境

原文地址:http://7179867.blog.51cto.com/7169867/1627968

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!