Jump to content

problem with copy file


yolop

Recommended Posts

 

i run this file

<?php
copy('2.php','7.php' );
chmod('7.php',0777);
?>

and it's copy 2.php to 7.php good

i even give to file 0777

now i edit 7.php and put that code

<?php

include('./user.php');


?> 

 

and i got some error


Warning: include() [function.include]: SAFE MODE Restriction in effect. The script whose uid is 100 is not allowed to access ./user.php owned by uid 627 in /home/*****/domains/****.co.il/public_html/7.php on line 3

Warning: include(./user.php) [function.include]: failed to open stream: Not a directory in /home/*****/domains/*****.co.il/public_html/7.php on line 3

Warning: include() [function.include]: Failed opening './user.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/*****/domains/*****.co.il/public_html/7.php on line 3

now....if i run file (that not create from copy) with the same code it's work well

what is the problem????

thank

 

Link to comment
Share on other sites

The owner of file 2.php is the owner with uid 627.

Copying it creates a file 7.php whose owner has uid 100.

 

You could try chown() to reset the owner of 7.php after the copy, although if safe mode is in effect it probably wouldn't permit you to do so.

 

 

Out of interest, why are you copying php scripts from within your code anyway?

Link to comment
Share on other sites

or if Iwrite

chown('7.php', '100');

error

Warning: chown() [function.chown]: Unable to find uid for 100 in

 

or i tried to do

 

<?php

 

 

// File name and username to use

$file_name= "7.php";

$path = "/home/***/domains/****.co.il/public_html/**/***/" . $file_name ;

$user_name = "root";

 

// Set the user

chown($path, $user_name);

 

// Check the result

$stat = stat($path);

print_r(posix_getpwuid($stat['uid']));

 

 

 

 

?>

 

 

error

 

 

Warning: chown() [function.chown]: Unable to find uid for 100 in /home/****/domains/****/public_html/****/****/2.php on line 10

Array ( [name] => apache [passwd] => x [uid] => 100 [gid] => 501 [gecos] => [dir] => /var/www [shell] => /bin/false )

Link to comment
Share on other sites

but error

Warning: chown() [function.chown]: Operation not permitted

As I said before (note the emphasis),

You could try chown() to reset the owner of 7.php after the copy, although if safe mode is in effect it probably wouldn't permit you to do so.

 

 

Now perhaps if you answer my other question:

Out of interest, why are you copying php scripts from within your code anyway?

We might be able to come up with a solution to your problem that doesn't require cloning PHP files, which might bypass your file ownership problem completely

Link to comment
Share on other sites

but error

Warning: chown() [function.chown]: Operation not permitted

As I said before (note the emphasis),

You could try chown() to reset the owner of 7.php after the copy, although if safe mode is in effect it probably wouldn't permit you to do so.

 

 

Now perhaps if you answer my other question:

Out of interest, why are you copying php scripts from within your code anyway?

We might be able to come up with a solution to your problem that doesn't require cloning PHP files, which might bypass your file ownership problem completely

In my system i open subdomain for peopels that i register them

and in every subdomain i pu some php files that include the file from the system

so that is my problem

thank

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.