LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-14-2009, 04:29 AM   #1
nbdr
LQ Newbie
 
Registered: Nov 2008
Posts: 6

Rep: Reputation: 0
How to install something so the apache user will be able to run it?


I'm setting up a script that requires s3cmd (amazon web services lib).

The lib runs well from the command line (user=root) but when I run the same command using PHP shell_exec it is not run and no error is returned. I assume that its because s3cmd the user is 'apache' when I run from PHP.

My question is how to install s3cmd (or any other software) so that I can run it from PHP (without phpsuexec).

Note: I installed using yum install. The OS is CentOs5
Thanks!
Niro
 
Old 12-14-2009, 07:34 AM   #2
dracofhc
Member
 
Registered: Dec 2005
Location: Kalamazoo, MI, US
Distribution: Gentoo
Posts: 44

Rep: Reputation: 16
Sounds like it's a file permissions problem. On my system (ubuntu) apache runs as the user "www-data". Check if you have this user as well:
Code:
cat /etc/passwd | grep www
and if you do then likely you need to set the script so that the group "www-data" can execute it.
Code:
chown :www-data <your-script> && chmod 755 <your-script>
You may need to change the library so it can be read by this group, not sure.
 
Old 12-17-2009, 01:02 AM   #3
nbdr
LQ Newbie
 
Registered: Nov 2008
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by dracofhc View Post
Sounds like it's a file permissions problem. On my system (ubuntu) apache runs as the user "www-data". Check if you have this user as well:
Code:
cat /etc/passwd | grep www
and if you do then likely you need to set the script so that the group "www-data" can execute it.
Code:
chown :www-data <your-script> && chmod 755 <your-script>
You may need to change the library so it can be read by this group, not sure.

Thanks, I didn't find www-data user but I did change the owner to 48 (the apache user id) and it still did not work. The binary permission is 755.

What else can I try?
 
Old 12-17-2009, 07:33 AM   #4
dracofhc
Member
 
Registered: Dec 2005
Location: Kalamazoo, MI, US
Distribution: Gentoo
Posts: 44

Rep: Reputation: 16
I remember I ran into problems getting apache to run shell commands from php scripts about a year ago. Looking back through my code I found that I used the system() function to execute them instead of shell_exec(). Not sure if this was the problem but may be worth trying.
 
Old 12-20-2009, 03:19 AM   #5
nbdr
LQ Newbie
 
Registered: Nov 2008
Posts: 6

Original Poster
Rep: Reputation: 0
I tried to run the script with system and passthrough commands and the result that came back is '1' witout additional info. I tried when s3cmd owner is 0 and 48 (apache) permission is 755. Please help.
 
Old 12-21-2009, 11:27 AM   #6
dracofhc
Member
 
Registered: Dec 2005
Location: Kalamazoo, MI, US
Distribution: Gentoo
Posts: 44

Rep: Reputation: 16
Please post contents of the following:

httpd.conf
relevant file for this site from `sites-available/`
relevant section of code from your php application that calls s3cmd
 
  


Reply

Tags
php, shell



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How-To run Apache, php, MySQL on startup and install phpMyAdmin - Slackware 12.2 Penthux Slackware 22 10-07-2012 10:44 PM
make apache run as the user dtra Linux - Server 3 07-03-2008 12:00 AM
run cgi script as a user other than apache paul_mat Linux - Software 1 06-02-2006 02:01 PM
Suddenly can't run OpenOffice.org as regular user--or install for one jonr Linux - Software 2 05-20-2005 12:49 PM
user under which apache tomcat run?? Sridhar Guntur Linux - Security 2 08-28-2003 01:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration