PHP copy() problem, the new file's owner is "nobody"?

markking

Registered
Aug 2, 2008
3
0
51
Hey guys,
Currently I am working on a PHP script that will copy a file

copy (sourceFile, destFile);

But after making the copy, the destFile has owner of "nobody" while the sourceFile still has the correct owner of "myUsername".

At first I thought it was doing this because suPHP was not enabled, or just not working. I have gone back into CPanel WHM and checked that suPHP is enabled, and I also see suPHP is running via

[email protected] # /usr/local/cpanel/bin/rebuild_phpc

which says I am using suPHP

Can anyone lead me into the right direction to get the owner to be the same as making the copy?

Any help would be grateful.

Thanks!
 

Stefaans

Well-Known Member
Mar 5, 2002
461
4
318
Vancouver, Canada
This does indeed seem like SuPHP is not active. If it was, the owner of the copied file would have been the account user, not nobody.

I suggest you have a look (in WHM) at Configure PHP and SuExec and check that SuPHP is indeed selected as the handler for the particular version of PHP.

You can also have a look at the log at /usr/local/apache/logs/suphp_log to verify that SuPHP is indeed being called for this account.
 

markking

Registered
Aug 2, 2008
3
0
51
Thank you for your help.

I tried

tail -f /usr/local/apache/logs/suphp_log

result message
-----------------------------------
tail: cannot open `/usr/local/apache/logs/suphp_log' for reading: No such file or directory
tail: no files remaining



I looked under "Configure PHP and SuExec" and this is what I see

Current Configuration

Option Configured Value
Default PHP Version (.php files) 5
PHP 5 Handler dso
PHP 4 Handler none

Apache suEXEC on



Also, when I run the PHP scripts I see they are being ran as "nobody" I get this information from running "top"


Can you please tell me what I might need to do to get it to work correctly? Thank you!!
 

Stefaans

Well-Known Member
Mar 5, 2002
461
4
318
Vancouver, Canada
Current Configuration

Option Configured Value
Default PHP Version (.php files) 5
PHP 5 Handler dso
PHP 4 Handler none

Apache suEXEC on
The dso setting confirms that you are not using SuPHP. That fact that the suphp_log file does not exist either, reinforces this.

Check if you have the option to set the handler to suphp. If not, you need to rebuild Apache with SuPHP support.

I hope this helps ;)
 

markking

Registered
Aug 2, 2008
3
0
51
The dso setting confirms that you are not using SuPHP. That fact that the suphp_log file does not exist either, reinforces this.

Check if you have the option to set the handler to suphp. If not, you need to rebuild Apache with SuPHP support.

I hope this helps ;)
I set the handler to suPHP and everything is working great. Thanks for the help
Stefaans!