แก้ไขให้ WordPress Upload Files Size ได้มากกว่า 2 MB

PHP Configuration Cpanel X
PHP Configuration Cpanel X

วันนี้ขอพูดถึงวิธีแก้ไขให้ WordPress สามารถ Upload File ได้มากกว่า 2 MB ครับ ปกติแล้ว WordPress สามารถ Upload File ได้มากกว่านั้นครับแต่เนื่องจาก Hosting จะไม่ยอมให้เรา Upload File ได้มากกว่านี้นั้นเองถ้าเราไปเช่า Hosting เขาอยู่เป็นเรื่องยากอยู่แล้วครับที่จะไปขอให้เขาแก้ไขไฟล์ php.ini ให้เรา ซึ่งปกติ Error ที่เกิดจะมีข้อความประมาณนี้ครับ “file_name.zip exceeds the maximum upload size for this site.” หรือ “The uploaded file exceeds the upload_max_filesize directive in php.ini.” แน่นอนครับโดน Limit ไว้ด้วย Hosting แน่ๆ ลองเข้าไปดูได้ครับหากเป็น Cpanel X เข้าดูได้ที่ PHP Configuration ตรง upload_max_filesize จะบอกค่าไว้ตรง Value ครับว่าเราสามารถ Upload ได้มากสุดเท่าไรตรงนี้ได้มากสุดคือ 2M วันนี้ผมเลยจึงมีวิธีหลากหลายวิธีมานำเสนอครับ เป็นทางเลือกในการแก้ไขปัญหานี้ไปดูกันเลยครับ

1. แก้ไข Theme Functions File

ใน Theme ของเรานั้นจะมีไฟล์ functions.php อยู่ทุก Theme เลยครับ ให้เปิดไฟล์ขึ้นมาแล้วแทรกคำสั่งนี้ลงไปบนสุดครับ

@ini_set( ‘upload_max_size’ , ’64M’ );
@ini_set( ‘post_max_size’, ’64M’);
@ini_set( ‘max_execution_time’, ‘300’ );

2. แก้ไข PHP.INI

การแก้ไข php.ini นี้จะสามารถแก้ไขได้ก็ต่อเมือเราเป็น Administrator เท่านั้นครับ หากเป็น user ที่เช่า hosting เขาก็หมดสิทธิ์ครับ วิธีแก้ก็ให้เปิดไฟล์ php.ini ขึ้นมาแล้วหาข้อความพร้อมกับแก้ให้ให้เป็นดังนี้ครับ

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300

3. Update .htaccess file

การแก้ไขไฟล์ .htaccess นับเป็นทางเลือกที่ง่ายๆ อีกทางหนึ่งครับ เพราะทุกเว็บไซต์นั้นจะมีไฟล์ .htaccess และเราสามารถแก้ไขได้อยู่แล้ว วิธีการนั้นคือให้เพิ่มคำสั่งแบบนี้ไปที่ในไฟล์ครับ

  1. php_value upload_max_filesize 64M
  2. php_value post_max_size 128M
  3. php_value memory_limit 256M
  4. php_value max_execution_time 300
  5. php_value max_input_time 300

4. wp-config.php File
ให้แก้คำสั่งตามนี้ครับในไฟล์ wp-config.php

  1. @ini_set( ‘upload_max_size’ , ’20M’ );
  2. @ini_set( ‘post_max_size’, ’13M’);
  3. @ini_set( ‘memory_limit’, ’15M’ );

wp-config.php
5. Upload File ไปในโปรแกรม FTP

วิธีการนี้อาจจะง่ายที่สุดแล้วครับสำหรับการแก้ปัญหาเบื้องต้นคือให้เราเปลี่ยนไป Upload File ในโปรแกรม FTP แทนครับตรงนี้จะไม่มี Limit ในการ Upload ซึ่งใช้ได้กรณีที่ไม่ค่อยได้ Upload File ปริมาณมากบ่อยๆ ครับ เราจึงไม่จำเป็นต้องไปแก้ไขไฟล์อะไรเลย

6. ใช้งาน Plugin Increase Maximum Upload File Size
วิธีนี้ก็เป็นอีกวิธีที่ช่วยแก้ปัญหาเรื่องการอัปโหลดไฟล์ของ wordpress ได้เช่นกันครับ คือการให้ wordpress ลง plugin ที่ชื่อ Increase Maximum Upload File Size
Increase Maximum Upload File Size

หมายเหตุ การแก้ไขไฟล์อะไรก็ตามทุกครั้งต้อง Backup ไฟล์เดิมไว้ก่อนนะครับ หากมีปัญหาจะได้ restore กลับคืนได้ หรือไม่ก็ให้ Backup ทั้งหมดไว้เลยครับ

WordPress Upload รูปไม่ได้..

