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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mkdir is failing when script is called by apache, but not from shell??

Status
Not open for further replies.

boytheo

Programmer
May 31, 2007
3
GB
Hi people,

I'm trying to get a script to create a few directories on a webserver, and unzip a file or two.

my script works fine locally, when accessed via shell.

When accessd via apache, it fails :(

What to do?

Here's my code:

mkdir($School, 0755);
chdir($School) || die( "Cannot chdir (1)" );

the $School directory does not exist! It was not made :( I checked the files on my hard disk, it was never created. But it WAS Created if I run the script locally.

What must I do?

BTW, the server I'mg oing to install on, I'm not sure how much privileges I'll be allowed on it. My client will help me all they can, as they aren't beaureaucratic, but it is a commercial web server and not based on my home computer, so I have less control over it.
 
Sounds like whatever user apache is running as doesn't have permission to create directories where you're trying to create them.
 
OK thanks.

How do I give apache the ability to create files and directories there, then?

I guess thats an apache problem?

BUt it's running through a perl script so wouldn't it be a perl problem?
 
try like this:

mkdir($School, 0755) or die "$!":

And see what error gets returnd

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top