Maracles Posted June 20, 2009 Share Posted June 20, 2009 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? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted June 20, 2009 Share Posted June 20, 2009 If you have wamp installed you need to be saving all your files to C:\wamp\www Make sure wamp is running and go to http://localhost/filename.php to run your scripts. Quote Link to comment Share on other sites More sharing options...
Maracles Posted June 20, 2009 Author Share Posted June 20, 2009 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? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted June 20, 2009 Share Posted June 20, 2009 DON'T USE lazy-way short open php tags <? and <?= You got caught by and wasted a part of your life you will never get back due to the short open tag problem. Quote Link to comment Share on other sites More sharing options...
Maracles Posted June 20, 2009 Author Share Posted June 20, 2009 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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.