Gossamer Forum
Home : General : Internet Technologies :

using mySQL local

(Page 1 of 2)
> >
Quote Reply
using mySQL local
I have Perl installed on my computer now and I'm using it through Perl-Idea, a program designed for testing perl scripts.

But I now have a perl script using mySQL I want to test and I don't have any server which supports it(anybody know of any free? I might buy else..).
How should I do it with mySQL.
I surely must install it, but then what? How can I test a form script on my computer with it. With Perl-Idea, I just test the script file and gets the errors in a small window. But how do I use forms and such with all this?

Thanks for any reply!

- perlman
Quote Reply
Re: [perlman] using mySQL local In reply to
Quote:
But I now have a perl script using mySQL I want to test and I don't have any server which supports it(anybody know of any free? I might buy else..).

Any free what?

The majority of servers support mysql Crazy
Quote Reply
Re: [perlman] using mySQL local In reply to
Hi perlman, your best bet is to go to www.mysql.com and grab yourself a free copy, it's available for most OS's...

Once installed, it will run in the background as a daemon and handle your scripts SQL queries....


moog
-- I've spent most of my money on beer and women... the rest I just wasted.
Quote Reply
Re: [moog] using mySQL local In reply to
But how should I run the script? Can I just run it with explorer without entering the internet? Lets say I have a blog or a guestbook. I fill in the form in a html page on my computer. The action is set to a cgi script which stores the info in a database. But how can I test this? You'll say in will run in the background. But how can I run the script at all?
I'm a bit confused right now.

And Paul, the thing I was wondering about was if you knew any company which offered a hosting service with free use of mySQL and cgi.
Quote Reply
Re: [perlman] using mySQL local In reply to
Load the script in your browser like you would any other page.

Install apache from activestate.com and mysql from mysql.com, then install the DBI and DBD::mysql drivers. Then you just need to go to cpan.org and read the DBI documentation for info on how to connect to your database.
Quote Reply
Re: [Paul] using mySQL local In reply to
Think I got it straight now. Downloaded the two drivers. Have them installed inside the perl/lib folder.
The perl/apache was installed long time ago, and I got mySQL on the same disc as perl.
But now what? how can I see the scripts. Can I go into a html file with a form to a perl script somewhere else on my computer and fill in the form and get the results stored on a database on my machine? Huh?
Still confused..

Thanks.

- perlman
Quote Reply
Re: [perlman] using mySQL local In reply to
Quote:
how can I see the scripts.

From your browser like I suggested.

Quote:
Can I go into a html file with a form to a perl script somewhere else on my computer and fill in the form and get the results stored on a database on my machine? Huh?

Well you need to have a perl script written first, or find a ready made one. If you are writing your own go to cpan.org like I also suggested. If not read the instructions that came with the script you downloaded.
Quote Reply
Re: [Paul] using mySQL local In reply to
Just to back-track a bit.... perlman, open your web browser and goto http://127.0.0.1/ or http://localhost/ What do you get?

Are you browsing your local site as a http server response or as a local file?


moog
-- I've spent most of my money on beer and women... the rest I just wasted.
Quote Reply
Re: [moog] using mySQL local In reply to
Okey, I tried both addresses, but the page cannot be found. When I have tried to run a cgi script I have opened explorer and typed the address: C:\My Documents\myfile.cgi or something.
But it only shows the code.
What's wrong?

Thanks.

- Perlman
Quote Reply
Re: [perlman] using mySQL local In reply to
First things first... before you go any further with .cgi and SQL you need to get your http server up and running...

As paul mentioned earlier you will need to install apache from activestate.com, the fact that you can't get your localhost is a sure sign that apache is either not installed or not configured properly...


moog
-- I've spent most of my money on beer and women... the rest I just wasted.
Quote Reply
Re: [moog] using mySQL local In reply to
I got Apache installed. The on from Activestate. But Apache is placed in a folder called "Apache" (what a shock!) at my C:\ disc. I have both Perl and mySQL placed at my E:\ disc by their name in folders.
I'm not sure if Apache is running, but I can test Perl scripts! Do it often! I don't think I have set something after I installed Apache. I just installed it! Crazy Never really understood the meaning of all this.

Thanks.

- perlman
Quote Reply
Re: [perlman] using mySQL local In reply to
I take it you have read the documentation here:

http://httpd.apache.org/docs/


moog
-- I've spent most of my money on beer and women... the rest I just wasted.
Quote Reply
Re: [moog] using mySQL local In reply to
How you seen how much it is to read! All those typical docs are really annoying. Don't understand a thing. And it's really confusing for a guy with no idea of such things:

Quote:
To create the file, type:

htpasswd -c /usr/local/apache/passwd/passwords username
htpasswd will ask you for the password, and then ask you to type it again to confirm it:

# htpasswd -c /usr/local/apache/passwd/passwords rbowen
New password: mypassword
Re-type new password: mypassword
Adding password for user rbowen

Type where!!! In every single doc it says.
Quote:
Go to the folder and type "create file.pl".

Yeah...that made much sense to me! (this part was really ironic and I hope you understood that..)

All this is beyond my skills. And far above my head.

Thanks for taking time.

- perlman
Quote Reply
Re: [perlman] using mySQL local In reply to
Quote:
All this is beyond my skills. And far above my head.

Perhaps that is a good reason to start slowly by reading the documentation instead of trying to jump in deep by setting up a web and sql server without fully understanding how to do it.

Last edited by:

Paul: May 29, 2003, 8:45 AM
Quote Reply
Re: [Paul] using mySQL local In reply to
But it would be really nice if someone explained how to do it, step-by-step. Maybe I might have understand it too. And others with the same problem would just follow the same list and get it done in no time. Just a thought.
Quote Reply
Re: [perlman] using mySQL local In reply to
But if it's above your level of knowledge will a step by step guide help?

The online documentation provided by apache and mysql are pretty much step by step guides.

MySQL for windows comes with a /docs/ directory containing 2MB worth of docs, all with clear headings on an index page, such as "Installing MySQL". It's extremely informative, you should consider reading it.
Quote Reply
Re: [Paul] using mySQL local In reply to
I'll try to read it through and ask on the way down the page when I come into difficulties.
I just started on the Install part and found something that confused me:

Quote:
2.1.2.1 Installing the Binaries
If you are working on an NT/2000/XP server, logon as a user with administrator privileges.
If you are doing an upgrade of an earlier MySQL installation, it is necessary to stop the server. If you are running the server as a service, use:
C:\> NET STOP MySQL

Otherwise, use:
C:\mysql\bin> mysqladmin -u root shutdown

On NT/2000/XP machines, if you want to change the server executable (e.g., -max or -nt), it is also necessary to remove the service:
C:\mysql\bin> mysqld --remove

Unzip the distribution file to a temporary directory.
Run the `setup.exe' file to begin the installation process. If you want to install into another directory than the default `c:\mysql', use the Browse button to specify your preferred directory.
Finish the install process.

Im using Windows XP so I should use this:
Quote:
C:\mysql\bin> mysqld --remove

But where should I write this? It only says "use this"!

- perlman
Quote Reply
Re: [perlman] using mySQL local In reply to
If you already installed mysql using the windows installer then you can ignore that.
Quote Reply
Re: [Paul] using mySQL local In reply to
I think you should spend the weekend getting apache up and running.. as you will find, once you have a basic install, there is a plethora of mods you can tailor....

Break your study into bite size chunks...

1, install and understand apache...
2, integrate your perl executable into your apache config...
3, install, integrate and understand mySQL....

Forget about perl and SQL just for this weekend, your first stepping stone is to get a browser response to http://localhost/


moog
-- I've spent most of my money on beer and women... the rest I just wasted.
Quote Reply
Re: [perlman] using mySQL local In reply to
Have you tried NuSphere? It has PHP/Perl/MySQL/Apache etc. I use it on my PC locally.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [moog] using mySQL local In reply to
I read the installation part of the apache docs and tried to do what it said, but I had some difficulties.
I don't know if I have done it all right. Would you recommend me to uninstall the whole package(Apache) and try to install it over again?
Maybe with the program Andy was talking about.

The things I changed was the name of three conf files. It said I should do so. And I look at the files, but I didn't know what to change inside them. Like the port numer, root of the document tree(?).

Ain't gaining much yet!
Quote Reply
Re: [perlman] using mySQL local In reply to
Since you are on Windows XP (any Windows OS, you can do the following):

1) Go to ADD/REMOVE PROGRAMS in your CONTROL PANEL.

2) Remove the Apache HTTP Server program.

3) Then follow the advice in the following paragraph from the Apache website:

"If you eventually uninstall Apache, your configuration and log files will not be removed. You will need to delete the installation directory tree ("C:\Program Files\Apache Group" by default) yourself if you do not care to keep your configuration and other web files. Since the httpd.conf file is your accumulated effort in using Apache, you need to take the effort to remove it. The same happens for all other files you may have created, as well as any log files Apache created."

- http://httpd.apache.org/docs/windows.html#inst
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Stealth] using mySQL local In reply to
YES! It worked! I uninstalled Apache and installed it again. Read the manual fast and understood some of it. I started Apache and it ran. Tested both http://localhost/ and http://127.0.0.1/.
I got the really nice congratulation message!!

Okey, now what? I'm slightly confused about what to do with the activeperl package. Maybe I should reinstall the whole thing and hope it all ends well with that too?

Or? I think actually Perl is working. I don't know. How should I test it?

Thanks for all help so far!
(One step closer to happieness, moog!)

- perlman
Quote Reply
Re: [perlman] using mySQL local In reply to
To test that you have installed Perl correctly, try running one of your Perl scripts (.pl or .cgi) through your web browser. If it doesn't execute, follow these instructions:

Quote:
Open your command prompt window (C:\WINDOWS\COMMAND.COM), type perl -v and hit Return. You should get a message saying This is Perl..., etc..
Create the following script in a text editor like Textpad or Notepad (see Editing the Script):
#!/usr/bin/perl -w
print "Hello world, it works!\n";

Save it somewhere, like c:\tmp\test.pl. Now open the command prompt window and type:

perl c:\tmp\test.pl
Hit the Return key. The message Hello world, it works! should be printed on your screen.

Reference: http://visca.com/...rl_apache_win9x.html

Other good references can be found via searching Google:

http://www.google.com/...rl+Apache+Windows+XP

Good luck!
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Stealth] using mySQL local In reply to
I got it working and tried out several scripts. All went well. Also got some test checking done and it helped me a lot. But still I got a question:

How can I test a form script? Actually fill out the form and such? I can't do this with the cmd window?


And one more thing:

I added Apache and when I went to localhost I got this congratulation message. But now that message turns up in every single banner. All the commercials are being replaced with the congratulation page! It's really anoying. What should I do!

Yours sincerely
- perlmen
> >