HTTP Error 500 when calling mysql_connect from php script

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kjell Pettersen

    HTTP Error 500 when calling mysql_connect from php script

    Hello!

    I have installed PHP and MySql 5.0 on Win XP.
    Database created ok. Installation ok.
    PHP scripts runs ok.
    But when I am trying some mysql calls in the script I get an "Error 500"
    from explorer.

    // Connect to the database server
    echo ('Trying to connect to db');

    $dbcnx = mysql_connect(' localhost', 'root', ''xxxx');

    The php.ini file in c:/windows has extension_dir = "C:\php\ext " and
    extension = php_mysql.dll and
    doc_root: "c:\inetpub\www root

    What should I look for?

    Kp








  • Olaf Schinkel

    #2
    Re: HTTP Error 500 when calling mysql_connect from php script

    Kjell Pettersen schrieb:
    Hello!
    >
    I have installed PHP and MySql 5.0 on Win XP.
    IIs or Apache?
    Database created ok. Installation ok.
    PHP scripts runs ok.
    Ok.
    But have you set:
    cgi.force_redir ect = 0
    in php.ini?
    But when I am trying some mysql calls in the script I get an "Error 500"
    from explorer.
    >
    // Connect to the database server
    echo ('Trying to connect to db');
    >
    $dbcnx = mysql_connect(' localhost', 'root', ''xxxx');
    Do not use root. Create an extra user.
    Give the user the rights to the db and check again.
    >
    The php.ini file in c:/windows has extension_dir = "C:\php\ext " and
    The only php.ini in the system?
    "C:\php\ext " has rights for the webserver?
    extension = php_mysql.dll and
    doc_root: "c:\inetpub\www root
    And there is your script?

    Comment

    • Kjell Pettersen

      #3
      Re: HTTP Error 500 when calling mysql_connect from php script


      "Olaf Schinkel" <trash@schinkel .tvskrev i melding
      news:489aeb59$0 $20708$9b4e6d93 @newsspool4.arc or-online.net...
      Kjell Pettersen schrieb:
      >Hello!
      >>
      >I have installed PHP and MySql 5.0 on Win XP.
      IIs or Apache?
      >
      >Database created ok. Installation ok.
      >PHP scripts runs ok.
      Ok.
      But have you set:
      cgi.force_redir ect = 0
      in php.ini?
      >
      >But when I am trying some mysql calls in the script I get an "Error 500"
      >from explorer.
      >
      >>
      >// Connect to the database server
      >echo ('Trying to connect to db');
      >>
      >$dbcnx = mysql_connect(' localhost', 'root', ''xxxx');
      Do not use root. Create an extra user.
      Give the user the rights to the db and check again.
      >
      >>
      >The php.ini file in c:/windows has extension_dir = "C:\php\ext " and
      The only php.ini in the system?
      "C:\php\ext " has rights for the webserver?
      >
      >extension = php_mysql.dll and
      >doc_root: "c:\inetpub\www root
      And there is your script?
      >
      Web server is IIs.
      No, I didn't have cgi.force_redir ect = 0 in php.ini.
      So I edit the file php.ini in c:\windows and put cgi.force_redir ect = 0 in
      the file.
      Restartet my computer, but I still get the HTTP error 500.

      And I have create a new user in the datebase. Using that name instead of
      root.
      But still the error 500.....

      Yes, my script is in doc_root c:\inetpub\wwwr oot

      There is only one php.ini in the computer.

      How do I set rights for the webserver to the c:\php\ext directory?
      I believed everyone could read files from that directory.

      Isn't there a log file from PHP to study?

      Kp









      Comment

      • Jerry Stuckle

        #4
        Re: HTTP Error 500 when calling mysql_connect from php script

        Kjell Pettersen wrote:
        "Olaf Schinkel" <trash@schinkel .tvskrev i melding
        news:489aeb59$0 $20708$9b4e6d93 @newsspool4.arc or-online.net...
        >Kjell Pettersen schrieb:
        >>Hello!
        >>>
        >>I have installed PHP and MySql 5.0 on Win XP.
        >IIs or Apache?
        >>
        >>Database created ok. Installation ok.
        >>PHP scripts runs ok.
        >Ok.
        >But have you set:
        >cgi.force_redi rect = 0
        >in php.ini?
        >>
        >>But when I am trying some mysql calls in the script I get an "Error 500"
        >>from explorer.
        >>// Connect to the database server
        >>echo ('Trying to connect to db');
        >>>
        >>$dbcnx = mysql_connect(' localhost', 'root', ''xxxx');
        >Do not use root. Create an extra user.
        >Give the user the rights to the db and check again.
        >>
        >>The php.ini file in c:/windows has extension_dir = "C:\php\ext " and
        >The only php.ini in the system?
        >"C:\php\ext " has rights for the webserver?
        >>
        >>extension = php_mysql.dll and
        >>doc_root: "c:\inetpub\www root
        >And there is your script?
        >>
        >
        Web server is IIs.
        No, I didn't have cgi.force_redir ect = 0 in php.ini.
        So I edit the file php.ini in c:\windows and put cgi.force_redir ect = 0 in
        the file.
        Restartet my computer, but I still get the HTTP error 500.
        >
        And I have create a new user in the datebase. Using that name instead of
        root.
        But still the error 500.....
        >
        Yes, my script is in doc_root c:\inetpub\wwwr oot
        >
        There is only one php.ini in the computer.
        >
        How do I set rights for the webserver to the c:\php\ext directory?
        I believed everyone could read files from that directory.
        >
        Isn't there a log file from PHP to study?
        >
        Kp
        >
        The error isn't coming from PHP - it's coming from IIS.

        The fact you're getting phpinfo() OK indicates that PHP itself is
        working. It also means the php extensions listed in the phpinfo() are
        loading. Check to ensure your mysql extension is loading; I suspect it
        is or you would get a "function not found".

        Do you have PHP installed as a CGI or ISAPI?

        Also, do you know if MySQL is working? Can you access it and perform
        operations from the command line?

        Otherwise, it sounds like you might have permission problems - this can
        cause 500 errors. You would want to follow up with a Windows newsgroup
        on the permissions issue.

        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • Olaf Schinkel

          #5
          Re: HTTP Error 500 when calling mysql_connect from php script

          Kjell Pettersen schrieb:
          >
          Web server is IIs.
          No, I didn't have cgi.force_redir ect = 0 in php.ini.
          So I edit the file php.ini in c:\windows and put cgi.force_redir ect = 0 in
          the file.
          Restartet my computer, but I still get the HTTP error 500.
          >
          And I have create a new user in the datebase. Using that name instead of
          root.
          But still the error 500.....
          >
          Yes, my script is in doc_root c:\inetpub\wwwr oot
          >
          There is only one php.ini in the computer.
          >
          How do I set rights for the webserver to the c:\php\ext directory?
          Right Click on Folder -Properties -Security
          I believed everyone could read files from that directory.
          >
          Isn't there a log file from PHP to study?
          Jetzt.
          C:\WINDOWS\syst em32\LogFiles
          You can set the settings for the logfile at
          Standard-Website->Properties->Website

          Error 500 is normaly "Internal Server Error".
          That can be a lot :-( Also right problems.
          Something is wrong with your MySQL installation.
          But so far here, i can´t say much more.

          Comment

          • Kjell Pettersen

            #6
            Re: HTTP Error 500 when calling mysql_connect from php script


            "Jerry Stuckle" <jstucklex@attg lobal.netskrev i melding
            news:g7evch$mdh $1@registered.m otzarella.org.. .
            Kjell Pettersen wrote:
            >"Olaf Schinkel" <trash@schinkel .tvskrev i melding
            >news:489aeb59$ 0$20708$9b4e6d9 3@newsspool4.ar cor-online.net...
            >>Kjell Pettersen schrieb:
            >>>Hello!
            >>>>
            >>>I have installed PHP and MySql 5.0 on Win XP.
            >>IIs or Apache?
            >>>
            >>>Database created ok. Installation ok.
            >>>PHP scripts runs ok.
            >>Ok.
            >>But have you set:
            >>cgi.force_red irect = 0
            >>in php.ini?
            >>>
            >>>But when I am trying some mysql calls in the script I get an "Error
            >>>500" from explorer.
            >>>// Connect to the database server
            >>>echo ('Trying to connect to db');
            >>>>
            >>>$dbcnx = mysql_connect(' localhost', 'root', ''xxxx');
            >>Do not use root. Create an extra user.
            >>Give the user the rights to the db and check again.
            >>>
            >>>The php.ini file in c:/windows has extension_dir = "C:\php\ext " and
            >>The only php.ini in the system?
            >>"C:\php\ext " has rights for the webserver?
            >>>
            >>>extension = php_mysql.dll and
            >>>doc_root: "c:\inetpub\www root
            >>And there is your script?
            >>>
            >>
            >Web server is IIs.
            >No, I didn't have cgi.force_redir ect = 0 in php.ini.
            >So I edit the file php.ini in c:\windows and put cgi.force_redir ect = 0
            >in the file.
            >Restartet my computer, but I still get the HTTP error 500.
            >>
            >And I have create a new user in the datebase. Using that name instead of
            >root.
            >But still the error 500.....
            >>
            >Yes, my script is in doc_root c:\inetpub\wwwr oot
            >>
            >There is only one php.ini in the computer.
            >>
            >How do I set rights for the webserver to the c:\php\ext directory?
            >I believed everyone could read files from that directory.
            >>
            >Isn't there a log file from PHP to study?
            >>
            >Kp
            >>
            >
            The error isn't coming from PHP - it's coming from IIS.
            >
            The fact you're getting phpinfo() OK indicates that PHP itself is working.
            It also means the php extensions listed in the phpinfo() are loading.
            Check to ensure your mysql extension is loading; I suspect it is or you
            would get a "function not found".
            >
            Do you have PHP installed as a CGI or ISAPI?
            It is installed as ISAPI
            >
            Also, do you know if MySQL is working? Can you access it and perform
            operations from the command line?
            Yes, I can connect with mysql from command line, and do a select from the
            db.
            >
            Otherwise, it sounds like you might have permission problems - this can
            cause 500 errors. You would want to follow up with a Windows newsgroup on
            the permissions issue.
            >
            Now, I am a bit lost. The log file does not tell me anything.

            --
            =============== ===
            Remove the "x" from my email address
            Jerry Stuckle
            JDS Computer Training Corp.
            jstucklex@attgl obal.net
            =============== ===
            >

            Comment

            • Jerry Stuckle

              #7
              Re: HTTP Error 500 when calling mysql_connect from php script

              Kjell Pettersen wrote:
              "Jerry Stuckle" <jstucklex@attg lobal.netskrev i melding
              news:g7evch$mdh $1@registered.m otzarella.org.. .
              >Kjell Pettersen wrote:
              >>"Olaf Schinkel" <trash@schinkel .tvskrev i melding
              >>news:489aeb59 $0$20708$9b4e6d 93@newsspool4.a rcor-online.net...
              >>>Kjell Pettersen schrieb:
              >>>>Hello!
              >>>>>
              >>>>I have installed PHP and MySql 5.0 on Win XP.
              >>>IIs or Apache?
              >>>>
              >>>>Database created ok. Installation ok.
              >>>>PHP scripts runs ok.
              >>>Ok.
              >>>But have you set:
              >>>cgi.force_re direct = 0
              >>>in php.ini?
              >>>>
              >>>>But when I am trying some mysql calls in the script I get an "Error
              >>>>500" from explorer.
              >>>>// Connect to the database server
              >>>>echo ('Trying to connect to db');
              >>>>>
              >>>>$dbcnx = mysql_connect(' localhost', 'root', ''xxxx');
              >>>Do not use root. Create an extra user.
              >>>Give the user the rights to the db and check again.
              >>>>
              >>>>The php.ini file in c:/windows has extension_dir = "C:\php\ext " and
              >>>The only php.ini in the system?
              >>>"C:\php\ex t" has rights for the webserver?
              >>>>
              >>>>extension = php_mysql.dll and
              >>>>doc_root: "c:\inetpub\www root
              >>>And there is your script?
              >>>>
              >>Web server is IIs.
              >>No, I didn't have cgi.force_redir ect = 0 in php.ini.
              >>So I edit the file php.ini in c:\windows and put cgi.force_redir ect = 0
              >>in the file.
              >>Restartet my computer, but I still get the HTTP error 500.
              >>>
              >>And I have create a new user in the datebase. Using that name instead of
              >>root.
              >>But still the error 500.....
              >>>
              >>Yes, my script is in doc_root c:\inetpub\wwwr oot
              >>>
              >>There is only one php.ini in the computer.
              >>>
              >>How do I set rights for the webserver to the c:\php\ext directory?
              >>I believed everyone could read files from that directory.
              >>>
              >>Isn't there a log file from PHP to study?
              >>>
              >>Kp
              >>>
              >The error isn't coming from PHP - it's coming from IIS.
              >>
              >The fact you're getting phpinfo() OK indicates that PHP itself is working.
              >It also means the php extensions listed in the phpinfo() are loading.
              >Check to ensure your mysql extension is loading; I suspect it is or you
              >would get a "function not found".
              >>
              >Do you have PHP installed as a CGI or ISAPI?
              It is installed as ISAPI
              >Also, do you know if MySQL is working? Can you access it and perform
              >operations from the command line?
              Yes, I can connect with mysql from command line, and do a select from the
              db.
              >Otherwise, it sounds like you might have permission problems - this can
              >cause 500 errors. You would want to follow up with a Windows newsgroup on
              >the permissions issue.
              >>
              >
              Now, I am a bit lost. The log file does not tell me anything.
              >
              >
              >--
              >============== ====
              >Remove the "x" from my email address
              >Jerry Stuckle
              >JDS Computer Training Corp.
              >jstucklex@attgl obal.net
              >============== ====
              >>
              >
              >
              >
              The PHP log file won't show you anything. The IIS log file may or may
              not - depending on your configuration.

              But you also need to ensure the IIS user has access to the MySQL client
              libraries.

              I really don't think this is a PHP problem - which is why I suggested a
              Windows newsgroup to follow up on why the server is returning a 500 error.

              --
              =============== ===
              Remove the "x" from my email address
              Jerry Stuckle
              JDS Computer Training Corp.
              jstucklex@attgl obal.net
              =============== ===

              Comment

              • Kjell Pettersen

                #8
                Re: HTTP Error 500 when calling mysql_connect from php script

                I have now tried the Apache web server instead of IIs

                But I have the same problem.

                Kp


                "Kjell Pettersen" <kjell@kjellpet tersen.comskrev i melding
                news:qcmdnTX3JY w9eQfV4p2dnAA@t elenor.com...
                Hello!
                >
                I have installed PHP and MySql 5.0 on Win XP.
                Database created ok. Installation ok.
                PHP scripts runs ok.
                But when I am trying some mysql calls in the script I get an "Error 500"
                from explorer.
                >
                // Connect to the database server
                echo ('Trying to connect to db');
                >
                $dbcnx = mysql_connect(' localhost', 'root', ''xxxx');
                >
                The php.ini file in c:/windows has extension_dir = "C:\php\ext " and
                extension = php_mysql.dll and
                doc_root: "c:\inetpub\www root
                >
                What should I look for?
                >
                Kp
                >
                >
                >
                >
                >
                >
                >
                >

                Comment

                • Jerry Stuckle

                  #9
                  Re: HTTP Error 500 when calling mysql_connect from php script

                  Kjell Pettersen wrote:
                  I have now tried the Apache web server instead of IIs
                  >
                  But I have the same problem.
                  >
                  Kp
                  >
                  >
                  "Kjell Pettersen" <kjell@kjellpet tersen.comskrev i melding
                  news:qcmdnTX3JY w9eQfV4p2dnAA@t elenor.com...
                  >Hello!
                  >>
                  >I have installed PHP and MySql 5.0 on Win XP.
                  >Database created ok. Installation ok.
                  >PHP scripts runs ok.
                  >But when I am trying some mysql calls in the script I get an "Error 500"
                  >from explorer.
                  >>
                  >// Connect to the database server
                  >echo ('Trying to connect to db');
                  >>
                  >$dbcnx = mysql_connect(' localhost', 'root', ''xxxx');
                  >>
                  >The php.ini file in c:/windows has extension_dir = "C:\php\ext " and
                  >extension = php_mysql.dll and
                  >doc_root: "c:\inetpub\www root
                  >>
                  >What should I look for?
                  >>
                  >Kp
                  >>
                  >>
                  >>
                  >>
                  >>
                  >>
                  >>
                  >>
                  >
                  >
                  >
                  As I've told you repeatedly. Ask in the correct forum and you'll get
                  good answers.

                  --
                  =============== ===
                  Remove the "x" from my email address
                  Jerry Stuckle
                  JDS Computer Training Corp.
                  jstucklex@attgl obal.net
                  =============== ===

                  Comment

                  Working...