mzfp has asked for the wisdom of the Perl Monks concerning the following question:

The server im hosting my site on told me all scripts need to be in CGI-BIN directory, is this true? because i want to place pl files in other directories, such as my html directories. Also i made a program which allows people to add links to a links.html file, works perfectly on my local apache web server, however when uploadin it doesnt work because the links.html file has permissions set to 644, and even when i change it to public write so the scrip can write to the links.html, the permission is reset to 644?? are htnl files allowed to have public write access? thanks

Replies are listed 'Best First'.
Re: New to CGI, but having problems
by Molt (Chaplain) on Apr 26, 2002 at 12:26 UTC

    Where CGI files can be kept is something which can be configured in the server. If the person who runs the server says they need to be in cgi-bin then trust them, even if they're wrong storing .pl scripts in odd directories can cause some really quite strange things to happen at times.

    There's no limit on HTML files permissions. How were you setting the permission, and did they change afterwards? Not sure if an administrator can somehow stop users setting various file permissions on a security basis, it's been too long since I really hit Unix administration at all.

    One thing to be aware of.. publically writable files are often seen as a security hole. Possibly a better way to do this would be to have a file created by whichever user the script runs as (Generally 'apache' or 'nobody') and have a symlink to this in your HTML directory.

    Good luck with CGI, by the way. It's tricky at first but well worth persevering with.

Re: New to CGI, but having problems
by Cyrnus (Monk) on Apr 26, 2002 at 12:36 UTC
    Another thought on this is does your server allow server side includes? If so then you should be able to write your links to a file in your cgi-bin and include them into links.html. I haven't tested this yet but I don't see why this wouldn't work.
      yep it supposrts SSI's ! thanks i will have to look more into SSI!
Re: New to CGI, but having problems
by asdfgroup (Beadle) on Apr 26, 2002 at 13:19 UTC
    Hi,

    With cgi-bin generally can help following trick :

    place file .htaccess in your directory :

    AddHandler perl-script .pl <Files *.pl> Options +ExecCGI </Files>
    After this you can use your .pl files outside cgi-bin directory

    Try this solution. It should work on many hostings.

    Note: AllowOverride FileInfo must be enabled

      that seems like a devilish solution! .. how do you Allow override, bearing in mind that i am not the adminstrator of the server, and we are not allowed to run system commands!
Re: New to CGI, but having problems
by George_Sherston (Vicar) on Apr 26, 2002 at 15:01 UTC
    You may have more fun if you change your host. Many hosts do restrict where you can put executable files, and lots of other things too. One that doesn't is http://www.uklinux.net who offer a free service among others (and they're good eggs as you can tell from the name) - you'd probably want to be in the UK though. In the US http://www.csoft.net/ are another non-paternalistic, open-source kind of shop, and they do hosting for $5 a month. I've used both, and found them very satisfactory.

    I hasten to add that there are other hosts offering the same freedom, which google will find for you. My point is, you don't have to put up with what you have at present.

    § George Sherston
Re: New to CGI, but having problems
by BUU (Prior) on Apr 26, 2002 at 12:26 UTC
    CGI-BIN: Maybe, it depends on how the webserver is configured. Place a .pl/.cgi script someplace else and go to it, if you get the sourc of the file then you know its not set up to execute there, if you get anything else then you can use scripts there.

    Write Access: Html file can be set to have public read/write, how are you changing your permissions?
      i change it using CHMOD commands on my FTP programs, it allows me to normally change persmission of script files, but the HTML file .. well it changes it, then after a while it goes back to normal!

        If it goes back to normal after a while, without you changing it either intentionally or accidentally, implies that the server admin is running something to stop people having world-writable files. Odd, but I can see the use for either security, or people asking "Why can't I see my .html files in my browser?" when the file's not world-readavle.

        Just as an experiment try and set the permissions to something more restrictive, such as 000. You won't be able to view the file anymore with a browser, but you can see if there is something odd with .html files.