Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    CJE
    CJE is offline
    New to the CF scene
    Join Date
    Oct 2002
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    problem with Apache and open

    Hi I'm trying to amend a script on my local Win98 Machine, it works fine on my site but won't work on my PC.

    The script fails at the following:

    open(NEWFILE,">$baseurl/$mesgdir/$num\.$ext") || die $!;

    The error message says that it can't find the file, yet I thought using the '>' special character would create the file if it was not there.
    I have checked the paths created by the variables and they are correct.

    As I say this works online but if I can't get it to work on my local PC I can't test any changes.

    Any ideas?

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts
    Hey,
    your online host linux/unix based?
    if so you may need to change a few things.
    first check you have the corret win path to perl.. and second... are all those dirs is using there or not?
    try doing it without variables for paths.. create some dirs and type the path normally.. if that works then get back to me... and i`ll see what I can work out.
    good luck
    P

  • #3
    CJE
    CJE is offline
    New to the CF scene
    Join Date
    Oct 2002
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi, thanks for the help.

    My online host is unix based, I think the problem is that the perl script doesn't seem to recognise the
    "http://localhost/" address.
    I installed the Apache server using the phpdev4 package from ww.firebird.com.au and I'm using their standard settings.

    I tried changing the paths to "c:\phpdev\www" and the script did execute but I couldn't fully test it because the links it creates on the web pages then took me out of the localhost environment and into the normal windows, so perl wouldn't run.

    I got the error to return the file path that the variable create in the script where it fails - correct path, if it was recognising the localhost address.

    The error message is as follows

    [Wed Oct 09 22:47:12 2002] [error] [client 127.0.0.1] Premature end of script headers: c:/phpdev/www/cgi-bin/board.pl
    [Wed Oct 09 22:47:12 2002] [error] [client 127.0.0.1] Error creating new file : http://localhost/board/messages/1.html : No such file or directory at c:\PHPDEV\WWW\CGI-BIN\BOARD.PL line 242.

    Any ideas much appreciated

  • #4
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts
    Also, it should be noted that in Unix a path has forward slashes and on Windows it's back slashes. So where you have

    Code:
    open(NEWFILE,">$baseurl/$mesgdir/$num\.$ext") || die $!;
    you may need
    Code:
    open(NEWFILE,">$baseurl\ \$mesgdir\ \$num\ \.$ext") || die $!;
    I hope this posts correctly, this forum eats backslashes, but it's supposed to have 2 backslashes every where you see on forward slash in the original code.

    Hope this helps

  • #5
    CJE
    CJE is offline
    New to the CF scene
    Join Date
    Oct 2002
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm sure my Perl book said that it would automatically interpret the forward slash as a backslash (maybe it's apache that does it) though I have tired changing the file path to double backslashes and I get the same error.

    Has anyone else had problems getting Perl to recognise the localhost address when running an apache server to test scripts?

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts
    oh... may have got mixed up.. are u runing it online or on localhost? or is it the same?

    ps could be LAN settinsg if you on one and using localhost.. are you?
    err WAN`s dont matter tho...
    P

  • #7
    CJE
    CJE is offline
    New to the CF scene
    Join Date
    Oct 2002
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sir P

    I'm trying to write/test it on a 'localhost' environment (using apache running on Win 98).

    If/when I manage to edit the script and get it working I would then be posting it online.

    I orginally got the script from my host but changed the declaration of the constants for the path files to suit the local host environment except it doesn't work.

    the variables are as follows
    # what they were
    #$basedir = "./";
    #$baseurl = "http://$ENV{SERVER_NAME}/board";
    #$cgi_url = "http://$ENV{SERVER_NAME}/cgi-bin/board.pl";

    #what I made them
    $basedir = "./";
    $baseurl = "http://localhost/cgi-bin/board";
    $cgi_url = "http://localhost/cgi-bin/board/board.pl";


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •