LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 05-05-2008, 11:41 AM   #1
misulica
LQ Newbie
 
Registered: Oct 2007
Posts: 11

Rep: Reputation: 0
php and exec problems


hello.
i have a php file and in it i use ffmpeg to convert the movie to flv
it uses exec() to do it but it doesent work
i tried this small script:
Code:
<?php
echo '<pre>';
echo exec('whoami') or die("It doesn't work");
echo '</pre>';
?>
i tried all sort of commands like pwd, ls, everything and still getting erros.
safe mode is off
 
Old 05-05-2008, 11:43 AM   #2
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Rep: Reputation: 55
What is the error its giving?
 
Old 05-05-2008, 11:45 AM   #3
misulica
LQ Newbie
 
Registered: Oct 2007
Posts: 11

Original Poster
Rep: Reputation: 0
when i access the web page from www i get this:
It doesn't work
can you tell me the location of the httpd error log
Edit:
# vi /var/log/httpd/error_log
sh: /whoami: No such file or directory

Last edited by misulica; 05-05-2008 at 11:48 AM.
 
Old 05-05-2008, 11:47 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,635

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by misulica View Post
can you tell me the location of the httpd error log
Try looking in the /var/log/apache directory. You should see logs in there. It may be in a different location on your system, maybe under /var/log/apache2. Check your Apache configuration file, and it should point you to where the logs are kept.
 
Old 05-05-2008, 11:51 AM   #5
misulica
LQ Newbie
 
Registered: Oct 2007
Posts: 11

Original Poster
Rep: Reputation: 0
check my post before and see the error i get
 
Old 05-05-2008, 02:06 PM   #6
misulica
LQ Newbie
 
Registered: Oct 2007
Posts: 11

Original Poster
Rep: Reputation: 0
# vi /var/log/httpd/error_log
sh: /whoami: No such file or directory

and i get in http: It doesn't work
 
Old 05-05-2008, 02:18 PM   #7
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,635

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by misulica View Post
# vi /var/log/httpd/error_log
sh: /whoami: No such file or directory

and i get in http: It doesn't work
The command isn't in your path. Try to specify the explicit path of the command, such as /usr/bin/whoami, and see what happens.
 
Old 05-05-2008, 02:44 PM   #8
misulica
LQ Newbie
 
Registered: Oct 2007
Posts: 11

Original Poster
Rep: Reputation: 0
i replaced it.
same errors both in web and in httpd log
 
Old 05-05-2008, 03:04 PM   #9
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,635

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by misulica View Post
i replaced it.
same errors both in web and in httpd log
Hmm...try to leave off the "or die("It doesn't work");", and see if it goes then. You might also want to check out the php docs at:

http://us2.php.net/manual/en/function.exec.php
 
Old 05-05-2008, 03:17 PM   #10
misulica
LQ Newbie
 
Registered: Oct 2007
Posts: 11

Original Poster
Rep: Reputation: 0
i just tried now it doesen`t show anything...i checked the php manual too and added a simple exec() function and still nothing
can the problem be like php doesent has rights to execute or something ?
 
Old 05-05-2008, 07:15 PM   #11
misulica
LQ Newbie
 
Registered: Oct 2007
Posts: 11

Original Poster
Rep: Reputation: 0
any ideas ?
 
Old 05-06-2008, 06:00 AM   #12
misulica
LQ Newbie
 
Registered: Oct 2007
Posts: 11

Original Poster
Rep: Reputation: 0
ok i fixed it..
aparently it had: safe_mode enabled by the Plesk admin pannel
 
  


Reply



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
Problem with PHP exec() macabre_sunsets Programming 4 06-12-2007 11:03 AM
PHP / VideoLAN / Fedora Core Question - how can I get the PHP "exec" function to work gtrawoger Linux - Software 3 12-21-2005 06:51 AM
php exec devit Programming 4 04-08-2004 03:26 AM
PHP exec Spooky Programming 1 01-19-2004 08:34 AM
exec cgi from php? barazor Programming 5 01-23-2002 09:12 PM

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

All times are GMT -5. The time now is 03:12 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