Job for httpd.service failed because the control process exited with error code. See "systemctl
vim /etc/httpd/conf/httpd.conf
找到Listen ,修改端口從新啓動php
查看狀態顯示運行即爲啓動成功html
Typecho官方要求PHP5.1,可是聽說PHP7的性能是PHP5的兩倍,因此咱們直接安裝PHP7好了。因爲Centos內置源的版本比較老,因此咱們要先更換一下PHP的源,輸入以下指令:mysql
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
若是安裝過舊版的php存在衝突能夠加上版本 ,例如
yum -y install php70w-gd
nginx
訪問官方下載地址獲取穩定版主程序壓縮包。解壓後將build文件夾內全部文件所有上傳到服務器的/var/www/html目錄下,不包括build文件夾自己。web
輸入以下指令重啓Apache服務:sql
訪問域名完成配置便可數據庫
默認的版本過低了,手動安裝有一些麻煩,想採用Yum安裝的可使用下面的方案: 首先刪除舊版本的PHP, 經過yum list installed | grep php能夠查看全部已安裝的php軟件 使用yum remove php*刪除 經過yum list php*查看是否有本身須要安裝的版本,若是沒有就須要添加第三方yum源, 推薦安裝webtatic、rpmforge,還有國內163的 CentOs 5.x rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm CentOs 6.x rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm CentOs 7.X rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm #32位: wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm rpm -ivh rpmforge-release-0.5.1-1.el5.rf.i386.rpm #64位: wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm rpm -ivh rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm 安裝完成後可使用yum repolist查看已經安裝的源,也能夠經過ls /etc/yum.repos.d/查看。 而後再yum install php55w或yum install php54w或yum install php56w||yum install php70w……就能夠安裝新版本PHP了
$ php -v
apache
$ yum list installed | grep php
vim
$ yum remove php*
windows
CentOS 6.5: $ rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm CentOS 7.x: $ rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm $ rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
$ yum list php*
$ yum install php70w
apache 啓動 systemctl start httpd 中止 systemctl stop httpd 重啓 systemctl restart httpd 或者 service httpd stop service httpd start service httpd restart mysql 啓動 systemctl start mysqld 中止 systemctl stop mysqld 重啓 systemctl restart mysqld 或者 service mysqld stop service mysqld start service mysqld restart php-fpm 啓動 systemctl start php-fpm 中止 systemctl stop php-fpm 重啓 systemctl restart php-fpm nginx 啓動 systemctl start nginx 中止 systemctl stop nginx 重啓 systemctl restart nginx 或者 service nginx stop service nginx start service nginx restart 開機自啓 chkconfig httpd on chkconfig mysqld on
nginx.pid
致使NGINX報錯"/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)
/usr/local/nginx/sbin/nginx -s stop
NGINX重啓 /usr/local/nginx/sbin/nginx -s reload
解決辦法 /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
可是nginx.pid被刪除會出現以下問題
[root@izwz993bv9azta8nrfwuhqz sbin]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] still could not bind() [root@izwz993bv9azta8nrfwuhqz sbin]# /usr/local/nginx/s sbin/ scgi_temp/ [root@izwz993bv9azta8nrfwuhqz sbin]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] still could not bind() [root@izwz993bv9azta8nrfwuhqz sbin]# kill -9 80 -bash: kill: (80) - 沒有那個進程 [root@izwz993bv9azta8nrfwuhqz sbin]# lsof -i :80 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME AliYunDun 2175 root 20u IPv4 18156 0t0 TCP izwz993bv9azta8nrfwuhqz:39954->100.100.30.25:http (ESTABLISHED) nginx 13994 root 6u IPv4 203889 0t0 TCP *:http (LISTEN) nginx 31604 nobody 6u IPv4 203889 0t0 TCP *:http (LISTEN) [root@izwz993bv9azta8nrfwuhqz sbin]# kill -9 13994
其實感受httpd也能夠可是這裏不使用這種方式
啓動php-cgi: 1. php-cgi -b 127.0.0.1:8000 -c /etc/php.ini; # 注意這只是前臺啓動 2. 開機自啓動: cat /etc/init.d/S51phpCGI echo "Start php-cgi." php-cgi -b 127.0.0.1:8000 -c /etc/php.ini &
server { listen 80; server_name www.imisty.cn imisty.cn; root /var/www/html/typecho; index index.html index.htm index.php; if (!-e $request_filename) { rewrite ^(.*)$ /index.php$1 last; } location ~ .*\.php(\/.*)*$ { include fastcgi.conf; fastcgi_pass 127.0.0.1:8000; } access_log logs/misty.log combined; }
PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/msql.so' - /usr/lib64/php/modules/msql.so: cannot open shared object file: No such file or directory in Unknown on line 0
;
刪除便可 (注意不一樣系統的開啓方式不一致,windows下爲.dll,unux下爲.so)這裏安裝了數據庫擴展,php-cgi啓動也會出現mysql.so的問題,可是不影響頁面數據庫適配器加載了,也不影響啓動和安裝
yum remove php-common 已加載插件:fastestmirror 正在解決依賴關係 --> 正在檢查事務 ---> 軟件包 php56w-common.x86_64.0.5.6.40-1.w7 將被 刪除 --> 正在處理依賴關係 php56w-common(x86-64) = 5.6.40-1.w7,它被軟件包 php56w-5.6.40-1.w7.x86_64 須要 --> 正在處理依賴關係 php56w-common(x86-64) = 5.6.40-1.w7,它被軟件包 php56w-gd-5.6.40-1.w7.x86_64 須要 --> 正在處理依賴關係 php56w-common(x86-64) = 5.6.40-1.w7,它被軟件包 php56w-cli-5.6.40-1.w7.x86_64 須要 --> 正在處理依賴關係 php56w-common(x86-64) = 5.6.40-1.w7,它被軟件包 php56w-pdo-5.6.40-1.w7.x86_64 須要 --> 正在檢查事務 ---> 軟件包 php56w.x86_64.0.5.6.40-1.w7 將被 刪除 ---> 軟件包 php56w-cli.x86_64.0.5.6.40-1.w7 將被 刪除 ---> 軟件包 php56w-gd.x86_64.0.5.6.40-1.w7 將被 刪除 ---> 軟件包 php56w-pdo.x86_64.0.5.6.40-1.w7 將被 刪除 --> 解決依賴關係完成 依賴關係解決
yum -y install php-mysql 已加載插件:fastestmirror Loading mirror speeds from cached hostfile * webtatic: us-east.repo.webtatic.com 正在解決依賴關係 --> 正在檢查事務 ---> 軟件包 php-mysql.x86_64.0.5.4.16-46.el7 將被 安裝 --> 正在處理依賴關係 php-pdo(x86-64) = 5.4.16-46.el7,它被軟件包 php-mysql-5.4.16-46.el7.x86_64 須要 --> 正在檢查事務 ---> 軟件包 php-pdo.x86_64.0.5.4.16-46.el7 將被 安裝 --> 正在處理依賴關係 php-common(x86-64) = 5.4.16-46.el7,它被軟件包 php-pdo-5.4.16-46.el7.x86_64 須要 --> 正在檢查事務 ---> 軟件包 php-common.x86_64.0.5.4.16-46.el7 將被 安裝 --> 解決依賴關係完成
惋惜到這裏仍是出現了以下錯誤,由於以前安裝了舊版的php,沒有卸載乾淨
---> 軟件包 php-common.x86_64.0.5.4.16-46.el7 將被 安裝 --> 處理 php70w-common-7.0.33-1.w7.x86_64 與 php-common < 7.0 的衝突 --> 解決依賴關係完成 錯誤:php70w-common conflicts with php-common-5.4.16-46.el7.x86_64 您能夠嘗試添加 --skip-broken 選項來解決該問題 您能夠嘗試執行:rpm -Va --nofiles --nodigest
思路:卸載php-common,結果將php卸載了,php -v
命令都識別不了;既然5.6版本也沒法識別數據庫適配器,索性所有更換了php7,具體安裝詳見上
最終解決辦法,在相關的擴展後面加上版本就好yum -y install php70w-mysql
注意:以前由於下載不了包,修改了yum.repo.d文件的,將當前的數據源協議改成 http,這裏仍是改回https,網上的說法不要亂套用,仍是要本身思考一下的
[root@izwz993bv9azta8nrfwuhqz yum.repos.d]# kill -9 5470 [root@izwz993bv9azta8nrfwuhqz yum.repos.d]# php-cgi -b 127.0.0.1:8000 -c /etc/php.ini &
後來使用wordpress的過程當中,發現能夠不啓動,直接用nginx管理靜態網站便可(使用php-fpm服務管理),惋惜這個時候已經沒有使用typecho了,順便屢次刷新502的問題也解決了
每一絲靈感都值得被記錄,每一筆記錄都是成長,每一點成長都值得歡呼
博主我的站: www.imisty.cn
CSDN博客: https://blog.csdn.net/lookinthefog
博客園 :https://imist.cnblogs.com/
但願可以認識一些熱愛技術的小夥伴,歡迎友連接喲