背景
前面把樹莓派裝上了centos 7,趁著國慶放假回來趕緊把服務端環境搭起來,為了方便就準備用一鍵lnmp快速部署一個,結果死活安裝不成功…
報錯
按照以往的經驗進行安裝,在我的小樹莓派上安裝實在是慢,畢竟需要編譯,cpu不給力只能慢慢的等待編譯完成,吃個午飯回來發現似乎已經完成了,然而卻失敗了,報錯信息如下
============================== Check install ============================== Checking ... Nginx: OK MariaDB: OK Error: PHP install failed. Sorry, Failed to install LNMP! Please visit feedback errors and logs. You can download /root/lnmp-install.log from your server,and upload lnmp-install.log to LNMP Forum.
? ? PHP安裝失敗了,報錯不要緊,再來一次看下啥問題,使用./upgrade.sh腳本可以重新安裝,然而繼續報錯
+-------------------------------------------+ | Manager for LNMP, Written by Licess | +-------------------------------------------+ | | +-------------------------------------------+ Starting LNMP... Starting nginx... done Starting MySQL.... SUCCESS! /bin/lnmp: line 27: /etc/init.d/php-fpm: No such file or directory ======== upgrade php failed ====== upgrade php log: /root/upgrade_lnmp_php.log You upload upgrade_lnmp_php.log to LNMP Forum for help.
發現
仔細查看安裝日志,發現了關鍵信息
configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/ make: *** No targets specified and no makefile found. Stop. make: *** No rule to make target `install'. Stop.
這里有個error,說是“請安裝libcurl”,奇怪了,我在VPS上安裝的時候咋沒碰到這個問題呢,難道是centos for 樹莓派版本閹割了這個玩意?
解決
按照錯誤提示安裝,嘗試使用yum直接裝,然而包管理器里面并沒有發現這個東西,找到官網上直接下載編譯安裝
? ? ?CentOS 編譯SVNdocx
wget https://curl.haxx.se/download/curl-7.50.3.tar.gz tar zvxf curl-7.50.3.tar.gz cd curl-7.50.3 ./configure --enable-shared make make install
經過漫長的編譯終于編譯安裝成功了
繼續嘗試安裝PHP,這回算是正常進行編譯PHP了
Generating files configure: creating ./config.status creating main/internal_functions.c creating main/internal_functions_cli.c +--------------------------------------------------------------------+ | License: | | This software is subject to the PHP License, available in this | | distribution in the file LICENSE. By continuing this installation | | process, you are bound by the terms of this license agreement. | | If you do not agree with the terms of this license, you must abort | | the installation process at this point. | +--------------------------------------------------------------------+ Thank you for using PHP. config.status: creating php5.spec config.status: creating main/build-defs.h config.status: creating scripts/phpize config.status: creating scripts/man1/phpize.1 config.status: creating scripts/php-config config.status: creating scripts/man1/php-config.1 config.status: creating sapi/cli/php.1 config.status: creating sapi/fpm/php-fpm.conf config.status: creating sapi/fpm/init.d.php-fpm config.status: creating sapi/fpm/php-fpm.service config.status: creating sapi/fpm/php-fpm.8 config.status: creating sapi/fpm/status.html config.status: creating sapi/cgi/php-cgi.1 config.status: creating ext/phar/phar.1 config.status: creating ext/phar/phar.phar.1 config.status: creating main/php_config.h config.status: executing default commands
經過漫長的編譯,終于…..
編譯完成了,但是…
+-------------------------------------------+ | Manager for LNMP, Written by Licess | +-------------------------------------------+ | | +-------------------------------------------+ Starting LNMP... Starting nginx... done Starting MySQL...... SUCCESS! Starting php-fpm Failed loading /usr/local/zend/ZendGuardLoader.so: /usr/local/zend/ZendGuardLoader.so: cannot open shared object file: No such file or directory done ======== upgrade php completed ======
似乎還是有些問題,不過問題不大,看起來像是某個擴展丟了,到這個目錄查看下到底有沒有這個東西
[root@rpi2 ~]# ls /usr/local/zend/ ZendGuardLoader.so
發現是有這個東西,真是神奇,通過搜索發現lnmp論壇上還真有人遇到過這個問題,帖子地址 ,作者說是系統dns的問題,應該是下載回來的東西損壞了,先不管,可以直接在php.ini里面注釋掉這個,也或者直接去下載完整的重新放進去就可以了。
后記
重新從zend官方下載了32位的so文件放進去發現依然不行,嘗試重新安裝PHP的默認版本5.4.45,現在還在編譯…
更新
經過一番波折終于搞定了,編譯完PHP之后發現還是失敗了,錯誤信息如下
+-------------------------------------------+ | Manager for LNMP, Written by Licess | +-------------------------------------------+ | | +-------------------------------------------+ Starting LNMP... Starting nginx... done Starting MySQL..... SUCCESS! Starting php-fpm /etc/init.d/php-fpm:行57: /usr/local/php/sbin/php-fpm: 沒有那個文件或目錄 failed ======== upgrade php failed ====== upgrade php log: /root/upgrade_lnmp_php.log You upload upgrade_lnmp_php.log to LNMP Forum for help. 顯示的是找不到php-fpm這個文件,于是我想查找下這個文件在哪 $ whereis php-fpm php-fpm: /usr/bin/php-fpm /usr/sbin/php-fpm /etc/php-fpm.conf /etc/php-fpm.d /usr/share/man/man8/php-fpm.8.gz 通過查找發現確實不在那個目錄下面,這個簡單,直接從/usr/sbin下面把php-fpm復制過去就好了
$ cd /usr/local/php/ $ ls etc php-fpm $ sudo mkdir sbin $ sudo mv php-fpm sbin/ $ lnmp restart Error: You must be root to run this script! [kbdancerrpi@rpi2 php]$ sudo lnmp restart +-------------------------------------------+ | Manager for LNMP, Written by Licess | +-------------------------------------------+ | | +-------------------------------------------+ Stoping LNMP... Stoping nginx... done Shutting down MySQL. SUCCESS! Gracefully shutting down php-fpm warning, no pid file found - php-fpm is not running ? Starting LNMP... Starting nginx... done Starting MySQL..... SUCCESS! Starting php-fpm [01-Jan-1970 13:18:55] ERROR: failed to open error_log (/usr/local/php/var/log/php-fpm.log): No such file or directory (2) [01-Jan-1970 13:18:55] ERROR: failed to post process the configuration [01-Jan-1970 13:18:55] ERROR: FPM initialization failed failed
沒錯,繼續報錯,根據提示來
$ cd /usr/local/php/ $ sudo mkdir var $ cd var/ $ sudo mkdir log $ cd log/ $ ls $ sudo touch php-fpm.log $ sudo lnmp restart +-------------------------------------------+ | Manager for LNMP, Written by Licess | +-------------------------------------------+ | | +-------------------------------------------+ Stoping LNMP... Stoping nginx... done Shutting down MySQL. SUCCESS! Gracefully shutting down php-fpm warning, no pid file found - php-fpm is not running ? Starting LNMP... Starting nginx... done Starting MySQL..... SUCCESS! Starting php-fpm [01-Jan-1970 13:20:18] ERROR: Unable to create the PID file (/usr/local/php/var/run/php-fpm.pid).: No such file or directory (2) [01-Jan-1970 13:20:18] ERROR: FPM initialization failed failed
依然報錯,繼續
$ cd .. $ ls log $ sudo mkdir run $ sudo lnmp restart +-------------------------------------------+ | Manager for LNMP, Written by Licess | +-------------------------------------------+ | | +-------------------------------------------+ Stoping LNMP... Stoping nginx... done Shutting down MySQL. SUCCESS! Gracefully shutting down php-fpm warning, no pid file found - php-fpm is not running ? Starting LNMP... Starting nginx... done Starting MySQL..... SUCCESS! Starting php-fpm done
OK,終于搞定了,真是曲折啊,估計lnmp作者沒有測試過lnmp跑在ARM上會不會出問題,希望能夠改進…