#1  
Old 23rd June 2006, 01:28
matteo matteo is offline
Junior Member
 
Join Date: Jun 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Pb with Upload Php

When i put a Dotclear Webblog or another CMS..
If i want upload a file via Php.. the file go on the right place but not with the owner of the site.. exemple webx_user. The file owner in the server is wwwrun www (apache)..
How can i upload a file with php and have the right owner ?
Thanks a lot..
Reply With Quote
Sponsored Links
  #2  
Old 23rd June 2006, 06:24
geek.de.nz geek.de.nz is offline
Member
 
Join Date: Feb 2006
Posts: 65
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to geek.de.nz Send a message via MSN to geek.de.nz
Default

If you don't run PHP in safe mode, you can execute shell commands.
With
Code:
<?php
  $output = shell_exec("chown webx_user.webx filename");
  echo $output;
?>
you can for example make filename owned by webx_user in the group webx.
Why do you want to do this though? Shouldn't the file be accessible by everyone after uploading? You wont be able to access the file with the user permissions of webx_user via PHP this way though. You should make sure the permissions are set to "chmod 666 filename" if it should be read/write accessible by everybody.

Btw, I even use PHP for shell scripting this way, because I know it better than Bash.
With a
Code:
#!/usr/bin/php
<?php
 // code
?>
and a
Code:
chmod +x scriptname
you can just execute the script like any other shell script, if you have php installed. (Just a side remark)
__________________
Always mention at least your distribution/version! You can add it in your signature if you don't want to always type it. ;-)

Distributions:
Ubuntu 5.10 with custom kernel (2.6.16-suspend2),
Debian Sarge 3.1 and Etch

Please submit your ISP or Webhost to (free)
http://www.ihostnz.com
Reply With Quote
  #3  
Old 23rd June 2006, 10:17
matteo matteo is offline
Junior Member
 
Join Date: Jun 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ok

Thanks for your answer
i have already think that but why in ovh or 1and1 it is ok ?
When i upload a file via php, it is ok the owner of the file is the user and not owner of apache..and i don t need to make change to my php script ?
It is a option of ISPconfig or Virtual host who block owner ?? can i do something with .htacess or option of Suexec ??

thanks
Reply With Quote
  #4  
Old 23rd June 2006, 11:19
till till is online now
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,496
Thanks: 813
Thanked 5,263 Times in 4,127 Posts
Default

Quote:
Originally Posted by matteo
Thanks for your answer
i have already think that but why in ovh or 1and1 it is ok ?
When i upload a file via php, it is ok the owner of the file is the user and not owner of apache..and i don t need to make change to my php script ?
It is a option of ISPconfig or Virtual host who block owner ?? can i do something with .htacess or option of Suexec ??
To run PHP with the permissions of the website owner instead of the apache user you must run PHP as CGI-PHP with SuExec, SuPHP or PHP as FastCGI.

This is a question how you setup PHP and not ISPConfig as the PHP that runs on your webserver is not part of the ISPconfig package, it belongs to your linux distribution.

To setup PHP with SuPHP, have a look here:

http://www.howtoforge.com/apache2_suphp_php4_php5
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #5  
Old 24th June 2006, 00:45
matteo matteo is offline
Junior Member
 
Join Date: Jun 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default Thanks a lot

thanks of lot for you contrib..
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting 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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
"unknown filter" growing apache log. wwparrish Installation/Configuration 6 1st September 2006 18:40
perfect setup suse 10 - phpmyadmin & mysql question reddog Server Operation 7 17th June 2006 12:59
2 domains, 1 site wadims Installation/Configuration 13 31st May 2006 00:21
Downgrade php5 to php4.4.2 llizards Installation/Configuration 4 13th March 2006 23:58
all my site go to /var/www/ Absolusteph Installation/Configuration 14 11th March 2006 21:27


All times are GMT +2. The time now is 11:52.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.