Jump to content

[SOLVED] PHP not processing


acctman

Recommended Posts

the exec function doesn't process, but it works fine if i put it in a empty php file by itself. Is there a reason why it would not run with other coding around it?

 


// Handle MP3 uploads
if(!move_uploaded_file($_FILES['Filedata']['tmp_name'], $upload_path . session_id() . ".mp3")) {
  header("HTTP/1.0 500 Internal Server Error");
}

$cmd = '/usr/local/bin/lame -b 112 /home/site/public_html/temp/tempo.mp3 /home/site/public_html/temp/112_tempo.mp3'
exec($cmd);

Link to comment
Share on other sites

i was testing with a file in the /temp/ folder... once the upload is done, it should process the exec function

this what the actually line should be but it's not work, is my $cmd array format correct?

 

if(!move_uploaded_file($_FILES['Filedata']['tmp_name'], $upload_path . session_id() . ".mp3")) {
header("HTTP/1.0 500 Internal Server Error");
}

$cmd = '/usr/local/bin/lame -b 112 /home/site/public_html/temp/' . session_id() . '.mp3' '/home/site/public_html/temp/112_' . session_id() . '.mp3';
exec($cmd);

Link to comment
Share on other sites

have you tried it without using the php script

 

i just tried this and it didn't work

$mp3file = "tempo.mp3";
$cmd = '/usr/local/bin/lame -b 112 /home/site/public_html/temp/' . $mp3file . '/home/site/public_html/temp/112_' . $mp3file;
exec($cmd);

 

this works though

$cmd = '/usr/local/bin/lame -b 112 /home/site/public_html/temp/tempo.mp3 /home/site/public_html/temp/112_tempo.mp3';
exec($cmd);

 

so its something wrong with my Array formatting for the first code with $cmd, is everything spaced correctly with the $mp3file?

Link to comment
Share on other sites

echo the $cmd and look if your getting the same value?

 

thanks for the tip, this is what it's showing. How do i add a space in between?

 

/usr/local/bin/lame -b 112 /home/site/public_html/temp/tempo.mp3/home/site/public_html/temp/112_tempo.mp3

Link to comment
Share on other sites

what array? are you sure you want array because you do this

 

echo $mp3

echo works for variables , string etc.. and array that index is being initialize  not the exact array

i guess this should work in this case

 

session_start();
$mp3[] = session_id() ".mp3";
print_r($mp3);
or if you want echo then
echo $mp3[1];  note i use 1 as an array index

Link to comment
Share on other sites

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/site/public_html/temp/test.php on line 4

 

this is what i'm trying to do in my script. $mp3file should have the sessionID.mp3 then added to $cmd for the exec. the coding doesn't like this line $mp3file = session_id() ".mp3"; same with the test.php i get an error with $mp3[] = session_id() ".mp3";

 

$mp3file = session_id() ".mp3";
$cmd = '/usr/local/bin/lame -b 112 /home/site/public_html/temp/' . $mp3file . ' /home/site/public_html/temp/112_' . $mp3file;
exec($cmd);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.