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>";
?>



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


Last edited by jamied_uk on 28th May 2016, 21:10; edited 1 time in total

jamied_uk
Admin

Posts : 1972
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

jamied_uk
Admin

Posts : 1972
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


jamied_uk
Admin

Posts : 1972
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

jamied_uk
Admin

Posts : 1972
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

jamied_uk
Admin

Posts : 1972
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


jamied_uk
Admin

Posts : 1972
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 Today at 16:01


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