473,396 Members | 1,767 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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\wwwroot

What should I look for?

Kp


Aug 7 '08 #1
8 8228
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_redirect = 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\wwwroot
And there is your script?

Aug 7 '08 #2

"Olaf Schinkel" <tr***@schinkel.tvskrev i melding
news:48***********************@newsspool4.arcor-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_redirect = 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\wwwroot
And there is your script?
Web server is IIs.
No, I didn't have cgi.force_redirect = 0 in php.ini.
So I edit the file php.ini in c:\windows and put cgi.force_redirect = 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\wwwroot

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



Aug 7 '08 #3
Kjell Pettersen wrote:
"Olaf Schinkel" <tr***@schinkel.tvskrev i melding
news:48***********************@newsspool4.arcor-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_redirect = 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\wwwroot
And there is your script?

Web server is IIs.
No, I didn't have cgi.force_redirect = 0 in php.ini.
So I edit the file php.ini in c:\windows and put cgi.force_redirect = 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\wwwroot

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.
js*******@attglobal.net
==================

Aug 7 '08 #4
Kjell Pettersen schrieb:
>
Web server is IIs.
No, I didn't have cgi.force_redirect = 0 in php.ini.
So I edit the file php.ini in c:\windows and put cgi.force_redirect = 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\wwwroot

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\system32\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.
Aug 7 '08 #5

"Jerry Stuckle" <js*******@attglobal.netskrev i melding
news:g7**********@registered.motzarella.org...
Kjell Pettersen wrote:
>"Olaf Schinkel" <tr***@schinkel.tvskrev i melding
news:48***********************@newsspool4.arcor-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_redirect = 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\wwwroot
And there is your script?

Web server is IIs.
No, I didn't have cgi.force_redirect = 0 in php.ini.
So I edit the file php.ini in c:\windows and put cgi.force_redirect = 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\wwwroot

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.
js*******@attglobal.net
==================

Aug 7 '08 #6
Kjell Pettersen wrote:
"Jerry Stuckle" <js*******@attglobal.netskrev i melding
news:g7**********@registered.motzarella.org...
>Kjell Pettersen wrote:
>>"Olaf Schinkel" <tr***@schinkel.tvskrev i melding
news:48***********************@newsspool4.arco r-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_redirect = 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\wwwroot
And there is your script?

Web server is IIs.
No, I didn't have cgi.force_redirect = 0 in php.ini.
So I edit the file php.ini in c:\windows and put cgi.force_redirect = 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\wwwroot

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.
js*******@attglobal.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.
js*******@attglobal.net
==================

Aug 7 '08 #7
I have now tried the Apache web server instead of IIs

But I have the same problem.

Kp
"Kjell Pettersen" <kj***@kjellpettersen.comskrev i melding
news:qc*********************@telenor.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\wwwroot

What should I look for?

Kp




Aug 7 '08 #8
Kjell Pettersen wrote:
I have now tried the Apache web server instead of IIs

But I have the same problem.

Kp
"Kjell Pettersen" <kj***@kjellpettersen.comskrev i melding
news:qc*********************@telenor.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\wwwroot

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.
js*******@attglobal.net
==================

Aug 7 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: LRW | last post by:
I'm working on some scripts someone else made, and it's littered with repetitive mysql_connect's and mysql_select_db's. For example: // MAKE SURE IT IS A VALID PRODUCT $connection2 =...
7
by: Frogman | last post by:
Hi, I am new to php and I'm testing php connectivity to mysql. I created a php script using the php.net sample. The script uses the mysql_connect method and when I execute it I get the error: ...
7
by: Michael Foord | last post by:
#!/usr/bin/python -u # 15-09-04 # v1.0.0 # auth_example.py # A simple script manually demonstrating basic authentication. # Copyright Michael Foord # Free to use, modify and relicense. #...
7
by: avenpace | last post by:
Hi, I got error when using mysql_connect function in my php script. If i set the db host to localhost, it give me that error altough all the user and password that I wrote is true(I can login...
4
by: Robertu | last post by:
Hi alt all $connection = mysql_connect("12.34.5.67.89", "Sql111111","hELLOWORLD"); mysql_select_db("11111111_1") $query = "SELECT from where............... in any of these 3 steeps it can make...
8
by: seni786 | last post by:
Hi i am having problems with some code that i wrote out for a shopping cart. the shopping cart it self works when a product is added but when the 'CART CONTENT' button is clicked on it comes up...
8
by: Sheik Ishmael | last post by:
Hi, I'm trying to get password recognition calling data froma table called users('user_name' and 'user_password' using the below (bottom of page) code. However, I get the following warning...
5
by: clodhoppers18 | last post by:
I am trying to get the following code to work, and I am having some problems: The code goes for actually 110 lines, but I have dismissed what is not needed. The connection and all that works for...
1
by: chienee | last post by:
here is the code <?php session_cache_limiter('private,must-revalidate'); session_start(); require_once("config.php"); include ("classes/db_functions.php"); include ("classes/display.php");
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.