Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Newbie - Can not get PHP to connect to SQL

    Hi people

    I am very new to this, and sorry if my question sounds stupid.

    I am trying to get PHP works with MYSQL, but I recive error message:

    Fatal error: Call to undefined function mysql_connect()

    I am using: WinXP, PHP Version 5.0.4, MYSQL 4.1 and Apache 1.3.33.

    Take look at my 2 files:

    db_config.php:

    <?php
    $db_host = "localhost";
    $db_user = "php" ;
    $db_password = "f00";
    $db_name = "lagerdb";
    ?>

    temp_con.php:

    <?php
    require ($_SERVER["DOCUMENT_ROOT"]."/config/db_config.php");
    $connection = mysql_connect($db_host, $db_user, $db_password)
    or die ("error connection");
    echo "Connection made";
    ?>

    I really hope someone out there can help me out.

    PS: I followed this instruction from this link without luck: http://www.dbforums.com/t1044828.html

    1. Make sure that you have a valid php.ini in your windows directory.
    OR (Per the tut the 'php.ini' can be installed in the 'C:\Program Files\Apache Group\Apache2' folder. This works fine.)

    2. copy libmysql.dll to the system32 directory (php_mysql.dll would not load without doing this)

    3. set the extension_dir in php.ini to the ext directory of your PHP installation directory (like e.g. extension_dir=C:\php5\ext)

    4. enable the MySQL extension in php.ini by uncommenting the line extension=php_mysql.dll

    5. Restart Apache Server



    regards,

    B_real
    Last edited by b_real; 08-17-2005 at 11:09 PM.

  • #2
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Solution

    Just for the information;

    - The solution in my situation was to copy PHP.INI file into Apache main folder. AND WIPS, IT WORKED! And do follow this instruction as well: http://www.dbforums.com/t1044828.html

    I am happy now

    Best regards,

    B_real
    Last edited by b_real; 08-19-2005 at 11:13 AM.


  •  

    Posting Permissions

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