PHP, Apache 2, MySQL on Leopard

Discussion in 'Web Design and Development' started by bbarnhart, Oct 19, 2007.

  1. bbarnhart macrumors 6502a

    bbarnhart

    Joined:
    Jan 16, 2002
    Location:
    Stilwell, Kansas
    #1
    I'm running PHP, Apache2 and MySQL on Tiger doing some personal web development work and was wondering if there's any changes coming along with Leopard. If I install Leopard, will I have to adjust my settings for web development or should they continue to work?
     
  2. Nugget macrumors 65816

    Nugget

    Joined:
    Nov 24, 2002
    Location:
    Houston Texas USA
    #2
    Fundamentally there's no change in how that all works in Leopard. If you're using the Apache that ships with OS X, though, be aware that there's been a pretty dramatic version jump. Apache is version 2.2.6 in Leopard (a huge leap from 1.3.33 in Tiger). Similarly, php in Leopard is php5, not php4 like in Tiger.

    It's unlikely you'll run into any serious problems as a result of these upgrades, but it's quite possible that you will have a few hiccups.
     
  3. Kebabselector macrumors 68030

    Kebabselector

    Joined:
    May 25, 2007
    Location:
    Birmingham, UK
    #3
    Noticed that! none of my sites (which are hosted on my Mac) no longer work.

    It seems to be an issue with the virtual host. It was in the httpd.conf file (in the httpd folder). Not too sure if it should be in the apache2 folder now.

    I'll attempt to have a look in the morning, unless someone else knows. Help!!
     
  4. UltraNurd macrumors newbie

    Joined:
    Aug 3, 2003
    Location:
    Watertown, MA
    #4
    I copied and pasted my VirtualHost directive from my old /etc/httpd/httpd.conf to my new /etc/apache2/users/myname.conf, which is automatically included by /etc/apache2/httpd.conf by default; that "just worked", in terms of getting my main domain name to point to my ~/Sites/ directory, although I still have to futz with SSL and MySQL. I'll get back to you.
     
  5. UltraNurd macrumors newbie

    Joined:
    Aug 3, 2003
    Location:
    Watertown, MA
    #5
    Got SSL working; I was mostly able to just copy in the directives from my SSL <VirtualHost> that was in /etc/httpd/httpd.conf into /etc/apache2/extra/httpd-ssl.conf; I did have to uncomment one line in /etc/apache2/httpd.conf to include the above SSL configuration, and I had to edit the paths to my server certificates and copy them into /etc/apache2/ssl.key/.

    I am getting this warning (IP elided), but it seems to be working, so...

    Code:
    sudo apachectl configtest
    [Fri Oct 26 23:55:32 2007] [warn] NameVirtualHost xxx.yyy.zzz.qqq:443 has no VirtualHosts
    Syntax OK
    
     
  6. UltraNurd macrumors newbie

    Joined:
    Aug 3, 2003
    Location:
    Watertown, MA
    #6
    MySQL doesn't have an OS X Installer package for 10.5 yet, so I grabbed the source tarball and modified the configure line they specify on their OS X platform notes to combine with Apple's instructions, followed my a make and a sudo make install.

    Code:
    CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --disable-shared --with-unix-socket-path=/usr/local/mysql/run/mysql_socket --with-mysqld-user=mysql
    
    Note that the mysql user and group appear as _mysql in directory listings... not sure why that is.

    I continued with Apple's instructions to set permissions properly.

    I then copied my old data directory into place, started mysqld, and then I had to point phpmyadmin's config.inc.php to use the socket specified on the command line above.

    You don't get the nice pref pane server starter, though, so I'm not sure what happens when I restart; I doubt it's using launchd properly. I might try adding an entry with Lignon, or editing /System/Library/LaunchDaemons/.
     
  7. davermont macrumors newbie

    Joined:
    Oct 27, 2007
    #7
    I had been using virtualhosts under 10.4, so cloned my /etc/httpd/virtualhosts/ folder at /etc/apache2/ and copied the lines to the end of the /etc/apache2/httpd.conf file:
    NameVirtualHost 127.0.0.1
    Include /private/etc/apache2/virtualhosts/*

    Under Leopard I also needed to add entries to the /etc/hosts file as well:
    127.0.0.1 mysite
    127.0.0.1 anothersite

    At that point all my virtual hosts started working:
    http://mysite/
     
  8. colocolo macrumors 6502

    Joined:
    Jan 17, 2002
    Location:
    Santiago, Chile
    #8
    If you currently use PHP4 and use short tags ("<?" instead of "<?php"), keep in mind you will either have to update all your code to use the long tag or go to your php.ini file and change set the useshorttags (or something to that extent) to On.
     
  9. dave261 macrumors newbie

    Joined:
    Oct 29, 2007
    #9
    PHP, Apache 2, Leopard

    I upgraded my MacBookPro to Leopard with no issues. I then downloaded and installed xcode 3.0. I then followed the instructions Building and Installing Apache 2.2.4 and PHP 5.1.4 on Max OS X 10.4.6 (http://www.phpmac.com/articles.php?view=252). Apache appears to be working correctly however php scripts will not execute. When I try, the source is displayed. Any suggestions anyone?
     
  10. colocolo macrumors 6502

    Joined:
    Jan 17, 2002
    Location:
    Santiago, Chile
    #10
    Go to the Apache conf file (Apache 1.1 in OS X is /etc/https/httpd.conf), and uncomment the two lines referring to php, the "load" one and the "mod" one.
     
  11. TheReef macrumors 68000

    TheReef

    Joined:
    Sep 30, 2007
    Location:
    NSW, Australia.
    #11
    Is there a way to open php files in Safari directly from the Finder without having to navigate through the web server (running on my Mac)? The files are stored in library>webserver
     
  12. elppa macrumors 68040

    elppa

    Joined:
    Nov 26, 2003
    #12
    If I understand correctly, you just need to type in localhost or 127.0.0.1?

    This points to /Library/Webserver/Documents/
     
  13. bbarnhart thread starter macrumors 6502a

    bbarnhart

    Joined:
    Jan 16, 2002
    Location:
    Stilwell, Kansas
    #13
    Safari can't render a php file. In your case, Apache needs to recognizes it's a php file and help it get rendered.
     
  14. TheReef macrumors 68000

    TheReef

    Joined:
    Sep 30, 2007
    Location:
    NSW, Australia.
    #14
    Yes, I can access it by typing localhost, but for quickly previewing a file is what I'm after :)

    In Panther, Safari would render the page without the PHP (so I am missing portions of the page that have been 'included') but it still gave me a glimpse of the main content on the page. Is there any way to change Safari to not display the source?
     
  15. bbarnhart thread starter macrumors 6502a

    bbarnhart

    Joined:
    Jan 16, 2002
    Location:
    Stilwell, Kansas
    #15
    I didn't know it did that in Panther.
     
  16. elppa macrumors 68040

    elppa

    Joined:
    Nov 26, 2003
    #16
    If you grab TextMate (free Trial) and open it in there and then chose Show Web Preview (Window > Show Web Preview) then you can see how the rest of the page will look (roughly) without the php elements.
     
  17. TheReef macrumors 68000

    TheReef

    Joined:
    Sep 30, 2007
    Location:
    NSW, Australia.
    #17
    Oh sorry, I think it was Tiger actually.

    I found that KompoZer does exactly that - opens php files on double click and displays them properly minus the php (I chose to always open php files with Kompozer from the get info window.) The good news is that it's free :D
     
  18. bbarnhart thread starter macrumors 6502a

    bbarnhart

    Joined:
    Jan 16, 2002
    Location:
    Stilwell, Kansas
    #18
    I tried it in Tiger, but it didn't work. Maybe I didn't do it right, but I'm kinda thinking that it needs to go through Apache. Maybe there's some kinda of developer plug in that I don't have.
     
  19. benassis macrumors newbie

    Joined:
    Nov 13, 2007
    #19
    Hi UltraNurd,

    I am also trying to install SSl on my machine since about a week without success.
    I migrated from Tiger to Leopard (archive and install) on an Imac intel dual core. I succeeded installing php 5 and mysql, but SSL still resists.
    Would you be so kind to post your httpd.conf file (containing your ssl config, as stated above) ? Of course, you should elide your personnal coordinates.
    I could try to adapt it to my own configuration.
    Thanks a lot
    Regards
     
  20. radiantm3 macrumors 65816

    radiantm3

    Joined:
    Oct 16, 2005
    Location:
    San Jose, CA
    #20
    I just used the installer for 10.4 and it works fine.
     
  21. plumbingandtech macrumors 68000

    Joined:
    Jun 20, 2007
    #21
    For mysql 5.0?

    (thanks.)
     
  22. radiantm3 macrumors 65816

    radiantm3

    Joined:
    Oct 16, 2005
    Location:
    San Jose, CA
    #22
  23. rezzz macrumors newbie

    Joined:
    Dec 3, 2007
    #24
    I’ve done everything on here and more and I still have an issue. For some reason I have one VirtualHost that works just fine and the other I get 403 Forbidden. No matter what I do, it still is this way. Any ideas would be extremely helpful. Thanks in advance

    rezzz
     
  24. rezzz macrumors newbie

    Joined:
    Dec 3, 2007
    #25
    multiple dots

    Actually I just created a test virtual host and it works. The other VHs were existing sites that I moved into my vhosts directory.

    The problem I'm thinking is that the one that's giving me issues is because there are PHP files with multiple dots in the name (i.e. - class.foo.php) -- I think that's what the issue is.

    Anyone hear of this being an issue, and if so, is there a work around? I greatly appreciate the input, thanks.
     

Share This Page