LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-01-2011, 12:48 PM   #1
pbeau
LQ Newbie
 
Registered: May 2011
Location: London UK
Distribution: Debian
Posts: 12

Rep: Reputation: Disabled
Executing script from php.


Hi ... I am trying to execute this:
PHP Code:
$musque='notempty';
while (
$musque == 'notempty')
{
// Play next file in que    
$query "select * from musplay order by idx limit 1";

$result = @mysql_query($query); 
if (
mysql_num_rows($result) == 0)
    {
        
$musque='empty';
        exit();
    }
        while (
$row mysql_fetch_array($result))
        { 

        
$CMD '/usr/bin/mpg123 -q /home/xfer/Music/'.$row['filen'];
        echo 
$CMD;
        
exec($CMD); 
In essence this script (it is cut short) should run as a process and is started via:
PHP Code:
include ('funclib.php');
$substr "./mus_Player.php&";
$output shell_exec($substr);
echo 
$output;
//$dum = mus_dispque(); 
the echo confirms the mpg123 command is received and formatted correctly - it just doesn't do anything!. If I cut and paste the result into a (non-root) tty, it executes as expected. Anyone can give me a hint as to why this won't execute in the LAMP environment? Note.. the rest of the script (not shown) executes fine - it is just the mpg command that echos but doers nothing other than a short delay.

Thanks for any hints

Paul
 
Old 09-01-2011, 01:51 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Educated guess: apache doesn't have access to the music files?


Cheers,
Tink
 
1 members found this post helpful.
Old 09-01-2011, 02:07 PM   #3
pbeau
LQ Newbie
 
Registered: May 2011
Location: London UK
Distribution: Debian
Posts: 12

Original Poster
Rep: Reputation: Disabled
Tink,
Thanks for the response. Your guess is undoutably better (or at least more educated) than mine. This is a private system - no public access - so if I chmod all the files to 777 is that the easiest way to test that theory? I'd rather not just wholesale change things without some understanding.

Much appreciated

Paul
 
Old 09-03-2011, 02:41 AM   #4
pbeau
LQ Newbie
 
Registered: May 2011
Location: London UK
Distribution: Debian
Posts: 12

Original Poster
Rep: Reputation: Disabled
Update - changed a file to 777 and got the same result. I don't pretend to understand the security settings on files other than setting it too 777 is effective;ly 'all access'. As this is not a publicly exposed system, I'm not to concerned about inadvertently opening up holes. Thanks for the suggestion... any other ideas?
 
Old 09-03-2011, 02:58 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Have you looked at apache's logs (access/error) at all?
 
1 members found this post helpful.
Old 09-03-2011, 04:17 PM   #6
zunder1990
LQ Newbie
 
Registered: Feb 2011
Posts: 29

Rep: Reputation: 3
SELinux

If you are using Redhat based linux, you will need to deal with selinux. To fix selinux look here at step 5 http://wiki.centos.org/HowTos/SELinux.
 
1 members found this post helpful.
Old 09-04-2011, 07:20 AM   #7
pbeau
LQ Newbie
 
Registered: May 2011
Location: London UK
Distribution: Debian
Posts: 12

Original Poster
Rep: Reputation: Disabled
Thanks for the responses. Tink: I should have checked this before ... the request to start the player completes successfully (200) - as expected as other commands in the script work ok. zunder 1990: It is Umbutu ... it is the 64 Studio distribution (V 2.x) that I added the lampp package into. at the risk of revealing the true depth of my ignorance: For design reasons, the calling script attempts to start the player (in php) with
PHP Code:
$substr "./mus_Player.php&";
$output shell_exec($substr); 
Within the called script teh player starts with
PHP Code:
$CMD '/usr/bin/mpg123 -q /home/xfer/Music/'.$row['filen'];
        echo 
$CMD;
        
exec($CMD); 
In other OSes I am more familiar with, calling a script within a script like this increases 'depth' and there are limits to this....could I be hitting something similar in linix? now that the obvious is eliminated , I am going to have to explore the unlikely. Thanks for the help.
 
  


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
[SOLVED] Downloading my php script instead of executing it. bhebs_quines Linux - Server 5 07-10-2010 08:14 AM
Executing sudo command from PHP script bilal_linux Linux - Newbie 10 02-15-2010 11:29 PM
Executing system commands in a php script atiq Linux - Server 2 02-26-2007 09:45 AM
Cron not Executing PHP script Badnoodles Linux - General 2 10-25-2006 04:56 PM
Executing PHP script- error message vfulco Linux - Newbie 3 07-13-2004 10:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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