Browser forces downloading the php page when I want to open the page

依然范特西╮ 提交于 2019-12-08 11:08:05

问题


I use a VPS for my website. its based on Laravel framework and I have sat up php54 for my website.

Now when I want to open the website (index.php in the public folder of Laravel), browser just force downloading the file as a application/x-httpd-php54 file type.

I tested adding

AddType application/x-httpd-php54 .php

and AddHandler to the .htaccess in the public folder.
Neither worked!

I should mention if I enter the ip of my website or enter the name of page it opens the website with no problem.

  • ip loads mysite

  • www.example.com loads mysite

  • example.com/index.php loads mysite

But for example.com browser forces downloading the file!!!!


回答1:


I noticed that the server document root is XXX and I have a virtual host named example.com with the same document root;

Therefor when I enter the ip, it loaded the document root and it is fine, if I enter the domain name it tries to load the page from virtual host which was unsuccessful.

I deleted the virtual host, because I didn't need virtual host when I could handle my website via the server itself.

Now everything works!



来源:https://stackoverflow.com/questions/24129120/browser-forces-downloading-the-php-page-when-i-want-to-open-the-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!