Mar 10
在 WP 後台上傳檔案時遇到這樣的錯誤訊息:
Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/) is not within the allowed path(s): (/home/lauctorg:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/lauctorg/public_html/wordpress/wp-includes/functions.php on line 1746
Unable to create directory /Users/chun/Sites/wordpress/wp-content/uploads/2009/03. Is its parent directory writable by the server?
很明顯可以看出是上傳資料夾對應錯誤所造成,我是從 MacOSX 上把 WP 搬到虛擬主機上的,不知道什麼時候上傳目錄被寫進了資料庫,導致於搬過去後找不到正確路徑。
這時候在 WP 後台也找不到相關的設定可以修改,只好到 MySQL 中搜尋一下這串路徑是在哪張表格。發現路徑是寫在 wp_options 的表格中,直接在 phpMyAdmin 下 SQL 指令更正錯誤。
UPDATE wp_options SET option_value= REPLACE(option_value, '/Users/chun/Sites/wordpress/wp-content/uploads', '/home/lauctorg/public_html/wordpress/wp-content/uploads');
溫故知新
載入中…







April 21st, 2009 at 12:48 pm
不是在 設定>雜項 裡就有了嗎 QQ?
Lauct Reply:
April 21st, 2009 at 4:33 pm
後台設定有沒錯,但是改了沒用,雖然後台我設定為 wp-content/uploads 是正確的,但是資料庫裡的值是 /Users/chun/Sites/wordpress/wp-content/uploads, wp-content/uploads前面的路徑(/Users/chun/Sites/wordpress/)我在後台改不到,只好進資料庫改。
修改前:
/Users/chun/Sites/wordpress/wp-content/uploads
修改後:
/home/lauctorg/public_html/wordpress/wp-content/uploads