วันนี้นึกว่าเว็บจะใช้งานได้ตามปกติหลังจากย้ายโฮสมาแล้วซะอีก หลังจากแก้ไข Path ที่ผิดพลาดก็ดันไปเจอ Error อีกตัวหนึ่งครับ ทำให้ไม่สามารถที่จะ Upload รูปภาพขึ้นไปได้โดยใช้ Flash uploader ครับ มันจะฟ้อง Error พร้อมกับให้ปุ่ม Dismiss หากไม่สามารถใช้ Flash uploader ก็จะทำให้ความสะดวกในการทำงานลดลงไปมากเลยละครับ  สำหรับ Error ที่มันแจ้งขึ้นมาคือ

HTTP error.

An error occurred in the upload. Please try again later.

แหมม.. ขึ้นมาซะแดงแบบนี้เล่นเอาตกใจแย่เลยครับ สำหรับ Error ตัวนี้แก้ไม่ยากครับ ทำตามขั้นตอนดังต่อไปนี้เลยครับ

  1. Login FTP เพื่อดึงไฟล์ .htaccess กลับมาก่อนครับ
  2. จากนั้นเปิดไฟล์ขึ้นมาแล้วนำ Code นี้แทรกลงไปพร้อมกับ Upload กลับคืนไปทับไฟล์เก่าครับ

<IfModule mod_security.c>
<Files async-upload.php>
SecFilterEngine Off
SecFilterScanPOST Off
</Files>
</IfModule>

เพียงเท่านี้ก็จะสามารถใช้ Flash uploader ได้ตามปกติแล้วละครับ

Wordpress Error

ย้าย Host แล้ว WordPress Error

เนื่องจากเว็บไซต์ของผมเว็บนี้เมื่อก่อนนั้นอยู่โฮสนอก แต่ตอนนี้ได้ย้ายเข้ามาในโฮสไทย (โฮสพี่ต่อ tosakp ต้องขอขอบคุณพี่ต่อเป็นอย่าสูงที่รับฝากเว็บผม )  แต่หลังจากย้ายเข้ามาก็เจอปัญหามากมายในการย้ายโฮส Plugins Error บทความ Upload รูปภาพไม่ได้ WP Super Cache ไม่ทำงาน ฯลฯ แต่ปัญหาที่แก้ลำบากเล่นเอางงไปหลายวันคือไม่สามารถ Upload รูปภาพได้นี้ละครับ

Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/home/.fabricating/sutenm/sutenm.com/wp-content/uploads/2009/05) is not within the allowed path(s): (/home/www/virtual/sutenm.com/:/home/www/virtual/sutenm.com/phptmp/:/usr/share/php/) in /home/www/virtual/sutenm.com/htdocs/wp-includes/functions.php on line 1737

Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/home/.fabricating/sutenm/sutenm.com/wp-content/uploads/2009) is not within the allowed path(s): (/home/www/virtual/sutenm.com/:/home/www/virtual/sutenm.com/phptmp/:/usr/share/php/) in /home/www/virtual/sutenm.com/htdocs/wp-includes/functions.php on line 1746

Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/home/.fabricating/sutenm/sutenm.com/wp-content/uploads/2009) is not within the allowed path(s): (/home/www/virtual/sutenm.com/:/home/www/virtual/sutenm.com/phptmp/:/usr/share/php/) in /home/www/virtual/sutenm.com/htdocs/wp-includes/functions.php on line 1737

Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/home/.fabricating/sutenm/sutenm.com/wp-content/uploads) is not within the allowed path(s): (/home/www/virtual/sutenm.com/:/home/www/virtual/sutenm.com/phptmp/:/usr/share/php/) in /home/www/virtual/sutenm.com/htdocs/wp-includes/functions.php on line 1746

Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/home/.fabricating/sutenm/sutenm.com/wp-content/uploads) is not within the allowed path(s): (/home/www/virtual/sutenm.com/:/home/www/virtual/sutenm.com/phptmp/:/usr/share/php/) in /home/www/virtual/sutenm.com/htdocs/wp-includes/functions.php on line 1737

Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/home/.fabricating/sutenm/sutenm.com/wp-content) is not within the allowed path(s): (/home/www/virtual/sutenm.com/:/home/www/virtual/sutenm.com/phptmp/:/usr/share/php/) in /home/www/virtual/sutenm.com/htdocs/wp-includes/functions.php on line 1746

Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/home/.fabricating/sutenm/sutenm.com/wp-content) is not within the allowed path(s): (/home/www/virtual/sutenm.com/:/home/www/virtual/sutenm.com/phptmp/:/usr/share/php/) in /home/www/virtual/sutenm.com/htdocs/wp-includes/functions.php on line 1737

Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/home/.fabricating/sutenm/sutenm.com) is not within the allowed path(s): (/home/www/virtual/sutenm.com/:/home/www/virtual/sutenm.com/phptmp/:/usr/share/php/) in /home/www/virtual/sutenm.com/htdocs/wp-includes/functions.php on line 1746

Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/home/.fabricating/sutenm/sutenm.com) is not within the allowed path(s): (/home/www/virtual/sutenm.com/:/home/www/virtual/sutenm.com/phptmp/:/usr/share/php/) in /home/www/virtual/sutenm.com/htdocs/wp-includes/functions.php on line 1737

Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/home/.fabricating/sutenm) is not within the allowed path(s): (/home/www/virtual/sutenm.com/:/home/www/virtual/sutenm.com/phptmp/:/usr/share/php/) in /home/www/virtual/sutenm.com/htdocs/wp-includes/functions.php on line 1746

Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/home/.fabricating/sutenm) is not within the allowed path(s): (/home/www/virtual/sutenm.com/:/home/www/virtual/sutenm.com/phptmp/:/usr/share/php/) in /home/www/virtual/sutenm.com/htdocs/wp-includes/functions.php on line 1737

Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/home/.fabricating) is not within the allowed path(s): (/home/www/virtual/sutenm.com/:/home/www/virtual/sutenm.com/phptmp/:/usr/share/php/) in /home/www/virtual/sutenm.com/htdocs/wp-includes/functions.php on line 1746

Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/home/.fabricating) is not within the allowed path(s): (/home/www/virtual/sutenm.com/:/home/www/virtual/sutenm.com/phptmp/:/usr/share/php/) in /home/www/virtual/sutenm.com/htdocs/wp-includes/functions.php on line 1737

Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/home) is not within the allowed path(s): (/home/www/virtual/sutenm.com/:/home/www/virtual/sutenm.com/phptmp/:/usr/share/php/) in /home/www/virtual/sutenm.com/htdocs/wp-includes/functions.php on line 1746

Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/home) is not within the allowed path(s): (/home/www/virtual/sutenm.com/:/home/www/virtual/sutenm.com/phptmp/:/usr/share/php/) in /home/www/virtual/sutenm.com/htdocs/wp-includes/functions.php on line 1737

Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/) is not within the allowed path(s): (/home/www/virtual/sutenm.com/:/home/www/virtual/sutenm.com/phptmp/:/usr/share/php/) in /home/www/virtual/sutenm.com/htdocs/wp-includes/functions.php on line 1746

Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/) is not within the allowed path(s): (/home/www/virtual/sutenm.com/:/home/www/virtual/sutenm.com/phptmp/:/usr/share/php/) in /home/www/virtual/sutenm.com/htdocs/wp-includes/functions.php on line 1737

Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/) is not within the allowed path(s): (/home/www/virtual/sutenm.com/:/home/www/virtual/sutenm.com/phptmp/:/usr/share/php/) in /home/www/virtual/sutenm.com/htdocs/wp-includes/functions.php on line 1746

Unable to create directory /home/.fabricating/sutenm/sutenm.com/wp-content/uploads/2009/05. Is its parent directory writable by the server?
ขึ้น Error แบบนี้ ท่านใดที่เจอปัญหาแบบผม วันนี้ผมจะมาเสนอแนวทางการแก้ไขครับ ปัญหานี้เกิดจากสาเหตุ 2 สาเหตุครับ คือ Permission และ Path ผิดพลาด วิธีแก้คือ
  1. ปรับ Permission Directory uploads และ Directory ย่อยที่อยู่ใน uploads ให้เป็น 777
  2. Login เข้าไปที่ admin เข้าที่ Settings > Miscellaneous > ช่อง Store uploads in this folder แก้ไขเป็น “wp-content/uploads”

เพียงเท่านี้คุณก็จะสามารถ Upload ไฟล์รูปภาพได้ครับ

วิธีทำ Contact Us ใน WordPress

วันนี้ผมจะมาเสนอวิธีทำ Contact Us (ติดต่อเรา) อย่างง่ายใน  CMS อย่าง WordPress กับ Plugin ที่ชื่อ  Easy Contact นะครับ

ก็อย่างที่ผมอกไป คือมัน ง่าย.. แสนง่าย.. แต่ตัวผมนั่งจมเป็นเวลา 10 นาที เหอๆ ทำไมง่ายแต่ยาก เอ้ย ง่ายแต่ใช้เวลานาน ก็เพราะมันง่ายจนตัวกระป๋มเอง งงไงละครับ เอ้า.. ยิ่งเขียนยิ่ง งงตัวเอง ฮ่าๆ เอาเป็นว่าไปดูวิธีทำดีกว่าครับ

1. เข้าไปโหลด Plugin ที่ชื่อ Easy Contact ใน http://wordpress.org/extend/plugins/easy-contact/
2. อัป Plugin ตัวนี้ขึ้นไปในเว็บ แล้วเข้าไป Activate ครับ
3. เข้าไปจัดการ Form ได้ที่ Settings > Contact
4. สร้าง Page หรือ Posts ขึ้นมา จากนั้นนำ Code [easy-contact] ไปวางไว้

จบข่าว ง่ายๆ เลยครับ

Wordpress Social Share Plugin powered by Ultimatelysocial