View Full Version : Always time to learn...
auteur
01-28-1999, 04:43 PM
which is what I'm doing... http://www.aota.net/ubb/smile.gif
I'm looking at a cgi tutorial [are you running scared yet... http://www.aota.net/ubb/smile.gif ] and I am writing a very, very simple script [so the tutorial sayth ] for hello world. I uploaded the .pl file in ASCII form. http://www.aota.net/ubb/smile.gif but it says to type ./hello.pl or hello.pl to set the permissions and I get a "no such file or directory" or "command not found" ... it says "if you get sufficiently annoyed by this, ask the system administrator to tell you how to modify your command path by editing the startup files in your home directory" I am sufficiently annoyed... http://www.aota.net/ubb/smile.gif Andrew, H-E-L-P! http://www.aota.net/ubb/smile.gif er..please and thank you...
------------------
Elizabeth M. Miller
Getting You the Attention You Deserve!
www.123marketing.com (http://www.123marketing.com)
hearts
01-28-1999, 04:49 PM
www.cgi101.com/class/ch1/ (http://www.cgi101.com/class/ch1/)
that should help get you started partner!
----
hearts
feeling confident.. and accomplished today! http://www.aota.net/ubb/wink.gif
---
okay.. so i am distracted.. kept sending ya the wrong URL... hehehe
[This message has been edited by hearts (edited 01-28-99).]
[This message has been edited by hearts (edited 01-28-99).]
*trying to remember proper wording*
When you log in via telnet and go to run a script, the server looks in an environment variable to determine what paths it should look in for the script you want to run. Unfortunately sometimes '.' is not included in that variable. (BTW . is the same as the dir you are currently in) Because of that, you may find you have to be in a different dir to actually run the script.
Also, I'm assuming the program you wrote is in Perl, going by your post elsewhere http://www.aota.net/ubb/smile.gif Instead of typing
$hello.pl
at the command line, try typing
$perl hello.pl
while in the same dir that hello.pl is in (should be your cgi-bin dir). That'll help the server know for sure to run it under Perl, instead of your normal shell (that should help eliminate the 'command not found' error).
Hope this helps. If not, yell at me and I'll try again http://www.aota.net/ubb/smile.gif
Oh yeah, make sure you chmod the script 755 http://www.aota.net/ubb/wink.gif
------------------
Del
www.downinit.com (http://www.downinit.com)
da da da
[This message has been edited by Del (edited 01-28-99).]
auteur
01-28-1999, 05:14 PM
Del: What do you mean by *trying to remember proper wording*
I'm very, Very, VERY NEW to this...I don't want to mix words... http://www.aota.net/ubb/smile.gif
Oh and yes, this is in Perl... http://www.aota.net/ubb/smile.gif
------------------
Elizabeth M. Miller
Getting You the Attention You Deserve!
www.123marketing.com (http://www.123marketing.com)
[This message has been edited by auteur (edited 01-28-99).]
Sorry, didn't mean to be confusing (although I've been told I'm real good at it).
What I meant was that I was trying to remember proper wording of describing the $env that looks for the path which does not included '.' As far as the wording of the 'type $perl hello.pl', that's right :-)
You can also type 'perl -cw hello.pl' at the command line to get the debugger to run. If there's an error, the -c flag will tell you what it is. The -w flag will give you warnings, eg '$bob is used only once' kind of thing. Can be pretty handy sometimes.
Also, when I say 'type $blah something etc...', don't actually type the '$'. That is to indicate that you are currently at your command shell prompt (when you're sitting at telnet after logging on it should look something like this;
[user@taz.futurequest.net /path/to/dir] $ <type here>
)
Yell again if I made it worse. Or ask Deb if you can borrow her little 'del slapper' thingus she has.
------------------
Del
www.downinit.com (http://www.downinit.com)
da da da
hearts
01-28-1999, 05:27 PM
DEL...............
do you have to keep that .pl extention on that file? just curious.. why? cuz I took it off a script and it runs perfectly fine.. do i need to put it back?
and if you telnet in to edit a cgi script.. perl.. how do you set the permisssions?
auteur
01-28-1999, 05:38 PM
Okay if I start annoying you let me know...
From the beginning here's what I did.... http://www.aota.net/ubb/smile.gif
I downloaded the SecureCRT as suggested by FutureQuest Manual .. see I'm reading it http://www.aota.net/ubb/smile.gif
Then ...following the directions of this tutorial... I opened my text editor [notepad]
and typed
#!/usr/local/bin/perl
print "Hello, world!";
Then uploaded it first to the cgi-bin dir in ASCII format..
Found out that may be wrong so I re-uploaded it to my 'www' dir
when I type in [skipping $ since it's already there] perl hello.pl
I get a message
"Can't open perl script "hello.pl": No such file or directory"
I realize this is a simple, simple script...I'm following a tutorial and am wanting to learn.. http://www.aota.net/ubb/smile.gif
No way would I have Deb take out that thingy..heehee you're helping... http://www.aota.net/ubb/smile.gif
Thank you, btw. http://www.aota.net/ubb/smile.gif
------------------
Elizabeth M. Miller
Getting You the Attention You Deserve!
www.123marketing.com (http://www.123marketing.com)
Annoying? Nah. Thisis how I started too http://www.aota.net/ubb/smile.gif
First off, you do not have to have the .pl or the .cgi extension as long as the script lives in the cgi-bin directory. (on FQuest anyway, no promises anywhere else). The shebang line is what helps it know it's Perl (shebang line is #!/usr/bin/perl )
All your cgi scripts will go in /big/dom/xdomain/cgi-bin The cgi-bin dir is the only one that has the ability to contain executables by default. When you've learned more, you can put them elsewhere though as well (we'll get into that later tho).
I personally use FTP to upload and chmod, so I don't know the answer offhand to your permissions question. However there is always the manpages. Type '$man chmod' (no single quotes or $ *s*) at your command line. It'll return a page talking about the chmod program. It'll display one page at a time, press the spacebar when your done with one page to move to the next. When you're all done, it should say END at the bottom, and chirp if you try to spacebar again. At that point, press [q] on your keyboard to quit the manpage session and get back to your prompt. I believe the answer is
$chmod 0755 hello.pl
but I'm not totally sure... Sorry.
The 'no file or dir' error is annoying, isn't it? *g* First off, make sure you're in the same directory as the script when you try that. If all else fails, try typing
$perl /big/dom/x123marketing/cgi-bin/hello.pl
That will give it the absolute path the the script, and at least let you know if the script works or not http://www.aota.net/ubb/smile.gif
SecureCRT is indeed a great program. I've got it too, and am quite happy with it.
Happy to help
------------------
Del
www.downinit.com (http://www.downinit.com)
da da da
hearts
01-29-1999, 10:02 AM
ha.. i am so proud.. I did somethig right! *giggle*
as for telnet.. can't ya type the command chmod 755 hello.pl ... but i was wondering.. if you have to type some other command first (other than the usual log in and password http://www.aota.net/ubb/wink.gif
I can set this via FTP Program.. but I was curious how to do this via telnet.
On future quest.. to run a script outside the cgi-bin .. all ya have to do is set up a .htaccess file in that particular directory. Correct? (I was doing a "Keyword search" the other day.. see deb. I used it!!! http://www.aota.net/ubb/wink.gif )
gonna have to learn perl.. cuz I really like this type of programming.
----
Hearts
......living in a whole new world
[This message has been edited by hearts (edited 01-29-99).]
auteur
01-29-1999, 10:53 AM
It worked!! It worked... wooo hoo.... http://www.aota.net/ubb/smile.gif
It's funny though, when I typed in perl /big/dom/x123marketing/cgi-bin/hello.pl it said the 'hello world'
But when I put in the chmod 0755 hello.pl it said no file or directory... hmmm... is this right... ??
Thank you both for your help...maybe this is the start of something wonderful for me... http://www.aota.net/ubb/smile.gif
------------------
Elizabeth M. Miller
Getting You the Attention You Deserve!
www.123marketing.com (http://www.123marketing.com)
Jacob Stetser
01-29-1999, 11:23 AM
perl ./hello.pl should work as well. the ./ means "current directory" in geekspeak.
and, say you want to move up a directory?
../ means "go up a directory" in geekspeak.
../../ "go up two directories"
../../../ "I'm going overboard, but hey, I want to go up three"
and of course
/ "root, baybee" <- in the context of a web server, / means to root folder of your domain.
in the context of Linux, perl, etc, / means the root of the Linux machine, e.g., Terra's playground.
auteur
01-29-1999, 11:29 AM
Jacob... I'm now confused in dot dot dash heaven...heeheehee....
I'll leave this playground to Terra...I think I'll hang out on the swingset for awhile before heading over to the monkey bars...heeheehee... http://www.aota.net/ubb/smile.gif
------------------
Elizabeth M. Miller
Getting You the Attention You Deserve!
www.123marketing.com (http://www.123marketing.com)
Justin
01-29-1999, 05:30 PM
Terra set it up to automatically chmod anything that resembles a script (e.g. *.pl, *.cgi) to 755. That's one reason to leave the extention alone. Fron reading the Apache manual, the extention doesn't have to be there though, as long as it's in the cgi-bin.
If you got a no such file or directory that's because you probably weren't in the same directory as the file.
I'm trying to figure out how to chmod files locally on Apache - I wonder if I can FTP in to localhost... FTP to my own hard drive...
I haven't had a need to yet, but it sure would be nice to figure it out. But anyway, I always prefer FTP for my work on my site. It's similar to working between two directories on my computer, so it's easier that way. Now that I've mirrored the FQ structure locally, it's even easier. If it works locally, it will work on the real server too.
But as far as extentions and permissions, I find it easier to leave them as *.pl and let the server do the permissions - this only works here, though, but when you edit a script, upload it, test it, edit it some more, etc., that one less step makes it a whole lot easier.
Justin
auteur
01-30-1999, 12:48 AM
I've just made my simple perl script into cgi ...
I feel like the first grader learning the ABCs and 123s...heeheehee
http://www.123marketing.com/cgi-bin/first.cgi
------------------
Elizabeth M. Miller
Getting You the Attention You Deserve!
www.123marketing.com (http://www.123marketing.com)
auteur
01-31-1999, 09:01 AM
Okay,
I'm giving my newly learned skill a trial run. http://www.aota.net/ubb/smile.gif
I installed a link updated list that has a lot cgis ... maybe too much too soon...but,
I followed every instruction carefully except used 755 instead of 777 when it asked...
I get an "internal error" does that mean that because it states to use 777 and we use 755 that I can't use it?
The first cgi I'm to go to is located here... http://www.123marketing.com/cgi-bin/admin.cgi
I ran it in the telnet and it said
Illegal character \015 (carriage return) at /big/dom/x123marketing/cgi-bin/admin.cgi line 2.
(Maybe you didn't strip carriage returns after a network transfer?)
I went to line 15 and don't know what it's talking about... please advise... and if this doesn't work, I'll just bug hearts to do all my cgis for me... http://www.aota.net/ubb/smile.gif
Thank you...
Illegal character \015 (carriage return) at
/big/dom/x123marketing/cgi-bin/admin.cgi line 2. (Maybe you didn't strip carriage returns after a network transfer?)
That usually means that the script was uploaded in binary, when it's absolutely imperative that you upload perl scripts in ascii http://www.aota.net/ubb/smile.gif
The reason it breaks perl scripts to go in binary is because of the way Windows handles pressing the [enter] key as opposed to Linux. Windows uses two characters, a CR (carriage return) and an LF (line feed). Unix (linux, etc...) only use one character there, a newline character.
Anyway, make sure you always upload your perl scripts in ASCII form, and you shouldn't see that error ever again.
------------------
Del
www.downinit.com (http://www.downinit.com)
da da da
vBulletin® v3.6.8, Copyright ©2000-2012, Jelsoft Enterprises Ltd.