Re: [PHP]: permission problem www-data
On 1/18/2011 4:44 AM, Moses wrote: Hi Everyone, I am creating a file in PHP script which takes a value from a form and writes it to a file. However, i don't have the mode permission for the file instead it is owned by www-data.What can i do to ensure that the file is owned by me. drwxr-xr-x 2 www-data www-data 4096 2011-01-17 22:01 18757170111.0 -rw-r--r-- 1 www-data www-data 40 2011-01-17 23:39 32238.hydro Thanks. Either have a PHP script create the directory, OR Using FTP access, set the dir perms to 757, or 777. The xx7 makes the dir world writable. For protection, put a .htaccess file in the dir like: # Prevent Direct Access to Files from outside world Order Deny,Allow Deny from all Or put your dir above the webspace, [DOCUMENT_ROOT} -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Permission problem
On Tue, April 25, 2006 11:16 am, tedd wrote: > A while back I was persuaded by this illustrious group into thinking > that placing images in a file system was superior to placing them in > mySQL -- after all, what could go wrong with a file system solution, > right? > > So I did. > > Now, I have a small problem. Unfortunately, most of the images I've > uploaded have permissions set at chmod 600 (rx- --- ---). Interesting > enough, considering that all the images were all uploaded with the > same script, not all of the images have the same permission problem > -- that's odd. > > In any event, I can't back-up, download, copy, change permissions, or > do anything with the chmod 600 group. Any suggestions as to what I > can do with these files? You may not be able to do anything with those files logged in as 'tedd' (or whatever) but the PHP script you wrote ran as a specific user (probably 'www' or 'nobody') and THAT user can do whatever it wants to the files, because that user 'owns' them. So you can write a PHP admin script to copy or change permissions on the existing files. You'll have to surf to it for the same user to be running that script as uploaded the files. You could also ALTER your upload script for future uploads to change the http://php.net/umask before you upload files, and http://php.net/chmod the files after they are uploaded, to provide access to the 'w'orld or a 'g'roup if your webhost (or you) can put the PHP user and 'tedd' in the same group. As far as some of the files being different, those are probably files you uploaded "by hand" during testing, or your script had, at some point, calls to umask and or chmod in it, that you altered, or only called under certain circumstances. It's also possible that you changed the permissions on the containing directory at some point, which change "trickled down" to the new files created within that directory after that point in time. Once you understand how/why the Unix permissions are what they are, it's pretty trivial to figure out how to get the files to do what you want. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Permission problem
[snip] In any event, I can't back-up, download, copy, change permissions, or do anything with the chmod 600 group. Any suggestions as to what I can do with these files? [/snip] At 11:30 AM -0500 4/25/06, Jay Blanchard wrote: After uploading have PHP CHMOD them properly and At 12:41 PM -0400 4/25/06, Robert Cummings wrote: And for your existing files create a script to load in your browser that traverses the files and CHMOD's them. I hate it when you guys do that -- I don't want to think. I added a chmod to my edit.php and changed the permissions as the images were viewed -- duh! -- it couldn't be simpler. For being the bright guy I think I am, I'm pretty dim sometimes. Thanks. tedd PS: Hey, and no wisecracks about "what do you mean -- sometimes?" :-) -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Permission problem
On Tue, 2006-04-25 at 12:30, Jay Blanchard wrote: > [snip] > A while back I was persuaded by this illustrious group into thinking > that placing images in a file system was superior to placing them in > mySQL -- after all, what could go wrong with a file system solution, > right? > > So I did. > > Now, I have a small problem. Unfortunately, most of the images I've > uploaded have permissions set at chmod 600 (rx- --- ---). Interesting > enough, considering that all the images were all uploaded with the > same script, not all of the images have the same permission problem > -- that's odd. > > In any event, I can't back-up, download, copy, change permissions, or > do anything with the chmod 600 group. Any suggestions as to what I > can do with these files? > [/snip] > > After uploading have PHP CHMOD them properly And for your existing files create a script to load in your browser that traverses the files and CHMOD's them. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Permission problem
[snip] A while back I was persuaded by this illustrious group into thinking that placing images in a file system was superior to placing them in mySQL -- after all, what could go wrong with a file system solution, right? So I did. Now, I have a small problem. Unfortunately, most of the images I've uploaded have permissions set at chmod 600 (rx- --- ---). Interesting enough, considering that all the images were all uploaded with the same script, not all of the images have the same permission problem -- that's odd. In any event, I can't back-up, download, copy, change permissions, or do anything with the chmod 600 group. Any suggestions as to what I can do with these files? [/snip] After uploading have PHP CHMOD them properly -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Permission Problem
You need to seek help from a phpnuke support forum. -Original Message- From: Mr|P [mailto:[EMAIL PROTECTED] Sent: Saturday, July 05, 2003 7:53 AM To: [EMAIL PROTECTED] Subject: [PHP] Permission Problem I moved from myphpnuke to phpnuke. When trying to register a new user account on the website it get the error: You are trying to access a restricted area. We are Sorry, but this section of our site is for Registered Users Only. Thanks for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Permission Problem
Go to admin -> Modules, and set Your_Account to be visible to all visitors. Mr|P wrote: I moved from myphpnuke to phpnuke. When trying to register a new user account on the website it get the error: You are trying to access a restricted area. We are Sorry, but this section of our site is for Registered Users Only. Thanks for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] permission problem - i guess
> Weird, check if both versions use the same php.ini, it is mentioned in > phpinfo output. > Yes, they both point to /etc/php.ini Do you want me to paste the contents of the 2 files here ? they are a little long so i'm asking gamin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] permission problem - i guess
Weird, check if both versions use the same php.ini, it is mentioned in phpinfo output. gamin wrote: Hi Marek, Try executing phpinfo from u.php, run it once from the command line and once from the browser and check if they are nay different. I added the function phpinfo() to u.php and ran u.php from the commandline and then backticked `` it in test.php and called test.php from the browser. The configure commands (commandline u.php and browser test.php) for both are identical. but the result in the browser (test.php that executes u.php internally) there is no mention of the section on 'mysql'. The following section is non existant in the browser. Im stumped !! <--- this is from phpinfo() [u.php] executed from command line > mysql MySQL Support => enabled Active Persistent Links => 0 Active Links => 0 Client API version => 3.23.49 MYSQL_MODULE_TYPE => builtin MYSQL_SOCKET => /var/lib/mysql/mysql.sock MYSQL_INCLUDE => MYSQL_LIBS => Directive => Local Value => Master Value mysql.allow_persistent => On => On mysql.connect_timeout => -1 => -1 mysql.default_host => no value => no value mysql.default_password => no value => no value mysql.default_port => no value => no value mysql.default_socket => no value => no value mysql.default_user => no value => no value mysql.max_links => Unlimited => Unlimited mysql.max_persistent => Unlimited => Unlimited mysql.trace_mode => Off => Off Thank you and regards gamin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] permission problem - i guess
Hi Marek, > Try executing phpinfo from u.php, run it once from the command line and > once from the browser and check if they are nay different. > I added the function phpinfo() to u.php and ran u.php from the commandline and then backticked `` it in test.php and called test.php from the browser. The configure commands (commandline u.php and browser test.php) for both are identical. but the result in the browser (test.php that executes u.php internally) there is no mention of the section on 'mysql'. The following section is non existant in the browser. Im stumped !! <--- this is from phpinfo() [u.php] executed from command line > mysql MySQL Support => enabled Active Persistent Links => 0 Active Links => 0 Client API version => 3.23.49 MYSQL_MODULE_TYPE => builtin MYSQL_SOCKET => /var/lib/mysql/mysql.sock MYSQL_INCLUDE => MYSQL_LIBS => Directive => Local Value => Master Value mysql.allow_persistent => On => On mysql.connect_timeout => -1 => -1 mysql.default_host => no value => no value mysql.default_password => no value => no value mysql.default_port => no value => no value mysql.default_socket => no value => no value mysql.default_user => no value => no value mysql.max_links => Unlimited => Unlimited mysql.max_persistent => Unlimited => Unlimited mysql.trace_mode => Off => Off Thank you and regards gamin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] permission problem - i guess
Try executing phpinfo from u.php, run it once from the command line and once from the browser and check if they are nay different. gamin wrote: Hi, I have PHP 4.3.0 installed on a Red Hat system. I have written a number of command line scripts which run perfectly fine. For example #! /usr/bin/php -q // do my stuff ?> This script works perfectly fine, when started from the command line. Now i intend to call this command line script from another another script (that is called from the browser). for example - < /var/www/html/test.php > This generates an error ' Fatal error : Call to undefined function: mysql_connect() in /usr/local/bin/u.php on line 3' phpinfo gives me the following cofigure command './configure' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--prefix=/usr' '--with-config-file-path=/etc' '--disable-debug' '--with-pic' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-gd' '--with-gdbm' '--with-gettext' '--with-jpeg-dir=/usr' '--with-mm' '--with-openssl' '--with-png' '--with-regex=system' '--with-ttf' '--with-xml' '--with-expat-dir=/usr' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-debugger' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-yp' '--enable-wddx' '--with-ldap=shared' '--with-mysql=shared' '--with-apxs=/usr/sbin/apxs' Thank you to all With regrads gamin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php