Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't Connect to MySql Database when running from a webpage

Status
Not open for further replies.

time2play

Programmer
Jul 2, 2002
10
US
I have a script that I have written to try and connect to a very small MySql db. Really all that I am tring to do is insert a record when someone clicks on the submit page. When I run it locally from the command line it works fine but as soon as I try and run it from the webpage I get an internal server error. The user created to insert has Insert rights so I just don't know what is going on.
Any help would be greatly appreciated.
Thanks,
D
 
Are you sure the MySQL connection code is what is killing the script? ______________________________________________________________________
My God! It's full of stars!
______________________________________________________________________
 
I am pretty sure it is not the code because it runs from the command line and successfully inserts a record. It has something to do with coming from the outside and trying to update the DB. I have tried everything. I have even tried soming in as root and still nothing. I can't tell if something is corrupted or what. Does this ring and bells?
Thanks for the response,
D
 
You didn't answer the question.

Have you taken all the steps necessary to know for a fact that the script is not dying before it ever gets to your db connectivity code?
______________________________________________________________________
My God! It's full of stars!
______________________________________________________________________
 
What kind of server are you running? I had a similar problem, where the code would run from command line but not through the browser. This was on a linux machine running Apache. If this is your set up, check the owner and group of the script you're trying to run, make sure it's executable, and run this bit of code in the command line to make sure all funky spacing is taken out (replace 'file_name.pl' with your file name):

perl -pi -e 's/\r\n?/\n/' file_name.pl

Also, check your error log to narrow in on the problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top