Jump to content

[SOLVED] How to run PHP locally?


Maracles

Recommended Posts

I have just downloaded WAMP and wish to test some .php pages before uploading them to my domain, how can this be done? 

 

Currently when I run a .php page locally through the local host the PHP code is not being read and is simply being displayed as text on the page.

 

Surely there is a way to test .php pages without uploading them?

Link to comment
https://forums.phpfreaks.com/topic/163044-solved-how-to-run-php-locally/
Share on other sites

See, that is how I thought it should work and thats what I had set-up previously.

 

I have since however reinstalled WAMP and things seem to kind of work. It is reading my 'INCLUDE' PHP statements but there is one statement that it is having trouble with.

 

I have a page with tabs set-up, and each of the tabs is set up with the following line of code. Now when I run this on my domain everything works fine, however when I test this locally it it displays the tab but does not run the PHP instead I get a tab followed by this text 'href="index.php">'. Why is it displaying the text and now reading the code?

 

<li><a<? if($page == 'index') print ' class="active"'; ?>  href="index.php"><span>Home</span></a></li>

 

I know this is now a slightly different question from the original one but any ideas?

 

Argh! Thanks for the advice, that worked perfectly! I've only been learning PHP for a shortwhile and I always used to use <?php as open tags, I have no idea when I started using the 'lazy' short way, I just looked through some of my code and it seems I've been doing it a lot recently :-S.

 

I'll start retraining myself now!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.