Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > chown / chgrp and PHP

chown / chgrp and PHP
Thread Tools
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Jan 22, 2004, 07:52 AM
 
Hi,

I have written a basic file upload class in PHP - but I'd like it to change the Permissions on the uploaded file.

However every time I try to use chgrp or chown in a PHP page it seems to halt the entire script (without any errors.)

e.g.:

[php]
<?php

echo("Changing perms starts.");

$file = "/users/diggory/desktop/40070029.jpg";
$groupName = "admin";
$ownershipPerms = "g+w";

chgrp ( $file, $groupName) // Change Permissions
or die("The group ownership of <em>$file</em> could not be set to <em>$groupName</em>"");


chown ( $file , $ownershipPerms))
or die("could not file ($file) permissions to ($ownershipPerms) ");


echo ("script ends.");
?>[/php]


Results in a completely blank HTML page - no errors at all - but also none of the echos I'd expect.

Am I doing this totally wrong?
     
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Jan 22, 2004, 08:29 AM
 
OK after more reading up on perms I realise I got it wrong - but I still don't understand why the script would fail silently...

ho hum.
     
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Jan 22, 2004, 09:23 AM
 
Originally posted by Diggory Laycock:
OK after more reading up on perms I realise I got it wrong - but I still don't understand why the script would fail silently...

ho hum.
It could be how the PHP install is configured. By default it writes errors out to the Apache error log in OSX (/var/log/httpd/error_log).
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Jan 22, 2004, 07:56 PM
 
Originally posted by Arkham_c:
It could be how the PHP install is configured. By default it writes errors out to the Apache error log in OSX (/var/log/httpd/error_log).
Brilliant! thanks - I'd installed a newer PHP package and it had the display_errors directive set to No.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:52 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2