Difference between revisions of "FTP Config (Wordpress)"

From P&T Knowledgebase
Jump to navigation Jump to search
Line 5: Line 5:
  
 
  define('FTP_HOST', '127.0.0.1');
 
  define('FTP_HOST', '127.0.0.1');
  define('FTP_USER', 'your-ftp-username');
+
  define('FTP_USER', 'your_ftp_username');
  define('FTP_PASS', 'your-ftp-password');
+
  define('FTP_PASS', 'your_ftp_password');
  define('FTP_BASE', 'path-to-wordpress');
+
  define('FTP_BASE', 'path_to_wordpress');
  
 
<u>หมายเหตุ</u>:  
 
<u>หมายเหตุ</u>:  

Revision as of 09:33, 21 July 2011

ปรกติเวลาเราใช้งาน Wordpress ถ้าเราไม่ได้ตั้ง CHMOD เป็น 777 Wordpress จะไม่สามารถเขียนไฟล์ได้ เวลาเราจะติดตั้ง Theme หรือ Plug-in เพิ่มเติม Wordpress จะขึ้นฟอร์มมาขอข้อมูล FTP จากคุณ ซึ่งตรงนี้จริงๆ แล้วคุณสามารถตั้ง CHMOD ทั้งหมดเป็น 777 ไปเลยก็ได้ แต่ด้วยเหตุผลด้านความปลอดภัย เราไม่ควรที่จะตั้งเป็น 777 โดยที่ไม่จำเป็น.

หลายๆ คนคงจะรู้สึกขี้เกียจที่ต้องคอยมาพิมพ์ FTP Information ทุกครั้งที่ทำการติดตั้งอะไร. จริงๆ แล้วมันมีวิธีให้ Wordpress จำค่า FTP ไว้เลย และจะไม่ขึ้นมาถามอีกครับ วิธีการคือต้องเข้าไปแก้ที่ไฟล์ wp-config.php โดยเพิ่มเข้าไปอย่างน้อย 4 บรรทัดดังนี้

define('FTP_HOST', '127.0.0.1');
define('FTP_USER', 'your_ftp_username');
define('FTP_PASS', 'your_ftp_password');
define('FTP_BASE', 'path_to_wordpress');

หมายเหตุ:

  • คุณควรจะสร้าง FTP Account แยกออกมาสำหรับให้ Wordpress ใช้อย่างเดียวเลย จะได้ไม่ต้องมาคอยแก้ไขไฟล์ wp-config.php ทุกครั้งที่คุณเปลี่ยนรหัสผ่าน FTP Account ของคุณ (วิธีการสร้าง FTP Account)
  • การแก้ไขไฟล์ wp-config.php คุณสามารถใช้ File Manager ของ DirectAdmin เพื่อแก้ไขไฟล์ได้ (วิธีการใช้งาน File Manager)


ตำแหน่งในการแทรกคำสั่งคอนฟิค

ให้วางไว้หลังบรรทัดแรกที่เป็น <?php ดังภาพตัวอย่างด้านล่าง.

2010-10-27_2314.png


Option อื่นๆ

Secure Connection
For a secure connection add the following line (default: false):

define('FTP_SSL', true);

Directories
If the WordPress installation is not in the root directory of the FTP server you can define the location as follows:

define(FTP_BASE','...');

Have you moved the plugin directory or all of the content folder? You can also specify the full path using these two constants:

define('FTP_CONTENT_DIR', '...');
define('FTP_PLUGIN_DIR', '...');

Method
Finally, you can also adjust the method to be used by WordPress for the file system. This often hides errors if something goes wrong with the file permissions. You should only change this value if errors occur, most of the time the default will work just fine.

define('FS_METHOD', 'direct');


การตั้งค่าอื่นๆ เพิ่มเติม ดูได้จากที่นี่
http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants