แก้ไข wordpress post แล้ว update ไม่ได้ แอดมินต้องแก้ไขอย่างไร

หลังจากย้าย WordPress site ไปลง ubuntu 16.04.1 ก็ได้เตรียมติดตั้งโปรแกรมต่าง ๆ แต่แล้วเมื่อลองจะแก้ไขบล็อก กลับทำไม่ได้ ขึ้นข้อความว่า

“The sysadmin.psu.ac.th page isn’t working
sysadmin.psu.ac.th is currently unable to handle this request.
HTTP ERROR 500”

เกิดอะไรขึ้นหล่ะ แล้วเราจะต้องทำอย่างไร

ค้นหาเจอเว็บนี้ ที่บอกเราว่า ให้ลองเปิด DEBUG
https://wordpress.org/support/topic/http-error-500-internal-server-error-whole-blog-is-down

“So to understand where the reason of 500 error is I suggest go to wp-config.php in the root of your website and add there two lines:
define(‘WP_DEBUG’, true);
@ini_set(‘display_errors’, 1);
After that you can see exactly place which linked with 500 error.
After fixing I suggest return it how it was by default (only one line)
define(‘WP_DEBUG’, false);”

เมื่อใช้คำสั่งตรวจสอบ error.log ครั้งแรก ไม่เห็นอะไรเพิ่มเติม แต่พบ error 404 ของ plugin ที่ชื่อ WP Like Button ก็ลองปิด plugin นี้ดูเราจึงจะพบ error ก็เห็น error ต่าง ๆ ได้จากคำสั่งข้างล่างนี้

tail -f /var/log/apache2/error.log

Fatal error: Uncaught Error: Class ‘DomDocument’ not found in /var/www/wordpress/wp-content/plugins/google-sitemap-plugin/google-sitemap-plugin.php:144

ค้นหาต่อว่าทำไมจึงขาด DomDocument ก็เจอเว็บนี้
https://blog.namran.net/2009/03/10/php-fatal-error-class-domdocument-not-found-in-blabla/
แนะนำว่า

“the solution turn out to be yum install php-xml”

ตรวจสอบดู เออนะ ไม่มี php-xml จริง ๆ ด้วย ด้วยคำสั่งนี้
dpkg -l | grep php-xml
dpkg -l | grep php7.0-xml

 

ทีนี้เราก็ติดตั้ง php-xml ด้วยคำสั่ง
sudo apt install php-xml
จะได้
libxslt1.1 php-xml php7.0-xml

ทำให้สามารถใช้งานได้ปรกติแล้ว ซึ่งในกระบวนการ post และ ppdate post นั้น ได้แก้ไข post ให้แล้ว เพียงแต่ว่ามันไปทำต่อที่ google-sitemap-plugin ไม่สำเร็จจึงแสดงเป็น error ออกมา

ขอบคุณเพื่อน ๆ ที่ช่วยกันแก้ไขเรื่องนี้ด้วยกันด้วยครับ