SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Evangelist
    Join Date
    Mar 2011
    Location
    Bellingham, WA
    Posts
    450
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Stranger than fiction!

    Hello,

    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 Code:
    <?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:
    1) I'm using MAMP Pro
    2) I just updated Dreamweaver in the past couple of days (can't imagine that this is the issue)
    3) It's a Thursday (PROBABLY not the culprit)
    4) The problem literally seemed to appear without rhyme or reason.

    Any help would be appreciated.

    -Eric

  2. #2
    SitePoint Wizard bronze trophy Jeff Mott's Avatar
    Join Date
    Jul 2009
    Posts
    1,268
    Mentioned
    18 Post(s)
    Tagged
    0 Thread(s)
    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?
    "First make it work. Then make it better."

  3. #3
    SitePoint Evangelist
    Join Date
    Mar 2011
    Location
    Bellingham, WA
    Posts
    450
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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?

    -Eric

  4. #4
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,177
    Mentioned
    454 Post(s)
    Tagged
    8 Thread(s)
    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?

  5. #5
    SitePoint Evangelist
    Join Date
    Mar 2011
    Location
    Bellingham, WA
    Posts
    450
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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?

  6. #6
    SitePoint Evangelist
    Join Date
    Mar 2011
    Location
    Bellingham, WA
    Posts
    450
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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!

  7. #7
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,177
    Mentioned
    454 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by kreut View Post
    I actually have 2 different local servers
    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:

    http://www.lullabot.com/videos/insta...server-mac-osx

    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?

  8. #8
    SitePoint Evangelist
    Join Date
    Mar 2011
    Location
    Bellingham, WA
    Posts
    450
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Ports

    Ralph,

    Thank you for the video. I think that my ports are set up correctly:

    ports.png

    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?

    -Eric

  9. #9
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,177
    Mentioned
    454 Post(s)
    Tagged
    8 Thread(s)
    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?

  10. #10
    SitePoint Evangelist
    Join Date
    Mar 2011
    Location
    Bellingham, WA
    Posts
    450
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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...

  11. #11
    SitePoint Evangelist
    Join Date
    Mar 2011
    Location
    Bellingham, WA
    Posts
    450
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Solved it...unintentionally...

    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...

  12. #12
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,177
    Mentioned
    454 Post(s)
    Tagged
    8 Thread(s)
    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.

  13. #13
    SitePoint Evangelist
    Join Date
    Mar 2011
    Location
    Bellingham, WA
    Posts
    450
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Well, you more often than not (understatement!) have just a bit more of a clue than the rest of us.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •