Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP不使用XAMPP(Windows)执行_Php_Sql Server_Apache_Xampp - Fatal编程技术网

PHP不使用XAMPP(Windows)执行

PHP不使用XAMPP(Windows)执行,php,sql-server,apache,xampp,Php,Sql Server,Apache,Xampp,(为了澄清而编辑)我正试图使用XAMPP中的ApacheWeb服务器在一个名为“index.PHP”的文件中执行一些PHP代码。该文件位于C:\xampp\htdocs\index.php.txt(不知道如何去掉.txt后缀)。我通过在浏览器中键入“”来访问该文件。代码是: <!DOCTYPE html> <html> <body> <?php echo "It works!"; ?> </body> </html&g

(为了澄清而编辑)我正试图使用XAMPP中的ApacheWeb服务器在一个名为“index.PHP”的文件中执行一些PHP代码。该文件位于C:\xampp\htdocs\index.php.txt(不知道如何去掉.txt后缀)。我通过在浏览器中键入“”来访问该文件。代码是:

<!DOCTYPE html>
<html>
<body>
      <?php echo "It works!"; ?>
</body>
</html>


在Apache服务器中选择文件时,只显示代码本身。我已经四处搜索了一段时间,似乎找不到问题所在。提前感谢。

您的PHP代码没有执行,因为服务器将文件解释为文本文件,因此代码没有执行。这是由于您的文件名,扩展名为.txt

not sure how to get rid of the .txt suffix
使用任何代码编辑器(如记事本+)将文件保存为PHP文件,从而去掉.txt扩展名


或者,对于普通的Windows记事本,只需选择另存为“所有文件”,并确保文件名仅为“index.php”。

检查日志文件此文件的位置和访问方式?这意味着php没有处理您的文件。共享您的配置文件:httpd.conf可能与我查看过的文件重复。PHP错误日志中出现“系统找不到指定的路径”错误。在任何地方都找不到任何PHP日志。Apache错误和访问日志看起来不错。