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!

quick question about .pl files

Status
Not open for further replies.

danxavier

Technical User
Feb 1, 2006
7
US
I downloaded and edited a .pl file with notepad from my website, then reloaded back up to my server. Now it's not recognized. I made one grammar change that had nothing to do with the code. Can I edit .pl files with notepad? Any ideas? Thanks
 
you can make changes to pl files with notepad.

I think the problem is with file permissions. Often, Web servers are Linux based, which means that the file will need to be marked as executable.

The command to do this is [tt]chmod a+x file.pl[/tt], but to execute that on a file on your Web server you'll have to ask your service provider. You might be able to use the chmod FTP command, but I don't know if the syntax is the same.

If you're using a graphical FTP client, try right-clicking on the file. Maybe there's a menu option to change permissions.

--
-- Ghodmode
 
not recognized? What does that mean? Are you getting some sort of error?

You can edit with notepad, in fact it's good for that since it can only save in txt format, which is what perl scripts have to be saved in. You must upload the file in ASCII (txt) format as well and set the permission if need be. You can use your FTP client for that, see the help files for chmod.
 
The .pl was working just fine and all the permissions were set. All I did was download the file, open it with notepad, close it and reload back up to the net using ws_ftp. Now I get this error message:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@collegeflying.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/1.3.33 Server at Port 80
 
did you upload the file in ASCII (or text) format? Did you reset the permissions? Before you said you made a grammar change, whatever that might be, now you say you made no changes?
 
Thanks for the help. I downloaded the file because I thought there was a spelling error in the text. I made the change, looked at it for a second, and then realized the original word was better. The file was downloaded in Ascii. When I saved in in notepad, it added a .txt after the .pl I loaded the file back up in Ascii, then removed the .txt I went back to my browser, click the link, and got the error message. Do I have to reset permissions every time I make a change? BTW the site is
Thanks, I'm pulling my hair because I spent about 8 hours setting up the file. Dan
 
Did you check the server's error_log, normally /var/log/httpd/error_log

If you can give the exact error, it would help

The site appears to be offline, for me at any rate, or timing out.

--Paul

Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Hi Paul, I feel your pain. Think you might be on to something here. I checked the error log and got the following

[2006-02-01 20:54:17]: error: file has no execute permission: (/home2/flying/public_html/auction/auction.pl)

Even though the directory where the file resides was set to chmod 777, does the the actual auction.pl file need new permission written everytime its modified? BTW, this is a script for an auction program that we are going to use to raise money to fly sick and poor kids from Northern Santa Barbara county down to UCLA. for treatment A gal from England help me set up the script and it was actually running, until I downloaded the .pl file. Funny enough, I can fly a Cessna but I can't figure this out.
 
Hi Paul,
Looks like I figured it out!!! Everytime the .pl is edited and reloaded, I have to reenter the cpanel and reset 777 permission to the actual file. Do you think there's a way around this? Dan
 
you can put quotes around the file name when saving it in notepad (you may have to use "save as" instead of "save"):

"auction.pl"

and notepad will not add the .txt extension, hopefully this will allow you to not have to reset the permissions after uplaoding the file.
 
Using quotes around the file name will save you from having to rename the file, but it won't help with the permissions problem.

The permissions a file has when [tt]put[/tt] on an FTP server are set at the server side. The extension won't affect it.

I believe it's considered a security feature.

There are some FTP servers which allow you to set the umask of the files before you upload files, but I don't think that's a standard feature. I think you will have to set the permissions each time.

Google is my friend:
[URL unfurl="true"]http://www.zzee.com/solutions/unix-permissions.shtml#zzee_link_11_1077830297[/url]
[URL unfurl="true"]http://www.stadtaus.com/en/tutorials/chmod-ftp-file-permissions.php#ws[/url]
And, straight from the horse's mouth, so to speak: [URL unfurl="true"]http://support.ipswitch.com/kb/WS-19980825-JB01.htm[/url]

If you're a little more adventurous, you could try an FTP script.

[tt]ftp_script.txt:[/tt]
Code:
user username password
cd path\to\file
put auction.pl
chmod 755 auction.pl
bye

ref: technet2.microsoft.com
Code:
ftp -n -s:ftp_script.txt

--
-- Ghodmode
 
What do you use for FTP, I like WinSCP, if your host supports it, and it (for me at least) maintains permissions, and handles upload/edit straight through a norton commander style interface

Right Click/Edit - In the editor->Save, pushes resultant file back to server, couldn't live without it

for more info
works as well, but WinSCP has SSH support which makes life easier (I can disable FTP :))

HTH
--Paul

Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Using quotes around the file name will save you from having to rename the file, but it won't help with the permissions problem.

I can in an indirect way. When you upload a file with the same name, it can still keep the file attributes of the original file it's overwriting, such as the permissions. When you upload a new file, it will be given default attributes, such as read/write permission only. Some servers will keep the original file attributes and some won't. So only trying will tell.
 
The basepath within the script referred to another directory where the data was stored. The separate directory had to be set chmod 777.
 
Another reason why a Notepad-edited Perl program might not run on a Linux machine is because Notepad uses only Windows line-endings (CR and LF) which screws up the interpreter identifier on the first line. FTP clients often "correct" text-file line-endings, but not always.

I can't understand why anybody technical would use Notepad, when there are so many much-better free text editors out there.
 
DanX said:
The separate directory had to be set chmod 777.
Why pray tell 777, you could set the ownership to that of the perluser, and cut back a bit on those permissions.

I know 777 is a lucky number, I just hate to see it as a permissions mask :'(

J/K, but I hate to see 777 as a permissions mask, no seriously, I do ;-)

--Paul

Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top