背景
前面把樹莓派裝上了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
經過漫長的編譯終於編譯安裝成功了
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
+-------------------------------------------+ | 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
以上是CentOS 7 for ARM 安裝一鍵Lnmp失敗的詳細內容。更多資訊請關注PHP中文網其他相關文章!