標籤:php 編譯 error
小Q:今天重新用最新版本搭建了lnmp架構,正好整合一下我部落格的模組;
1、編譯參數詳解和編譯參數安裝;
2、拷貝設定檔;
3、出的錯誤;
--------------------------------------------------------------------------------------------------------
1、編譯參數詳解和編譯參數安裝;
因為是源碼安裝,下載解壓就不說了,直接說重點;
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --without-pear --with-zlib --enable-pdo --with-pdo-mysql --with-mysql
--with-mysqli=/usr/bin/mysql_config
make && make install
--prefix=/usr/local/php指定 php 安裝目錄 --with-apxs2=/usr/local/apache/bin/apxs整合 apache,apxs功能是使用mod_so中的LoadModule指令,載入指定模組到 apache,要求 apache 要開啟SO模組--with-config-file-path=/usr/local/php/etc 指定php.ini位置 --with-MySQL=/usr/local/mysqlmysql安裝目錄,對mysql的支援 --with-mysqli=/usr/local/mysql/bin/mysql_config mysqli擴充技術不僅可以調用MySQL的預存程序、處理MySQL事務,而且還可以使訪問資料庫工作變得更加穩定。 --enable-safe-mode 開啟安全模式 --enable-ftp 開啟ftp的支援 --enable-zip 開啟對zip的支援 --with-bz2 開啟對bz2檔案的支援 --with-jpeg-dir 開啟對jpeg圖片的支援 --with-png-dir 開啟對png圖片的支援 --with-freetype-dir 開啟對freetype字型庫的支援 --without-iconv 關閉iconv函數,種字元集間的轉換 --with-libXML-dir 開啟libxml2庫的支援 --with-XMLrpc 開啟xml-rpc的c語言 --with-zlib-dir 開啟zlib庫的支援 --with-gd 開啟gd庫的支援 --enable-gd-native-ttf 支援TrueType字串函數庫 --with-curl 開啟curl瀏覽工具的支援 --with-curlwrappers 運用curl工具開啟url流 --with-ttf 開啟freetype1.*的支援,可以不加了 --with-xsl 開啟XSLT 檔案支援,擴充了libXM2庫 ,需要libxslt軟體 --with-gettext 開啟gnu 的gettext 支援,編碼庫用到 --with-pear 開啟pear命令的支援,PHP擴充用的 --enable-calendar 開啟日曆擴充功能 --enable-mbstring 多位元組,字串的支援 --enable-bcmath 開啟圖片大小調整,用到zabbix監控的時候用到了這個模組 --enable-sockets 開啟 sockets 支援 --enable-exif 圖片的中繼資料支援 --enable-magic-quotes 魔術引用的支援 --disable-rpath 關閉額外的運行庫檔案 --disable-debug 關閉偵錯模式 --with-mime-magic=/usr/share/file/magic.mime 魔術標頭檔位置CGI方式安裝才用的參數--enable-fpm 打上PHP-fpm 補丁後才有這個參數,CGI方式安裝的啟動程式--enable-fastCGI 支援fastcgi方式啟動PHP --enable-force-CGI-redirect 重新導向方式啟動PHP --with-ncurses 支援ncurses 螢幕繪製以及基於文本終端的圖形互動功能的動態庫--enable-pcntl freeTDS需要用到的,可能是連結mssql 才用mhash和mcrypt演算法的擴充--with-mcrypt 演算法 --with-mhash 算以上函數庫需要安裝--with-gmp 應該是支援一種規範 --enable-inline-optimization 最佳化線程--with-openssl openssl的支援,加密傳輸時用到的 --enable-dbase 建立DBA 作為共用模組--with-pcre-dir=/usr/local/bin/pcre-config perl的正則庫案安裝位置 --disable-dmalloc--with-gdbm dba的gdbm支援 --enable-sigchild--enable-sysvsem--enable-sysvshm--enable-zend-multibyte 支援zend的多--with-openssl,需要openssl庫。
2、設定檔
cp php.ini-production /usr/local/php/etc/php-ini
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod 755 /etc/init.d/php-fpm
chkconfig --add php-fpm
chkconfig php-fpm on
/usr/local/php/sbin/php-fpm -t
/etc/init.d/php-fpm start
3、錯誤簡解
a. error: wrong mysql library version or lib not found. Check config.log for more information.
解決:將上邊標紅的編譯參數去掉,之後活動編譯該模組 --with-mysqli=/usr/bin/mysql_config
b. ERROR: [pool www] cannot get uid for user ‘php-fpm‘
解決:useradd -s /sbin/nologin php-fpm
c. /lib64/liblber-2.4.so.2: could not read symbols: Invalid operation
解決:進入Makefile 檔案,找到開頭為 EXTRA_LIBS=,在最後邊加上-llber 即可
PHP -- 編譯安裝