...

problem with Apache and open

CJE
10-08-2002, 08:35 PM
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?

sir pannels
10-09-2002, 10:28 AM
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

CJE
10-09-2002, 11:05 PM
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

bcarl314
10-10-2002, 11:59 AM
Also, it should be noted that in Unix a path has forward slashes and on Windows it's back slashes. So where you have


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


you may need

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

CJE
10-15-2002, 12:18 AM
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?

sir pannels
10-15-2002, 08:11 PM
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

CJE
10-17-2002, 01:50 PM
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";



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum