启用从浏览器中查看testing文件的PHP源代码

我想通过浏览器使我的UnitTests可用。

我的目录结构如下所示:

application docs public - index.php tests 

我的DocumentRoot在公用文件夹中。 但是,当我尝试向我的Apacheconfiguration添加一个别名/源,并设置添加types的php-source到.php文件(而不是仅仅.phps),Apache仍然尝试执行这些文件。

有没有一个聪明的方法来做到这一点?

这是我find的解决scheme:

 Alias /test "/var/www/api_dev/tests" <Directory "/var/www/api_dev/tests/"> AddType application/x-httpd-php-source .php </Directory> 

最简单的方法就是将文件重命名/复制到.phps扩展名。

MIMEtypes应该已经到位,你应该准备好了。

  • MIMEtypes:text / html的
  • MIME:应用/ X的httpd – PHP-源
  • MIME:应用/ X的httpd – PHP3源