GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   PHP help needed, please. (https://gfy.com/showthread.php?t=215265)

acctman 12-31-2003 03:49 PM

PHP help needed, please.
 
hi can someone help me with what i would assume small php code fix. i'm trying to add a CHMOD & CHOWN function to my upload.php file. right now all images that are uploaded by the script is being set to CHMOD 600 with a GRP and USER of "99".

I can't ftp in to edit or delete images since it says i don't have permission. so can someone the chmod to 0644 with a GRP and USER of 'missbot'

thanks in advance.

file is here www.nemxproject.com/upload.txt

JSA Matt 12-31-2003 03:52 PM

http://us2.php.net/manual/en/function.chgrp.php
http://us2.php.net/manual/en/function.chmod.php
http://us2.php.net/manual/en/function.chown.php

php.net should be your next best friend.

acctman 12-31-2003 03:57 PM

yeah php.net is good. i just came from there. I guess i'm placing the function in the wrong place or somethign cause it was working. no errors were displayed yet the files still uploaded with a restricted chmod/grp/owner

JDog 12-31-2003 04:07 PM

Quote:

Originally posted by acctman
yeah php.net is good. i just came from there. I guess i'm placing the function in the wrong place or somethign cause it was working. no errors were displayed yet the files still uploaded with a restricted chmod/grp/owner
Sometimes the CHMOD doesn't work on some servers, you'll need to use the

PHP Code:

exec("chmod 666 /path/to/file/"); 

see if that works

jDoG

fuzebox 12-31-2003 04:25 PM

An uprivileged user cannot chown a file to another user.

As for deleting files, you have permission to delete them if they are in a directory you have write access to, regardless of the permission on the file itself.

EZRhino 12-31-2003 05:19 PM

After that learn ssh, life is easier once you get the basics down

acctman 01-02-2004 03:13 AM

hmm i still can't get the script to use the chmod i'm not receiving any errors. files are still being uploaded with 0600 chmod. anyone have any insight into why this is happening

Alky 01-02-2004 03:22 AM

Quote:

Originally posted by acctman
hmm i still can't get the script to use the chmod i'm not receiving any errors. files are still being uploaded with 0600 chmod. anyone have any insight into why this is happening
is your error reporting off?

acctman 01-02-2004 03:49 AM

error reporting seems to be working cause I left out a semi-colon and the script displayed the line error

Alky 01-02-2004 03:50 AM

Quote:

Originally posted by acctman
error reporting seems to be working cause I left out a semi-colon and the script displayed the line error
hmm no not necessarily... leaving out a semi colon is a parse error, and that will always be reported.. if your error reporting is off, it will hide the warnings, which would probably explain your chmod problems.

acctman 01-02-2004 04:01 AM

how would i go about checking to see if my error reporting is on

notjoe 01-02-2004 05:39 AM

Quote:

Originally posted by acctman
how would i go about checking to see if my error reporting is on
Your Webserver is running under a non-root userspace. Files which get uploaded will be owned by this user.

Since this isnt a _root_ user you cannot chown the file to another user on the machine using the php script, about the best you could do is chmod 755, so that only the webserver user can write to the file but everyone else on the system can read/execute it.

Right from Php.net/chown
"Attempts to change the owner of the file filename to user user (specified by name or number). Only the superuser may change the owner of a file. "

acctman 01-02-2004 07:24 PM

Quote:

Originally posted by notjoe


Your Webserver is running under a non-root userspace. Files which get uploaded will be owned by this user.

Since this isnt a _root_ user you cannot chown the file to another user on the machine using the php script, about the best you could do is chmod 755, so that only the webserver user can write to the file but everyone else on the system can read/execute it.

Right from Php.net/chown
"Attempts to change the owner of the file filename to user user (specified by name or number). Only the superuser may change the owner of a file. "

what if i had a separate script that would scan the /image folder and chmod all 600 files to 755, would something like that work?


All times are GMT -7. The time now is 08:32 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123