I’ve been using PHP for about a year now and my scripts just started to behave in a very odd manner using my local server. For example, if I have the script:
<?php echo phpinfo();
then the browser on my testing server is blank but if I go to view source, I actually see the text:
<?php echo phpinfo();
In other words, the script is not executed but gets printed behind the scenes as a “comment”.
Things that may or may not help:
- I’m using MAMP Pro
- I just updated Dreamweaver in the past couple of days (can’t imagine that this is the issue)
- It’s a Thursday (PROBABLY not the culprit)
- The problem literally seemed to appear without rhyme or reason.
Any help would be appreciated.
Sounds like your server is no longer processing PHP, which explains why the raw code is sent to the browser, and the angle brackets <> make the whole thing look like an HTML tag, which explains why the page is blank in the browser. Did you upgrade either Apache or PHP recently? Did you alter the Apache config or mime types recently? Are you sure you’re viewing the page through the server and not opened as a file through Dreamweaver?
Thanks for the response!
I fear that I haven’t changed anything in the config (I swear!) and the page is definitely being viewed through the server (http://localwwu:8888/phpinfo.php); are there any config settings that I can look at through MAMP Pro to see what it’s doing with the PHP?
I only have MAMP (not pro) but a little pox pops up when I start it that has options to view Preferences … and the Start Page. What happens if you open the start age and then click the phpinfo tab?
In that case I actually DO get the phpinfo. Also, if more information helps, I actually have 2 different local servers…and the other one seems to be able to process php just fine…Is there some way to see the behinds the scenes set-up of the misbehaving local server?
Further… when I type http://localwwu:8888 (which is the problematic local server), the phpinfo screen pops up and the document root: /Users/franciscaparedes/Sites/wwu IS the correct one. I’m really at a loss on this one!
Sounds like there is a conflict between them. You can set a different port number for MAMP in such cases. This video walks you through that issue:
At around about 3:30 it explains the port numbers. Have you tried just pointing your browser to the address without the 8888 as suggested in the video?
Thank you for the video. I think that my ports are set up correctly:
as to avoid conflicts, if I understand things correctly. In addition, I’ve actually been using this without a problem and then suddenly I’ve had this issue. (More evidence: html is printing, and hyperlinks just download the webpages instead of linking to them.)
Might there be another way to diagnose if they are in fact conflicting with each other?
In the video is says to leave 8888 out of the url in your browser. What happens if you do that? Was the other local server set up since the problem started?
I tried it with and without the additional port information; without the port info, my browser can’t find the server. And, I haven’t set up anything (to my knowledge!) since my woes began…
After doing some thinking last night I realized that of the two websites that I have, I’m actually just working on one of them at the moment. Since one of my local hosts was working, the non-elegant solution then, would be to just swap which website goes to which localhost. I did as much, moving all of the files to the correct folders, and switching which website points to which host and voila! now they BOTH work.
I fear that this makes no sense to me at all as I thought that by switching them only one of them should have still worked. And, while I’m happy that things are back to normal, these sort of magic solutions certainly don’t give me any more confidence in what I’m doing.
Regardless, thank you to Ralph and Jeff for trying to help. Enjoy your weekends…
Glad you found a solution. I can’t say I have a clue what was going on, but that’s not uncommon!
You have a good week end too.
Well, you more often than not (understatement!) have just a bit more of a clue than the rest of us.