簡體   English   中英

403在Wordpress中調用外部PHP時禁止

[英]403 Forbidden while Calling External PHP in Wordpress

我在Wordpress中創建了一個新頁面。 在此頁面上,我放置了以下HTML代碼:

Please click this <a href="http://sitename.com/blog/wp-content/themes/twentytwelve/statistics.php" title="link">link</a> to view the details.

statistics.php具有查詢后端MySQL數據庫,獲取詳細信息並以表格格式顯示的代碼。

但是,當我單擊Wordpress頁面上的鏈接時,收到403禁止消息。

Forbidden

You don't have permission to access /blog/wp-content/themes/twentytwelve/statistics.php on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

我嘗試將PHP文件的權限設置為644和755。錯誤仍然存​​在。

我什至嘗試將這樣的簡單代碼放入PHP文件:

<?php echo "welcome"?>

即使這樣,同樣的403禁止錯誤。

現在,我在此Wordpress網站上還有另一個頁面。 在該頁面中,我有一個HTML表單,該表單將POST請求發送到名為process.php的PHP文件,該文件與statistics.php位於同一目錄中。 該頁面正常工作。

因此,我嘗試將新頁面中的URL從statistics.php替換為process.php。 那不會給出403禁止錯誤。

為什么無法從wordpress頁面訪問一個PHP文件? 我只能從wordpress頁面鏈接到一個外部PHP文件嗎?

statistics.php和process.php都具有相同的權限。 但是,盡管一個頁面能夠輕松訪問process.php,但另一頁面卻給了statistics.php錯誤。

幫助將不勝感激。

謝謝。

腳本所在的目錄不可讀,也不可讀。 wordpress使用它來存儲主題,該目錄只能由wordpress讀取,以便將主題輸出到前端。

嘗試將腳本放置在不受WordPress控制/不需要的目錄中。 即,在您的公共根目錄上,創建一個新的可讀目錄,並在該目錄下放置所需的任何腳本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM