UK WEB HOSTING FORUM FOR DISCUSSION ON WEB HOSTING SERVICE AND SUPPORT
LINUX HOSTING WINDOWS HOSTING PACKAGES SHOPPING CART OSCOMMERCE ZEN CART AGORA
ECOMMERCE HOSTING ASP MSSQL FRONTPAGE HOSTING PHP MYSQL HOSTING DISCUSSION FORUM
CPANEL RESELLER HOSTING DEDICATED SERVER VPS HOSTING PLESK VIRTUOZZO
Quick Search
Your forum announcement here!

  UK Web Hosting | Dedicated Server Windows and Linux VPS Forum > Technical Support > Linux Dedicated Servers

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 17-03-2008, 11:11
Pandacoder's Avatar
Junior Member
 
Join Date: Dec 2007
Posts: 16
Default ftp, sftp and php

Hi,

PHP runs as 'nobody' on my dedicated server. I have a php script that needs to copy a template file from a file or from a mysql db to the web directory.

Once it is in the web directory it needs to change ownership and group to the owner of the web directory (not 'nobody').

Initially I tried php functions chown(), chmod() etc but of course because the web dir is not owned by 'nobody' php has insufficient permissions, it cannot write the files to the directory and it cannot modify the directory (chmod 777) to allow the files to be written.

So I need to follow the ftp route, I want to ftp_connect() using php, to the server locally using the web directory owner's login details, but I have hit a problem, the server is setup to only allow sftp login.

Is there a way to allow ftp login but only locally from within the server, so php can login and chmod the directory to 777, copy in the template file and then chmod back to 755?

What is a good secure ftp program to install on the server?

Is there a better way?

Any help or pointers appreciated.
__________________
$wisdom = array('knowledge', 'patience', 'experience', 'compassion', 'sympathy', 'humour', 'courage', 'tolerance', 'humility', 'Linux');
Reply With Quote
  #2 (permalink)  
Old 17-03-2008, 13:45
AlexP's Avatar
System Administrator.
 
Join Date: Apr 2007
Posts: 55
Default

Hello,

I would like to suggest you please enable php suexec on your server for more details please refer PhpSuexec - what do I need to know? post.
__________________
Thanks and Regards,
Alex P
System Administrator.
Dedicated Hosting || Semi Dedicated Hosting
Reply With Quote
  #3 (permalink)  
Old 17-03-2008, 14:06
Pandacoder's Avatar
Junior Member
 
Join Date: Dec 2007
Posts: 16
Default

Thanks for the help. Do you have a 'how to' enable phpsuexec page, that article gives the benefits etc but not how to actually enable it.

I may need to disable it rather quickly as well because it seems the $PHP_SELF var no longer works once phpsuexec is enabled and i use $_SERVER['PHP_SELF'] in many of my scripts. I will need to test.
__________________
$wisdom = array('knowledge', 'patience', 'experience', 'compassion', 'sympathy', 'humour', 'courage', 'tolerance', 'humility', 'Linux');
Reply With Quote
  #4 (permalink)  
Old 17-03-2008, 14:17
AlexP's Avatar
System Administrator.
 
Join Date: Apr 2007
Posts: 55
Default

Quote:
Originally Posted by Pandacoder View Post
Thanks for the help. Do you have a 'how to' enable phpsuexec page, that article gives the benefits etc but not how to actually enable it.

I may need to disable it rather quickly as well because it seems the $PHP_SELF var no longer works once phpsuexec is enabled and i use $_SERVER['PHP_SELF'] in many of my scripts. I will need to test.
Please send mail to our dedicated server department ( dedicated@eukhost.com )with server details , I will enable it for you.
__________________
Thanks and Regards,
Alex P
System Administrator.
Dedicated Hosting || Semi Dedicated Hosting
Reply With Quote
  #5 (permalink)  
Old 17-03-2008, 17:07
Pandacoder's Avatar
Junior Member
 
Join Date: Dec 2007
Posts: 16
Default

Hi Alex,

Please could you tell me how to enable it or point me to a tutorial. I would like to understand how it is done and research for any affects it may have on other scripts we run on the site and server.

Thanks
__________________
$wisdom = array('knowledge', 'patience', 'experience', 'compassion', 'sympathy', 'humour', 'courage', 'tolerance', 'humility', 'Linux');
Reply With Quote
  #6 (permalink)  
Old 17-03-2008, 21:51
AlexP's Avatar
System Administrator.
 
Join Date: Apr 2007
Posts: 55
Default

You have to recompile apache/php with mod_suphp and suexec module , If cpanel is installed on your server then please run ./scripts/easyapache script to recompile apache/php
__________________
Thanks and Regards,
Alex P
System Administrator.
Dedicated Hosting || Semi Dedicated Hosting
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 01:32.

 

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by Web Hosting 3.1.0
Copyright © 2001-2008, eUKhost.com. All rights reserved.

 
Site Map

knowledgebase articles

popular blog categories