My PHP file is unable to connect MYSQL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rahulnewdelhi
    New Member
    • May 2007
    • 7

    My PHP file is unable to connect MYSQL

    hello all

    Hello all

    I installed php, mysql and IIS in xp. Problem is this while i run following file

    PHP Code:
    ----------------

    <?php
    phpinfo();
    ?>

    it doesnt show mysql info table in result. I seen mysql server it is running well. While i am trying to connect

    my php file to mysql database then it doesnt connect. why it is happening? how to short out this problem,

    please help me

    regards
  • james01
    New Member
    • May 2007
    • 1

    #2
    i will want you to send me your mail adress anmd i will send ou the mailer on
    here is my mail adress(jamescot t_2@hotmail.com )...



    Hello all

    I installed php, mysql and IIS in xp. Problem is this while i run following file

    PHP Code:
    ----------------

    <?php
    phpinfo();
    ?>

    it doesnt show mysql info table in result. I seen mysql server it is running well. While i am trying to connect

    my php file to mysql database then it doesnt connect. why it is happening? how to short out this problem,

    please help me

    regards[/QUOTE]

    Comment

    • teesha
      New Member
      • May 2007
      • 4

      #3
      i think you need to verify dynamic extensions in "php.ini " (your configuration file)
      extension=php_m ysql.dll
      extension=php_m ysqli.dll
      don't forget to restart your server

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Did you install PHP after you installed MySQL? DId you install PHP with MySQL support? It's been awhile since I've worked on a PC, but when you're using the PHP installer, it should give you the option to install optional components. Verify that MySQL is selected in that list.
        Last edited by pbmods; May 5 '07, 08:00 PM. Reason: str_replace('support.', 'support?', $FORUM_POST['text'], 1);

        Comment

        • Rahulnewdelhi
          New Member
          • May 2007
          • 7

          #5
          My PHP file is unable to connect MYSQL, help me

          Hello all

          I installed php, mysql and IIS in xp. Problem is this while i run following file

          PHP Code:
          ----------------

          <?php
          phpinfo();
          ?>

          it doesnt show mysql info table in result. I seen mysql server it is running well. While i am trying to connect my php file to mysql database then it doesnt connect. why it is happening? how to short out this problem,

          please help me

          Comment

          • ak1dnar
            Recognized Expert Top Contributor
            • Jan 2007
            • 1584

            #6
            [PHP]<?php
            if (function_exist s('mysql_connec t')) {
            echo "function available.<br />\n";
            } else {
            echo "function not available.<br />\n";
            }
            ?> [/PHP]

            what is the output that you can get in your end for this script.

            Comment

            • Motoma
              Recognized Expert Specialist
              • Jan 2007
              • 3236

              #7
              You may still need to configure PHP to work with MySQL. PHP.net is a great resource for such information.

              Comment

              • Rahulnewdelhi
                New Member
                • May 2007
                • 7

                #8
                This function is not working and showing result "function not available".



                Originally posted by ajaxrand
                [PHP]<?php
                if (function_exist s('mysql_connec t')) {
                echo "function available.<br />\n";
                } else {
                echo "function not available.<br />\n";
                }
                ?> [/PHP]

                what is the output that you can get in your end for this script.

                Comment

                • ak1dnar
                  Recognized Expert Top Contributor
                  • Jan 2007
                  • 1584

                  #9
                  This probably the configuration on your PHP.ini read this article.
                  Installation on Windows Systems

                  Comment

                  • ufitzi
                    New Member
                    • May 2007
                    • 3

                    #10
                    This post may have something to do with your problem.


                    I'm currently in the same boat as you, both PHP and MYSQL are running, but PHP doesn't seem to be finding the php.ini file, which in turn results in the /ext/ directory (where the php_mysql.dll is located) not being read correctly.

                    If you run the phpinfo() function, you will see a summary of all php environment.
                    My guess is you will find the values you've entered in your php.ini file are NOT the ones being used. The post above seems to indicate a solution, however he was not very specific in the steps taken to resolve this issue. I would like to contact him to determine those steps, but he posted as a guest user. Hopefully someone else has info on the permissions solution he described.Good luck, I will post back here once I've figured this out.
                    bh

                    Comment

                    • Rahulnewdelhi
                      New Member
                      • May 2007
                      • 7

                      #11
                      hey friend finally i found the solution of this problem. i tell you

                      after installation of php and mysql check both r working or not.

                      1. open you php.ini file and find extension=mbstr ing.dll and remove semicolon ";" before this dll.

                      2. Find extension=php_m ysql.dll and again remove semicolon ";" before this dll

                      3. Find extension_dir=" ./" and replace it with extension_dir=c :\php\ext

                      then save and exit from your php.ini file

                      4. right click on your mycomputer icon and click properties

                      (o) Select advance tab

                      (o) Click on environment variable

                      (o) Click on new button from system variable area

                      (o) put PHPRC as variable name and C:\php as variable value and then click several ok

                      (o) Restart you web server and run php file contained phpinfo(); function and you will see mysql configration table











                      Originally posted by ufitzi
                      This post may have something to do with your problem.


                      I'm currently in the same boat as you, both PHP and MYSQL are running, but PHP doesn't seem to be finding the php.ini file, which in turn results in the /ext/ directory (where the php_mysql.dll is located) not being read correctly.

                      If you run the phpinfo() function, you will see a summary of all php environment.
                      My guess is you will find the values you've entered in your php.ini file are NOT the ones being used. The post above seems to indicate a solution, however he was not very specific in the steps taken to resolve this issue. I would like to contact him to determine those steps, but he posted as a guest user. Hopefully someone else has info on the permissions solution he described.Good luck, I will post back here once I've figured this out.
                      bh

                      Comment

                      • Rahulnewdelhi
                        New Member
                        • May 2007
                        • 7

                        #12
                        hey friend finally i found the solution of this problem. i tell you

                        after installation of php and mysql check both r working or not.

                        1. open you php.ini file and find extension=mbstr ing.dll and remove semicolon ";" before this dll.

                        2. Find extension=php_m ysql.dll and again remove semicolon ";" before this dll

                        3. Find extension_dir=" ./" and replace it with extension_dir=c :\php\ext

                        then save and exit from your php.ini file

                        4. right click on your mycomputer icon and click properties

                        (o) Select advance tab

                        (o) Click on environment variable

                        (o) Click on new button from system variable area

                        (o) put PHPRC as variable name and C:\php as variable value and then click several ok

                        (o) Restart you web server and run php file contained phpinfo(); function and you will see mysql configration table





                        Originally posted by Rahulnewdelhi
                        hello all

                        Hello all

                        I installed php, mysql and IIS in xp. Problem is this while i run following file

                        PHP Code:
                        ----------------

                        <?php
                        phpinfo();
                        ?>

                        it doesnt show mysql info table in result. I seen mysql server it is running well. While i am trying to connect

                        my php file to mysql database then it doesnt connect. why it is happening? how to short out this problem,

                        please help me

                        regards

                        Comment

                        • pbmods
                          Recognized Expert Expert
                          • Apr 2007
                          • 5821

                          #13
                          Merged duplicate threads.

                          Changed thread title to remove annoying 'help me'.

                          Comment

                          Working...