Wamp Server isn't executing php code

﹥>﹥吖頭↗ 提交于 2019-11-29 04:44:44

You're trying to execute PHP in an ".html" file. You have to edit the PHP handler in the apache config to make it process whatever file extension you want it to. Look for "AddType application/x-httpd-php .php" in your Apache configuration file (somewhere like 'wamp/apache/conf/httpd.conf') then just add " .html" after ".php". The line should look like this now:

AddType application/x-httpd-php .php .html

PHP should now execute any code it finds in files with ".php" and ".html" extensions.

Edit: Or as someone suggested above, just rename your file "sample.php" and it'll be processed.

Pranav Hosangadi

No extensions can interfere with execution of php because it is executed at the server end, not the client end.

The php code is not executed because your file's extension is html and the WAMP server does not process .html files.

Change the extension to sample.php and then it will work

It might help somebody. Changing the tags from

<?

to

<?php

did the trick for me on my WAMP server.

If you're seeing literally the string

<?php phpinfo(); ?>

Open the httpd.conf file and uncomment the line

LoadModule php5_module "C:/PROGRA~1/BITNAM~1/php/php5apache2_2.dll"

Also, make sure the filename ends with .php exactly. If windows adds a .txt or other crap when you save the file to the end, apache will not know to have php process it.

restart all services and make sure that WAMP server icon is green if it is not then restart wamp server or re-installed it.Then check for localhost.

I got here by google for the same symtoms.

In my case, it was just the Windows Explorer wich was hiding file extensions.

A good trap for casual users of Windows, like me.

So instead of having my file named index.php, I had actually index.php.txt.

I fixed the extension display by using this procedure : http://kb.winzip.com/kb/entry/26/

The clue was : I had no IDE icon on my php file.

I don't know if my answer really helps, 5 years after the initial question...

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