Newbie question

Discussion in 'Web Design and Development' started by Braille, Jan 13, 2009.

  1. Braille macrumors newbie

    Joined:
    Jan 7, 2009
    #1
    Backstory: (skip if you don't care)

    I got this mac from my brother who got it from his friend and I had to go through a huge ordeal to get past the original owner's password so I can install items. SUCCESS! It works! I started to migrate all my web development stuffs over to this computer when I realized that OS X has a built in web server. I've gone through and edited my httpd.conf file to remove the pound sign so I can load my php module, but unfortunately I'm still not parsing any PHP code on any of my pages nor am I even passing the PHP test using the diagnostic test page.

    Question:

    What if anything can I do to get this computer to parse this code outside of getting third party software like MAMP?


    If you need more info, ask and I will be happy to give it.
     
  2. kgarner macrumors 68000

    kgarner

    Joined:
    Jan 28, 2004
    Location:
    Utah
    #2
    Make sure that you have Web Sharing turned on in the Sharing tab of the System Preferences. If that is on, then there could be a problem with your php.ini file. Google for "enable PHP in Leopard" for some tips. I'm not really great with the server setup stuff and that search has helped me get everyhting up and running.
     
  3. Braille thread starter macrumors newbie

    Joined:
    Jan 7, 2009
    #3
    Yeah, I've searched and searched for a good week now and still have had no luck. Trust me, I'm not one to say, "oh no I can't do it, help!" right away. :)

    I'll keep looking, but any help is still appreciated.
     
  4. kgarner macrumors 68000

    kgarner

    Joined:
    Jan 28, 2004
    Location:
    Utah
    #4
    where is your php file with the phpinfo() command located and what URL are you using to access it?
     
  5. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #5
    Quick questions:
    1. Are you using Tiger (10.4) or Leopard (10.5)?
    2. Are you enabling PHP 4 or 5?
    3. Do you have in your httpd.conf file a segment like snippet 1 below?
    4. Did you restart the web server after making changes (uncheck and recheck the web sharing check box in system preferences)?
    5. What is the result of accessing the PHP page? Just PHP code or blank page?

    Snippet 1: Tells Apache which file extensions need to be PHP parsed.
    Code:
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php .php5
    AddType application/x-httpd-php-source .phps
     
  6. Braille thread starter macrumors newbie

    Joined:
    Jan 7, 2009
    #6
    Kgarner: My phpinfo() command is located in my phpinfo.php file in /library/webserver/documents.

    angelwatt:

    1.I am using 10.5.2
    2.I am loading the php 5 module as per the httpd.conf file.
    3. I looked in my httpd.conf file and did a find and nothing came up, so that may be what the deal is. Just for clarification though, I want to be looking at the /etc/apache2/httpd.conf correct?
    4. I've restarted and restarted the server as well as my computer.
    5. All I get is code. I get no error of any kind. I would prefer an error at this point. :)
     
  7. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #7
    Yup, that's the correct httpd.conf file. If you're seeing code that's usually a good sign that Apache isn't parsing the PHP, which is what that question 3 was getting at, so try those lines I provided to see if they help. For the most part it doesn't matter where you add them, but there's some other lines that deal with the AddType so you may want to place them near there for consistency.
     
  8. Braille thread starter macrumors newbie

    Joined:
    Jan 7, 2009
    #8
    I added those lines and I'm still not getting any luck. Any other suggestions?
     
  9. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #9
    I have MAMP installed so have never taken the steps to do this, but just went through them. With just enabling web sharing I was able to see the default start page, but no PHP. I opened /private/etc/apache/httpd.conf and deleted the # at the start of this line,
    Code:
    LoadModule php5_module        libexec/apache2/libphp5.so
    I turned web sharing off then back on and I could access my the PHP correctly. I didn't even have to add the AddType lines. So there was no real modifications. I suppose it's possible the old owner messed with something. Has the machine had Leopard reinstalled since (fresh install)? It's also possible my MAMP install is helping in some way.
     
  10. Braille thread starter macrumors newbie

    Joined:
    Jan 7, 2009
    #10
    I had mamp installed up until last night with no luck either. I'm sure I am just doing something so completely bonehead at this point I'm overlooking it. I really have no clue what I could be missing though.
     

Share This Page