vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   PHP: Script generated files - ownership issue (https://vborg.vbsupport.ru/showthread.php?t=107534)

Aceman 02-09-2006 02:39 PM

PHP: Script generated files - ownership issue
 
On my server php scripts that generate files are doing so fine, however the files that the script makes sets the owner of that file as "apache.apache" and I can not remove/overwrite those files unless I log in as root and do so. The script is chmod 777. And the ownership is aceman.aceman, but the files it creates are always apache.apache.

I chown -R aceman.aceman public_html - which recursively sets all the files in the folder and it's sub folders to owner-aceman / group-aceman.

Is there a way to setup the server so that the ownership is maintained? In the php.ini file or the httpd config file?

Any guidance or help would be greatly appreciated.

Brad 02-09-2006 03:28 PM

From Zend's Page on File Creation:

Quote:

Permissions
It is important to remember a few key things when working with PHP and file creation. PHP runs via your webserver and therefore has the same rights as your webserver. Since most webservers do not run with super-user status (root in Unix/Linux, or administrator in Windows) you will need to make sure the folders and files you want to edit allow the webserver write access.

Got that all set? If you already know what you are doing with permissions, you can skip to the next section.

If you are running Unix or Linux with Apache you will need to change the owner of your files to ?nobody? or ?www? depending on your install. If you don?t know what user simply type:

ps -aux | grep httpd

This will show you the apache processes running on your server, look to see the name of the user running the process. Now you need to change the permissions of your files.

File: chown www file.txt
Directory: chown www folder1/

This will change the owner of the file file.txt (or the directory folder1/) to www, thus allowing PHP via Apache to edit the file.

Aceman 02-09-2006 03:32 PM

I actually found that page on another site myself via google. I ran the command they indicated and my server says it's apache. Not nobody or www.

maybe it's a setting issue with the server because mine doesn't say nobody or www - it's apache. Where can I set it so that nobody is the default owner when a file is generated?

Just a heads up: in my httpd.conf file I did notice a line that reads:

User apache
Group apache

Would changing that too nobody for user and group help? And then restart apache?

Aceman

Paul M 02-09-2006 04:13 PM

It doesn't really matter whether it runs as apache or nobody, it just means the files will be owned by the user "nobody" instead. You need to alter the script that creates them to make sure the created files are global write.

Boofo 02-09-2006 04:25 PM

You shouldn't have to alter any scripts. It worked fine on the old server but this one is giving us fits for some reason. There has to be a setting somewhere that sets it. And no ones else seems to be having this problem so it has to be server side.

Paul M 02-09-2006 04:42 PM

You could try addind a user aceman, group aceman to the apache definition for that site.


All times are GMT. The time now is 08:42 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01051 seconds
  • Memory Usage 1,726KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete