编辑/ tmp中的testme.php文件.
echo "test";
?>
编辑一篇名为test and upload file /tmp/testme.php的新帖子,用url http://home.local/wp/?p = 4785发布.
我想看看testme中的内容,点击它,在wordpress中弹出新窗口.
继续点击它.网页上显示的测试结果.
我的期望:
1.只需在测试帖中点击testme一次.
2.将testme.php显示为纯文本,
echo "test";
?>
而不是执行testme.php的结果.
test
我根据一些材料显示配置php文件作为apache中的纯文本.
sudo vim /etc/apache2/sites-available/000-default.conf
ServerName www.home.local
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Options Indexes FollowSymLinks MultiViews
AllowOverride All
allow from all
php_flag engine off
AddType text/plain php
重启apache2(在debian中构建).
sudo systemctl restart apache2
要打开帖子http://home.local/wp/?p = 4785,我在网页上得到以下输出:
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define('WP_USE_THEMES', true);
/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );