shell-exec

php shell_exec: how to copy a directory from one user to another (VPS on CentOs5)

In Running on CentOS5 + DirectAdmin. I own a VPS, but for security reasons I just want to give all managenent only to 'reseller' user. With a resseler user I have script, which connects to ressellers DA and creates an user. My problem is - how to copy a directory tree with ~10000 of files, which is located in 'resellers user' ftp, ex....

Can I automatically locate the MySQL executable from PHP?

Hi guys, I need to run Shell_exec to import a dump into my MYSQL database. Today I do this: $shellExec = 'C:\wamp\bin\mysql\mysql5.1.36\bin\mysql -h localhost -u root mertero_decicare < D:\localhost\sql\decisions.sql'; $out = shell_exec($shellExec .' 2> output'); Which works. But is there a way to 'find' the location of the mysql ex...

shell_exec() in PHP doesn't execute my specific command

I'm currently building a class in PHP that generates PDF documents using the WKHTMLTOPDF command line app. To do this, I'm using a call to shell_exec to call the WKHTMLTOPDF executable. However, this particular call does not seem to be executed; it returns NULL almost instantly. A small test I did gave me the following results: var_du...

If PHP shell_exec() works too long or executed program hangs... how to catch error?

If I execute with shell_exec() external program (unix) and it works for more than 30 seconds, PHP dies with Fatal error. That's because external program hanged/crashed or I don't know. I want to catch this error. try{}..catch{} does not work in here. Any ideas how to know if external program is hanged? Usually my external program runs u...

Problems executing Perl scripts from PHP

Trying to figure this out. I am trying to execute a perl script within php, using shell_exec() like so: <?php $output=shell_exec("./tst.pl > test.txt"); //$output=shell_exec("./tst.pl"); echo $output; ?> It will not write output to a file using ">" filename.txt. It will work if I execute without directing it to a filename as I can con...

CutyCapt Linux shell_exec

Hi all, I'm trying to setup CutyCapt on my Ubuntu 10.4 server. I generate a thumbnail using the following command in SSH: xvfb-run --server-args="-screen 1, 1280x1200x24" ./CutyCapt --url=http://www.google.dk --out=/var/www/user/data/www/domain.com/test.png --min-width=1280 --min-height=1200 ... and it's working great! Though when...

What (except needing to be root) could cause a permissions error when using PHPs shell_exec?

I have a bash script which runs without needing to be root. But when I run it via shell_exec() (or system(), or exec()) like this: return system("/home/tom/rrd/rrdtool-drawgraph.sh $interval $multiples - debug 2>&1;"); I get the following message: sh: /home/tom/rrd/rrdtool-drawgraph.sh: Permission denied (Strangely, the message...

Executing shell commands using PHP, e.g. shell_exec() etc., on a remote host?

Is it possible to execute shell commands on a remote computer (not localhost)? For instance things like $output = shell_exec("unzip filename.zip"); You can assume that you have the login credentials of a user account on the remote machine, as well as the remote root username, password, and cpanel remote access key. ...

Querying an audio/video file for information

I want a PHP function which receives the path to a file and returns an array of information about it. The PHP file can call FFmpeg. Returned data should be something like Array( [mime] => video/ogg [container] => Ogg [video] => Theora [audio] => Vorbis [duration] => 20.3 // in secon...

shell_exec php example

Hi there are multiple specific examples but I just wanted to have a working generic calling PHP into background example from shell_exec. So my php function runs a large processing job. On the top of the script (process.php) I put? !#usr/bin/php i think - any way to get that specific path, maybe 'which php'? then the actual command ...

Starting screen from PHP to execute intensive Java application

Hello, I am wondering how to start a screen session from PHP, I have tried with shell_exec(), system() and passthru(), but no avail. I have gotten the screen session started for the execution time of the script, but after it has finished loading, it kills the screen session it just created. (By starting a screen session and executing '...

Apache user privileges in Centos

Hi I'm using the shell_exec command from a PHP script: $output = shell_exec('ls -l'); print_r($output); Terminal: php test.php Which results in the directory listing as expected. Switch to my browser I get no output. I need to grant privileges to the user 'apache' so that it can execute certain commands, or add the user to a group ...