好吧,直到最近,我的Wordpress博客在我的VPS上運行完美。突然間,我開始看到'錯誤建立數據庫連接'頁面。WordPress的:建立數據庫連接和Apache2問題的錯誤
我在wp-config.php中檢查了我的數據庫用戶和密碼憑據,但一切似乎都很好。
我試過sudo service apache2 restart
和sudo service apache2 reload
多次,但那也沒有效果。
所以,我嘗試運行apache2
,我得到這個:
[email protected]:~$ apache2
[Sat Sep 26 07:23:42.098529 2015] [core:warn] [pid 4151] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Sat Sep 26 07:23:42.103296 2015] [core:warn] [pid 4151] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Sat Sep 26 07:23:42.103510 2015] [core:warn] [pid 4151] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Sat Sep 26 07:23:42.103706 2015] [core:warn] [pid 4151] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Sat Sep 26 07:23:42.103940 2015] [core:warn] [pid 4151] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Sat Sep 26 07:23:42.173950 2015] [core:warn] [pid 4151] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Sat Sep 26 07:23:42.175114 2015] [core:warn] [pid 4151] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Sat Sep 26 07:23:42.176655 2015] [core:warn] [pid 4151] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00526: Syntax error on line 2 of /etc/apache2/apache2.conf:
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}
搜索我的方式來this question。不,我沒有將我的服務器從Ubuntu 12.04更新到14.04,它從一開始就在Ubuntu 14.04上運行。所以我決定給一個答案一個鏡頭:
source /etc/apache2/envvars
/usr/apache2/sbin -V
sudo service apache2 restart
沒有'錯誤建立數據庫連接'頁面了!它再次開始工作!
除了它沒有和錯誤頁面回來一段時間後。從那以後,我每次博客發生故障時都通過上述三個命令手動重置缺失的環境。
我每次運行這些命令時,我的博客都會暫時工作,但可以在一段時間後返回「錯誤建立數據庫連接」頁面。
有人可以幫我嗎?
非常感謝你提前!
編輯:Here是我的wp-config.php供參考。
在網站的前端和網站的後端(wp-admin)上都得到相同的錯誤? –
我的意思是這兩個消息是相同的?如果他們不是,你將不得不修復你的數據庫經常與服務器發生。 –
我試圖通過define('WP_ALLOW_REPAIR',true)修復我的數據庫,但所有的數據庫看起來都很好。 – radhika