PHP and MySQL (Please help. I'm really desperate)

Discussion in 'Web Design and Development' started by scan, Feb 20, 2009.

  1. scan macrumors 6502

    Joined:
    Oct 24, 2005
    #1
    I usually am able to solve my own problems using google but I'm desperate to the point where I'm hoping someone can help me on this forum.

    Here's the main problem: I'm running OSX 10.4.11. It has php 4.4.9 preinstalled. I'm trying to run PHP 5 and MySQL so I can do some development on my laptop. After countless hours of googling and trying to update my PHP, I can't get my apache to run php 5. It keeps running 4.4.9 even though the binary (/usr/local/bin/php) shows version 5, while (/usr/bin/php) shows version 4. That's the first problem. (Yes, I tried configuring httpd.conf)

    Second, I've installed the latest MySQL but I can't connect to it. It's giving me a socket error.

    I'm really not a webdeveloper but I have a huge assignment to do and I really need to get these components running. I really don't know what else to do.
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    Honestly, MAMP is the easy way to go. It'll set you up with PHP5 and MySQL without any hassle.

    If that's not what you want it would help to see some of your configuration files. Like what you configured in the httpd.conf file.
     
  3. ezkimo macrumors regular

    Joined:
    Sep 12, 2002
    #3
    I've never found dealing with PHP and MYSQL on OS X very straight forward.

    Perhaps try MAMP?
     
  4. antibact1 macrumors 6502

    Joined:
    Jun 1, 2006
    #4
    1. I don't have a copy of the OS X 10.4 httpd.conf but try adding a LoadModule statement for the PHP5 .so file you installed.

    2. Update your php.ini and change the mysql.default_socket and mysqli.default_socket variables so they are '/tmp/mysql.sock'.
     
  5. scan thread starter macrumors 6502

    Joined:
    Oct 24, 2005
    #5
    Ok oddly enough, I just tried to install everything once again and it worked! So this is great now. I have mysql php 5 running. Only one problem now. I can't get the cgi interpreter to run php scripts. Any ideas?
     
  6. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #6
    Can you show us what you've tried so far?
     
  7. wdonegan macrumors newbie

    Joined:
    Jul 17, 2008
    #7
    Mamp

    Echoing the recommendation to install and develop with MAMP. It's just drop dead easy. Spend your time coding, rather than chasing settings in config and ini files.
     
  8. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #8
    You don't want to run PHP as a CGI, you want it as a shared module (DSO) in Apache - runs so much faster.

    In httpd.conf something like this:
    Code:
    LoadModule php5_module libexec/apache2/libphp5.so
    AddType application/x-httpd-php .phtml .php
    AddType application/x-httpd-php-source .phps
    
    Assuming Apache 2.2 series was compiled with --enable-mods-shared=most or all, or in any way dynamically compiled as DSO's and the .so file lives there, i.e. libphp5.so was created when PHP5 was compiled. Restart apache after every change to httpd.conf.

    If you don't know what any of the above is then you should NOT be modifying your Mac, stop what you're doing and install MAMP - which installs all this for you without need to know the tech stuff, plus it is installed separate from your Mac default setup and you can easily start/stop the daemons via app icons.


    -jim
     
  9. Wee Beastie macrumors regular

    Joined:
    Aug 20, 2007
    Location:
    In the snow with Rosebud

Share This Page