I've a simple script to transfer some files from one domain to
another, with both domains living on the same server. The files in
both directories are already chmod 777. Yet after transfer, I try to
ensure that the file is 777, and I get an error. Why?
for ($i=0; $i < count($transfer Array); $i++) {
$fileName = $transferArray[$i];
$commandAsStrin g = "\cp -f /var/www/vhosts/mydomain.com/httpdocs/
site_specific_f iles/$fileName /var/www/vhosts/theice.org/httpdocs/
site_specific_f iles/$fileName";
exec($commandAs String);
chmod("/var/www/vhosts/ice.org/httpdocs/site_specific_f iles/
$fileName", 0777);
if ($i 0) $resultString .= ", ";
$resultString .= "$fileName" ;
}
The files copy over just fine, but the line where I try to do chmod, I
get this error:
"Warning: chmod(): Operation not permitted in /var/www/vhosts/
cyberbitten.com/httpdocs/sharedCode/
transferFilesFr omCyberbittenTo TSR.php on line 33"
The owner and the group of the file change to "www-data" which is
annoying, but which should allow PHP to do anything it wants with the
files. So why would I get an error?
I also tried to end with this line:
exec("chown mgtr /var/www/vhosts/ice.org/httpdocs/site_specific_f iles/
$fileName");
This doesn't work at all. Why?
I ssh to the server and edited the configuration files to be sure the
open_basedir restriction was off, then I rebooted Apache. That made
no difference, for this particular bug.
another, with both domains living on the same server. The files in
both directories are already chmod 777. Yet after transfer, I try to
ensure that the file is 777, and I get an error. Why?
for ($i=0; $i < count($transfer Array); $i++) {
$fileName = $transferArray[$i];
$commandAsStrin g = "\cp -f /var/www/vhosts/mydomain.com/httpdocs/
site_specific_f iles/$fileName /var/www/vhosts/theice.org/httpdocs/
site_specific_f iles/$fileName";
exec($commandAs String);
chmod("/var/www/vhosts/ice.org/httpdocs/site_specific_f iles/
$fileName", 0777);
if ($i 0) $resultString .= ", ";
$resultString .= "$fileName" ;
}
The files copy over just fine, but the line where I try to do chmod, I
get this error:
"Warning: chmod(): Operation not permitted in /var/www/vhosts/
cyberbitten.com/httpdocs/sharedCode/
transferFilesFr omCyberbittenTo TSR.php on line 33"
The owner and the group of the file change to "www-data" which is
annoying, but which should allow PHP to do anything it wants with the
files. So why would I get an error?
I also tried to end with this line:
exec("chown mgtr /var/www/vhosts/ice.org/httpdocs/site_specific_f iles/
$fileName");
This doesn't work at all. Why?
I ssh to the server and edited the configuration files to be sure the
open_basedir restriction was off, then I rebooted Apache. That made
no difference, for this particular bug.
Comment