大家是否遇到過去了新公司,公司內的LAMP,LNMP等所有的環境都是配置好的(已經在提供服務了),公司又沒有留下部署文檔,甚至安裝LAMP,LAMP等環境的人已經和你交接完離職了,那麼線上服務器(lamp,lnmp)的編譯環境等就成了黑盒,如果不改造還好,當服務器需要遷移改造時,我們(新手的你)沒有老的環境編譯情況,就會很鬱悶,生怕編譯錯了影響線上程序運行。
其實,很多時候,是可以看到軟件的編譯的情況的,下面老男孩就以lamp,lnmp環境爲例爲大家一一道來。
1)查看web服務的編譯參數
a.查看nginx的編譯參數:
/home/oldboy/run/nginx/sbin/nginx -V
範例1:
- [root@VM-001 ~]# /home/oldboy/run/nginx/sbin/nginx -V
- nginx version: nginx/0.8.50
- built by gcc 4.1.2 20080704 (Red Hat 4.1.2-48)
- configure arguments: --prefix=/app/nginx
提示:/home/oldboy/run/爲普通用戶起的nginx服務命令路徑
b.查看apache的編譯參數:
cat /home/oldboy/run/apache/build/config.nice
範例2:
- [root@VM-002 ~]# cat /home/oldboy/run/apache/build/config.nice
- #! /bin/sh
- #
- # Created by configure
- "./configure" \
- "--prefix=/app/apache2.2.9" \
- "--enable-deflate" \
- "--enable-headers" \
- "--enable-modules=so" \
- "--enable-so" \
- "--with-mpm=worker" \
- "--enable-rewrite" \
- "--enable-cgi" \
- "$@"
提示:/home/oldboy/run/爲普通用戶起的apache服務命令路徑
2)查看MySQL數據庫的編譯參數:
grep CONFIGURE_LINE /app/mysql/bin/mysqlbug
提示:還發現很多人先cat,在grep,很不專業,應杜絕。
範例3:
- [root@VM-001~]# grep CONFIGURE_LINE /app/mysql/bin/mysqlbug
- CONFIGURE_LINE="./configure '--prefix=/app/mysql/' '--enable-assembler' '--with-extra-charsets=complex' '--enable-thread-safe-client' '--with-big-tables' '--with-readline' '--with-ssl' '--with-embedded-server' '--enable-local-infile' '--with-plugins=partition,innobase' '--with-plugin-PLUGIN'"
- `test -n "$CONFIGURE_LINE" && echo "Configure command: $CONFIGURE_LINE"`
提示:/app爲mysql服務安裝路徑
3)查看php編譯參數:
/app/php/bin/php -i|grep configure
範例4:
- [root@VM-001 ~]# /app/php/bin/php -i|grep configure
- Configure Command => './configure' '--prefix=/app/php' '--with-apxs2=/app/apache/bin/apxs' '--with-mysql=shared,/app/mysql' '--with-ttf=shared' '--with-freetype-dir' '--with-gd' '--with-zlib' '--with-jpeg-dir' '--with-png-dir' '--with-iconv=/app/libiconv' '--enable-short-tags' '--enable-sockets' '--enable-zend-multibyte' '--enable-soap' '--with-openssl' '--enable-mbstring' '--enable-static' '--enable-gd-native-ttf' '--with-curl' '--with-xsl' '--enable-ftp' '--with-libxml-dir'
提示:/app爲php服務安裝路徑
本文出自 “老男孩的linux博客” 博客