Jump to content
sylvest

Permission Denied Error

Recommended Posts

One of my scripts has stopped working. I have the following code in the file /home/****/gc/functions.php:

 

$logfile = "/home/****/logs/tickets.log";

 

function logopen()

{

global $logf,$logfile;

if (isset($logfile) and ($logfile != ""))

{

$logf = fopen($logfile, 'a');

}

}

 

This fails with the following:

 

Error code: 2

Error message: fopen(/home/****/logs/tickets.log) [function.fopen]: failed to open stream: Permission denied

Script name and line number of error: /home/****/gc/functions.php:36

Variable state when error occurred: /home/****/logs/tickets.log

 

The file /home/****/logs/tickets.log exists, and has permissions 644

The directory /home/****/logs has permissions 775

I am not out of disk space.

 

Can anyone suggest why this has stopped working? I have not used it for a couple of months, but it used to work...

 

Thanks - Rowan

Edited by TCH-Bruce
removed user cPanel name - Please don't post that info in an open forum!

Share this post


Link to post
Share on other sites

Check the owner of the file. If you own the file please open a ticket with the help desk and they can help you sort it out.

Share this post


Link to post
Share on other sites

Thanks for your reply. How do I check the owner? As far as I can see there's no facility to do this in the cPanel File Manager, nor does there seem to be a way when I connect via FTP using Windows Explorer..

Thanks - Rowan

Share this post


Link to post
Share on other sites

I can see the owner name in my FTP client (CuteFTP).

B*** Microsoft - why can't they get anything right? :-)

 

I discover that using BeyondCompare (the only FTP client that I've got installed apart from Windows Explorer), I can see an owner property that's set to a number. Most things on my site are set to 32191. The offending file is set to 99.

 

How do I know what these numbers mean?

 

What could have changed the ownership of the file tickets.log from 32191 to 99?

 

How do I change it back again? Although BeyondCompare can show me the owner, it doesn't seem to allow me to change it.

 

Thanks - Rowan

Share this post


Link to post
Share on other sites

I find that I can download the file, delete it from the server and upload it again, and magically its owner changes to 32191. One problem solved (although this is presumably not the best way of doing it...).

 

Rowan

Edited by sylvest

Share this post


Link to post
Share on other sites

Server = 99 and 32191 should be you, although it´s the first time I see numbers instead of your cpanel login name as you as the owner.

Share this post


Link to post
Share on other sites

User 99 is user "nobody" and the best way to correct an ownership issue is to open a ticket with help desk. The techs can easily rectify the situation.

Share this post


Link to post
Share on other sites

Can anyone suggest why this has stopped working? I have not used it for a couple of months, but it used to work...

There was a PHP upgrade a short while back.

Share this post


Link to post
Share on other sites

Thanks all for your help. After that download/delete/upload trick my script is now working again, and I've learnt some things in the process, so I won't bother the help desk on this occasion. Next time though...

 

Thanks again for your help - Rowan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×