Ask Experts Questions for FREE Help !
Ask
    sypher373's Avatar
    sypher373 Posts: 360, Reputation: 38
    Full Member
     
    #1

    Mar 6, 2007, 08:43 AM
    Hello all,

    Just a little background on my system.

    I am running Windows XP Pro SP2. Firewall is disabled.

    Running Apache 2.2, PHP5 and MySQL server 5.1.

    I am trying to simple interface with my MySQL database using a webpage running PHP. I have tried using the mysql_connect(host, name, password) function, checked all the parameters 50,000 times and I still cannot connect. As a test, I wrote a small script that resembled this:

    <?php

    Echo "start";
    Mysql_connect($host, $name, $pass);
    Echo "end";

    ?>

    The problem with that is, only the "start" printed. I have no indication that I ever got connected to the database, as the insertion of a create db command yielded nothing. I have even tried the connection function using the 'or die("Error"); part. No error, no connection.

    MY firewall is turned off, MySQL operates fine at the command line, and apache is working fine. All PHP commands work, I just can't seem to interface with MySQL.

    Any suggestions? :confused: :confused:

    I forgot to mention, this is all being run on the same machine, making my hostname localhost. I have tried localhost as well as 127.0.0.1
    BenReilly's Avatar
    BenReilly Posts: 55, Reputation: 6
    Junior Member
     
    #2

    May 10, 2007, 11:25 PM
    Try the following:
    <?PHP
    $db_server = 'localhost';
    $db_name = 'whateveritis';
    $db_user = 'root';
    $db_passwort = 'password';

    $db = @mysql_connect($db_server, $db_user, $db_passwort)
    or die ('The Connection could not be established');

    $db_check = @mysql_select_db($db_name);

    if($db)
    echo 'Connection to Database is established';
    ?>
    If you are connected to the db you will receive the last message.
    interinfinity's Avatar
    interinfinity Posts: 142, Reputation: 8
    Junior Member
     
    #3

    Jan 11, 2008, 04:48 PM
    Make sure mysql services running in services.msc, try restarting apache and msql servies

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Php5 mysql hosting [ 11 Answers ]

I am looking to hopefully move my web page off my home server (when its complete) to a more capable hosting solution. All I really require of the server is that it supports PHP5 and some fairly recent version of MySQL (although I'm not particularly picky about the MySQL part). Storage and max...

His Apache Name [ 3 Answers ]

Geronimo was the name given to him by the Mexicans but what was is Apache name?

Help in PHP extension [ 1 Answers ]

Hi, Im triying to built a PHP extension, that will calls some other functions in some other .so files( in windows this is .dll files ) in Linux, I got the following error PHP Warning: Unknown(): Unable to load dynamic library '/opt/httpd/apache/php/ext/libbgt.so' -...

CGI for Apache - Premature end of script headers [ 13 Answers ]

I have a post form on my Web site in Common Gateway Interface (CGI) but when people click in order to post it, the message Premature end of script headers: mailform.cgi appears. If you'd like to see what I'm talking about please go to this page : http://www.accesss.net/pnjoindre.html. How can I...

Apache User Authentication issue.please help [ 6 Answers ]

I'm trying to restrict access to a directory on my apache webserver. Before I go into detail I'll show what I've got so far. I've successfully created the Password file. Here's the code in httpd.conf DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs" ... ... <Directory />


View more questions Search