Running Linux Bash Shell Commands From Inside PHP Web Server

View previous topic View next topic Go down

Running Linux Bash Shell Commands From Inside PHP Web Server

Post by jamied_uk on 28th May 2016, 20:53

Code:

<?php
$output = shell_exec('ls -lart');
echo "<pre>$output</pre>";
?>

Original Video Lost But You Have All You Need Here!


Box Update Code Link
https://app.box.com/s/ioup6nj8nfnh3c2ayj6ydflf8rzueduw


Last edited by jamied_uk on 10th February 2017, 14:49; edited 3 times in total
avatar
jamied_uk
Admin

Posts : 1990
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Running Linux Bash Shell Commands From Inside PHP Web Server

Post by jamied_uk on 28th May 2016, 21:02

More found @
https://secure.php.net/manual/en/function.shell-exec.php
avatar
jamied_uk
Admin

Posts : 1990
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Running Linux Bash Shell Commands From Inside PHP Web Server

Post by jamied_uk on 28th May 2016, 21:45

Bash Shell Via PHP To Generate Voice Wav Clip

avatar
jamied_uk
Admin

Posts : 1990
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Running Linux Bash Shell Commands From Inside PHP Web Server

Post by jamied_uk on 29th May 2016, 01:07

Text To Speech PHP & Bash



You will need write permissions on the files folder for www-data

https://app.box.com/s/ioup6nj8nfnh3c2ayj6ydflf8rzueduw
avatar
jamied_uk
Admin

Posts : 1990
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Running Linux Bash Shell Commands From Inside PHP Web Server

Post by jamied_uk on 29th May 2016, 01:21

Code:
<?php
// convert from wav to mp3
//
$wavfile=$file;
$wav=file_get_contents($wavfile);

$descriptorspec = array(
    0 => array( "pipe", "r" ),
    1 => array( "pipe", "w" ),
    2 => array( "file", "/dev/null", "w" )
);

$process = proc_open( "/usr/bin/lame - -", $descriptorspec, $pipes );

fwrite( $pipes[0], $wav );
fclose( $pipes[0] );

$mp3 = stream_get_contents( $pipes[1] );
fclose( $pipes[1] );

proc_close( $process );
//$new = $mp3;
echo file_put_contents("files/file.mp3","$mp3");
?>



but 1st install Lame

Code:
sudo apt-get install -y lame


Update Code Link

https://app.box.com/s/ioup6nj8nfnh3c2ayj6ydflf8rzueduw
avatar
jamied_uk
Admin

Posts : 1990
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Running Linux Bash Shell Commands From Inside PHP Web Server

Post by jamied_uk on 1st June 2016, 00:18

avatar
jamied_uk
Admin

Posts : 1990
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Running Linux Bash Shell Commands From Inside PHP Web Server

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum