Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My WAMP server is not executing PHP. I have already tried the following things:

  • restarted just Apache
  • restarted all WAMP services
  • restarted the WAMP application
  • restarted my whole system
  • renamed the file
  • placed the file in the root direcory
  • my file is named index.php, its not a txt file
  • I am accessing it as localhost/phppractice/index.php
  • Tried on different browsers (Chrome, FF, Opera)

This is my code, which I am assuming is correct:

<?php phpinfo(); ?>

Simple as that. I have also tried to run it as:

<html>
<head>
<title>TEST</title>
</head>
<body>
<?php phpinfo(); ?>
</body>
</html>

And to substitute the phpinfo() with hello world. The result is the same - a blank page. No code, no result of the code, nothing, just a blank page. I have totally no idea what am I doing wrong.

share|improve this question
    
Did you enable php in your apache configs? thesitewizard.com/php/install-php-5-apache-windows.shtml –  Kruug Jun 21 '13 at 15:48
    
Is apache set up to map your phppractice/ folder correctly? –  MattDMo Jun 21 '13 at 15:48
    
Also, did you check the server logs to see if there is an error someplace? –  MattDMo Jun 21 '13 at 15:49
    
@Kruug - yes, I have Apache 2.2.22 and LoadModule php5_module "c:/wamp/bin/php/php5.3.13/php5apache2_2.dll" in the config, so it should be ok. –  user232865 Jun 21 '13 at 15:55
    
@MattDMo - I don't really know what do you mean by mapping, I am just starting out. Though I can say that I had no problems viewing pure html websites using WAMP and when I add some additional content to the file it displays correctly (EDIT: the additional content displays correctly, the PHP funcion still doesn't work). Also, the error logs do not contain any trace of PHP errors, only errors saying that there is a favicon misssing for localhost root (server config). –  user232865 Jun 21 '13 at 15:57

1 Answer 1

Make sure that the filename of the script you are running has an extension of .php

If you use a .html extension it will not be passed to the PHP interpreter for compilation and execution.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.