centos7下面搭建lnmp環境


參考大神博客:

http://www.linuxzen.com/lnmphuan-jing-da-jian-wan-quan-shou-ce-si-lnmpda-jian-yuan-ma-an-zhuang.html

注意的地方:

1、下載安裝包時需要安裝wget命令,使用命令 

yum -y install wget

2、預編譯ngix時可能出現錯誤

./configure: error: C compiler cc is not found 

這是缺少編譯環境,安裝即可

yum install gcc gcc-c++ ncurses-devel perl

3、安裝完ngix時,用netstat查看命令時,報錯

netstat: 未找到命令

這時centos下默認未安裝,安裝即可

yum install net-tools

4、在瀏覽器中輸入虛擬機的ip可能打不開,需要防火牆放開80端口。

firewall-cmd --zone=public --add-port=80/tcp --permanent #開啟端口
firewall-cmd --reload #重啟防火牆

5、安裝php依賴包下載不了。需要將下載地址在瀏覽器中打開就會自動下載。

然后用rz命令傳到linux服務器上,按照步驟安裝即可。

6、解壓.tar.bz2壓縮包時報錯

tar: bzip2:無法 exec: 沒有那個文件或目錄

用yum安裝bzip2即可。

yum -y install bzip2

7、在安裝mcrypt時,報錯

*** Could not run libmcrypt test program, checking why...
*** The test program compiled, but did not run. This usually means
*** that the run-time linker is not finding LIBMCRYPT or finding the wrong
*** version of LIBMCRYPT. If it is not finding LIBMCRYPT, you'll need to set your
*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point
*** to the installed location  Also, make sure you have run ldconfig if that
*** is required on your system
***
*** If you have an old version installed, it is best to remove it, although
*** you may also be able to get things to work by modifying LD_LIBRARY_PATH
***
configure: error: *** libmcrypt was not found

解決方法參考連接:http://blog.sina.com.cn/s/blog_8a0f7d200101257u.html

8、文章中給的php版本有點低,網站已經不能下載。可用以下命令下載5.6版本

wget http://ar2.php.net/get/php-5.6.13.tar.gz/from/this/mirror

9、安裝依賴包時出錯 

yum y install libxml2-devel curl-devel libpng-devel openldap-devel

- y中間多了個空格,去掉即可

10、編譯報錯 configure: error: Cannot find ldap libraries in /usr/lib

解決辦法:http://www.iitshare.com/cannot-find-ldap-libraries-in-usrlib.html

11、安裝php時報錯:

ext/ldap/.libs/ldap.o: undefined reference to symbol 'ber_strdup'
//usr/lib/x86_64-linux-gnu/liblber-2.4.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

解決辦法:遇到這種類似的情況,說明「./configure 」沒抓好一些環境變數值。解決方法,來自老外的一篇文章:
在PHP源碼目錄下 vi Makefile 找到 EXTRA_LIBS 行,在行末添加 ‘ -llber ‘ 保存退出再次make即可。

 

 

12、最后還會有一個權限的問題。訪問php時會報502錯誤,在加載/var/run/php-fpm/php-fpm.sock時報沒權限。

我就把/var/run/php-fpm/php-fpm.sock權限改為777。估計方法不對,但湊合用下。再想辦法看下這個權限怎么搞吧。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM