After having installed WAMP, php files download when accessed through the browser instead of being run

爱⌒轻易说出口 提交于 2019-12-10 02:09:38

问题


After having installed WAMP, I successfully accessed http://localhost/index.php which is the WAMP index page. So Apache is working properly.

I then copied my code into C:/wamp/www/mycode/ and tried to access it through http://localhost/mycode/somepage.php. Instead of running the script it downloads it at this point.

Moving the files to C:/wamp/www/somepage.php works perfectly fine though, so for some reason it won't allow me to have files in a subdirectory of the root folder.

My httpd.conf file includes the following types and handlers:

AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3

AddHandler application/x-httpd-php .php .phtml
AddHandler x-httpd-php .php .phtml

I have browsed through a large number of related problems but none have been able to solve my problem. The problem must be that for some reason I cannot run my php files in a subdirectory of the root folder. Also, I have tried running html files in said subdirectory and they work fine.


回答1:


I had this problem and if you actually never played with your server configuration settings, then your problem is 90% in your .htaccess file

Check your http://localhost/mycode/.htaccess file or try running your site without it.



来源:https://stackoverflow.com/questions/8600194/after-having-installed-wamp-php-files-download-when-accessed-through-the-browse

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