If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > mysql_connect produces HTTP Error 500.0. So what would you do

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
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
Reply With Quote
  #2 (permalink)  
Old
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 11,649
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
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
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.
Reply With Quote
  #4 (permalink)  
Old
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 11,649
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
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #5 (permalink)  
Old
Registered User
 
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.
Reply With Quote
  #6 (permalink)  
Old
Registered User
 
Join Date: Mar 2004
Posts: 480
Quote:
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.
Reply With Quote
  #7 (permalink)  
Old
Registered User
 
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.
Reply With Quote
  #8 (permalink)  
Old
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 11,649
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
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On