Php server problem on iMac

Discussion in 'PHP' started by ellias2007, May 16, 2010.

  1. #1
    Hi every body...
    in order to lauche the file i wrote in php code, i put it in my "sites" folder and try to open it with Safari...
    My problem that Safari shows the php CODE and not the final rendered page...
    ok , i know that in this case the Php web server is not running the code...
    But How to fix this problem and enable the php server ???
    NOTE : This Problem occurs when i upgrade from Mac OSX10.5 to Macos 10.6 (i had no such problem under 10.5!)
    Thanks for any help
     
    ellias2007, May 16, 2010 IP
  2. phpSiteMinder

    phpSiteMinder Peon

    Messages:
    47
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I use MAMP on os x. Easy to install and configure.

    But for os x's inbuilt server you will need to find httpd.conf and uncomment (delete the #) the lines:
    #LoadModule php5_module libexec/apache2/libphp5.so
    #LoadModule fastcgi_module libexec/apache2/mod_fastcgi.so
     
    phpSiteMinder, May 16, 2010 IP
  3. ellias2007

    ellias2007 Greenhorn

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #3
    Hi phpSiteMinder ...
    Let me first thank you for ur usefull answer....
    in fact, i did what u told me and it is okey! Many thanks..
    But i have a ptoblem connecting the DataBase ...
    My code is :
    -----------------------------
    <?php
    DEFINE ('DB_HOST', 'localhost');
    DEFINE ('DB_USER', 'MyName');
    DEFINE ('DB_PASSWORD', '1234');
    DEFINE ('DB_NAME', 'DBName');

    // Make the connection:
    $dbc = @mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) OR die ('Could not connect to MySQL: ' . mysqli_connect_error() );
    ?>
    --------------------------
    i receive always the Message : (Could not connect to MySQL: No such file or directory)
    What can be the problem??
    Note: My sql server is running ON and i can easly connect to all my DataBases via my other JAVA program...
    Many thakns in advance for any help
     
    ellias2007, May 18, 2010 IP
  4. phpSiteMinder

    phpSiteMinder Peon

    Messages:
    47
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Remove the '@' error suppression thingo and see what the error message is.
     
    phpSiteMinder, May 18, 2010 IP
  5. ellias2007

    ellias2007 Greenhorn

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #5
    Thanks phpSiteMinder...
    i add the Port and it works ...
    in fact, i put :
    Port : 3301 (or like this) some where and it id OK ... Although i don't know why it works and what was the problem ?!!
    :)
    Thanks
     
    ellias2007, May 21, 2010 IP
  6. Trikun3

    Trikun3 Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Make sure you have PHP compiled with the mysqli extension.
     
    Trikun3, May 22, 2010 IP