简体   繁体   English

通过CMD调用时,Apache下载PHP文件而不是在浏览器中显示(Ubuntu)

[英]Apache downloads PHP files instead of displaying in browser when called via CMD (Ubuntu)

I've installed LAMP on my Ubuntu laptop with no apparent problems and successfully did the phpinfo() test by navigating to the file through the browser. 我已经在没有明显问题的Ubuntu笔记本电脑上安装了LAMP,并通过浏览器导航到文件成功地进行了phpinfo()测试。 But the same file is downloaded instead of executing when I'm trying to build from Sublime Text 3 using the following script: 但是,当我尝试使用以下脚本从Sublime Text 3构建时,下载的是相同文件,而不是执行文件:

 {  "cmd": ["/opt/google/chrome/google-chrome" ,"$file"] }

That worked the first couple of times I tested it, but stopped right after I changed the name of the build system and hasn't been functioning since even after I reversed the change. 在我测试它的前几次,它奏效了,但是在我更改了构建系统的名称后就停止了,并且自从我撤消更改后就一直没有起作用。 How would I go about fixing the issue? 我将如何解决该问题?

$file is " The full path to the current file, eg, C:\\Files\\Chapter1.txt. ". $file是“ 当前文件的完整路径,例如C:\\ Files \\ Chapter1.txt。 ”。

Apache isn't causing the file to be downloaded; Apache不会导致文件下载; you aren't requesting it from Apache. 您不是从Apache请求它。

You need to translate $file into a URL on your HTTP server. 您需要将$file转换为HTTP服务器上的URL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM