perl+CGI+mysql !!!!!!!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting perl+CGI+mysql !!!!!!!
# 1  
Old 10-27-2008
perl+CGI+mysql !!!!!!!

hi expert,

I am totally new to perl CGI coding. And stop by below issue:

1> i have a script names conn.pl, which can connect to mysql and get the information of table user(id,name)
2> i copied above code into one CGI web page named user.cgi
3> when i view user.cgi in web browser, it toldme 'Can't connect to Mysql server through socket ....'
4> i erase the mysql related code, the page can be displayed correctly with input box and botton as well

I searched on internet, all answer said i did not start my mqsqld service, but actaully it has been started. So here i assume there is some limition between my apache server and mysql server.

Can anybody help me a little. Thanks very much.
# 2  
Old 10-27-2008
There're no depends between mysqld and httpd.

Try to connect to the database using just a mysql client.
mysql -u user -h host -p
# 3  
Old 10-27-2008
It doesnt help much .. can you post code ? it should work .. as far as i know there is no limitation between apache and mysql. Restart the mysql server
see this
Solve: Can’t connect to local MySQL server through socket /tmp/mysql.sock | MySQL | Tech-Recipes
# 4  
Old 10-27-2008
Hi All,

Thanks for you reply.

The real scenario is:
1> i can connect to mysql by client.
2> i can use DBI code to connect mysql database and get information, for example, in my code i can extract table data and write into one file
3> but when i copied avobe code into a cgi-script and try to call the page in web browser, it does not work then

Hope you are clear now. Thanks very much.

Last edited by summer_cherry; 10-28-2008 at 05:22 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

PERL-CGI learning

Hello All, I am actually learning PERL and more interested to learn CGI script too. Can any suggest a forum or weblink which is more helpful for a dummy CGI developer. Thanks (6 Replies)
Discussion started by: posix
6 Replies

2. OS X (Apple)

Perl CGI

I am trying to get my MacBook Pro with 10.8 Mt Lion set up to run Perl CGI scripts. Having a problem. I can start Apache Web Server with no problems. Why do I put the static and dynamic scripts? I which directory? I have looked at this article:... (3 Replies)
Discussion started by: djehresmann
3 Replies

3. Shell Programming and Scripting

CGI Perl : while loop in CGI perl

Hi Team, I am trying to connect to database(succeeded ) and print the records on the browser using while loop. But the elements of array are not displayed instead while loop is displayed directly. Instead of the below I can embed html statements in print but I am looking for the below style as I... (1 Reply)
Discussion started by: scriptscript
1 Replies

4. Shell Programming and Scripting

Perl CGI : unable to download the excel sheet from perl cgi page

Hi All, I have written an cgi perl script that displays an image(Excel image) and when clicked on that Image I need to download a excel sheet. I made sure that excel sheet exists in the folder with the given name but still I am not able to download the sheet. print "<center><table... (2 Replies)
Discussion started by: scriptscript
2 Replies

5. Shell Programming and Scripting

Perl cgi pages out of cgi-bin folder in WINDOWS

Hi team, I have a typical problem with cgi pages in apache webserver in WINDOWS I am able to execute(display) the pages that are saved in cgi-bin folder. But I am not able to execute the pages stored in htdocs or other folder other than cgi-bin folder. Could anyone please let me know how... (1 Reply)
Discussion started by: scriptscript
1 Replies

6. Shell Programming and Scripting

CGI in Perl

Hi, Am unfamiliar with using CGI modules in Perl. Though i checked in few sites about CGI , i dint get a clear idea. Can anyone please explain me the purpose of these statements, it ll be very helpful to me #!/usr/bin/perl use CGI qw/:standard/; use Storable; use Data::Dumper; my... (1 Reply)
Discussion started by: irudayaraj
1 Replies

7. Web Development

problem with exporting vairable from one perl cgi to another perl cgi script while redirecting.

Can anyone tell me how to export a variable from one perl CGI script to another perl cgi script when using a redirect. Upon running the login.pl the user is prompted to enter user name and password. Upon entering the correct credentials (admin/admin) the user is redirected to welcome page. My... (3 Replies)
Discussion started by: Arun_Linux
3 Replies

8. Programming

Perl CGI Scripts

I need to create a webserver to run Perl CGI Scripts. Anyone have any ideas or good links? Yes I know there are lovely programs out there, but I need to build one in C. Thanks! (1 Reply)
Discussion started by: cb.mark
1 Replies

9. UNIX for Dummies Questions & Answers

Apache Perl/CGI

Can any body help me with apache and cgi i'dont know how iconfigure apache to use cgi... and when i try to start apachectl it says there is no file... please help me...i have apache installed... (1 Reply)
Discussion started by: CreamHarry
1 Replies

10. Shell Programming and Scripting

Perl CGI.pm

my box is FreeBSD4.3 and I use Perl 5.0005_03. Here is the CGI script. test.cgi ...... if ($query->action eq 'detail') { ...... print $query->hidden('action', 'modify'); ...... } I found that the result of test.cgi?action=detail is not what I expected. the script does not... (4 Replies)
Discussion started by: tonyt
4 Replies
Login or Register to Ask a Question