Results 1 to 8 of 8
  1. #1
    Join Date
    May 2007
    Posts
    16

    mysql_connect produces HTTP Error 500.0. So what would you do

    I have narrowed down my problem to the mysql_connect call I am doing in php. It produces an error message. What would you suggest I should do to fix the problem with this error:

    Error Summary
    HTTP Error 500.0 - Internal Server Error
    The page cannot be displayed because an internal server error has occurred.

    Detailed Error Information
    Module IsapiModule
    Notification ExecuteRequestHandler
    Handler PHP
    Error Code 0x00000000
    Requested URL http://localhost:80/getuser.php?q=3&...53613724031635
    Physical Path C:\inetpub\wwwroot\getuser.php
    Logon Method Anonymous
    Logon User Anonymous

    Most likely causes:
    •IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
    •IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
    •IIS was not able to process configuration for the Web site or application.
    •The authenticated user does not have permission to use this DLL.
    •The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.

    Things you can try:
    •Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.
    •Check the event logs to see if any additional information was logged.
    •Verify the permissions for the DLL.
    •Install the .NET Extensibility feature if the request is mapped to a managed handler.
    •Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.
    Links and More InformationThis error means that there was a problem while processing the request. The request was received by the Web server, but during processing a fatal error occurred, causing the 500 error.
    View more information »

    Microsoft Knowledge Base Articles:

    •294807

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    12,345
    if I was using PHP I'd use the or die construct to display why it crapped out
    eg
    PHP Code:
    $cnn=@mysql_connect(HOST,UID1,PWD1)
     or die(Echo 
    "Failed to open the connection... MySQL said:".mysql_errno().": ".mysql_error());
    $dbr=@mysql_select_db(DBN,$cnn)
     or die(Echo 
    "Failed to open the database... MySQL said:".mysql_errno().": ".mysql_error());
    $sql "Select my,column,list from MyTable order by aColumn;"
    $sqlr=@mysql_query($sql,$cnn)
     or die(Echo 
    "Failed to open the recordset... MySQL said:".mysql_errno().": ".mysql_error()); 
    ..as this is culled from another script you'd have to make appropriate changes to the initialisation variables & defines
    and it comes with no warranty.. you many need to tweak the echo statement's punctuation.

    still theres always the php manual to help out
    Is taking part in the 'Distinguished Gentlemans' ride. Being neither distinguished nor a gentleman, but I am keen to raise funds for Prostrate Cancer research. At present I'm threatening to ride a Norton 961 wearing a kilt. If you would like to contribute to Prostrate Cancer research then please consider donating via this page:-
    http://www.gentlemansride.com/rider/healdem

  3. #3
    Join Date
    May 2007
    Posts
    16
    I tried the die command.
    The code bombs immediately such that not even the die command is executed.

    PHP Code:
    $con mysql_connect('localhost''testuser''testpassword') or die("Could not connect"); 
    This code produces a page I have put here:
    IIS 7.0 Detailed Error - 500.0 - Internal Server Error

    By the way, so far I know that this is not the issue: "Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account. "
    Last edited by xarzu; 07-15-09 at 06:55.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    12,345
    have you checked you PHP installation, do any non database scripts work
    have you run phpinfo() function.. that shoudl tell you all you need to know about what the PHP installation is pn the server

    as to the detail Ive never used PHP on IIS, always apache so Others maybe able to help you, but I doubt I can
    Is taking part in the 'Distinguished Gentlemans' ride. Being neither distinguished nor a gentleman, but I am keen to raise funds for Prostrate Cancer research. At present I'm threatening to ride a Norton 961 wearing a kilt. If you would like to contribute to Prostrate Cancer research then please consider donating via this page:-
    http://www.gentlemansride.com/rider/healdem

  5. #5
    Join Date
    May 2007
    Posts
    16
    Quote Originally Posted by healdem
    have you checked you PHP installation, do any non database scripts work
    have you run phpinfo() function.. that shoudl tell you all you need to know about what the PHP installation is pn the server

    as to the detail Ive never used PHP on IIS, always apache so Others maybe able to help you, but I doubt I can
    Yes, my PHP seems to be working. I can have a php file with this script:

    <?php phpinfo(); ?>


    Here is the result from this:

    phpinfo()

    I figure the problem must be in the settings that are in the php.ini. But it seems that my php.ini is set up for MySQL although it is not mentioned in the output when I query the phpinfo page with this code.

    Is it even possible to have IIS with PHP and MySQL? Maybe IIS is made to only work with ASP and SQL Server
    Last edited by xarzu; 07-15-09 at 22:51.

  6. #6
    Join Date
    Mar 2004
    Posts
    480
    php.ini is set up for MySQL although it is not mentioned in the output when I query the phpinfo page with this code.
    if you do not have a section showing up for mysql, then you do not have it configured correctly.

    your question is specifically to do with php and not mysql, ask a moderator to move the thread to the appropriate forum.

  7. #7
    Join Date
    May 2007
    Posts
    16
    So, MySQL is no longer enabled by default, so the php_mysql.dll DLL must be enabled inside of php.ini. How is this done? I searched php.ini and I did not find php_mysql.dll.

  8. #8
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    12,345
    do you 'have' to use IIS?
    configure IIS php mysql - Google Search

    personally I use Apache as my test server, and installing a test server using XAMPP is a breeze
    Is taking part in the 'Distinguished Gentlemans' ride. Being neither distinguished nor a gentleman, but I am keen to raise funds for Prostrate Cancer research. At present I'm threatening to ride a Norton 961 wearing a kilt. If you would like to contribute to Prostrate Cancer research then please consider donating via this page:-
    http://www.gentlemansride.com/rider/healdem

Posting Permissions

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