简体   繁体   中英

Possible to work with commandline in php on webhost?

i want to use this script http://www.paulhammond.org/webkit2png/ inside my codeigniter project.

I've only a shared webhosting package.

So i ask myself if it's possible to work with my codeigniter/php also on commandline?

I'm not conform with working on commandline, so please sorry for my question and thanks for explain me what is possible and what not.

PHP has function allow to execute command on unix using exec function and shell_exec for powershell command.
Command

<?php
echo exec('whoami');

Powershell command

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

Example:

// Chmod doesn't work it needs root permission.
// exec('chmod a+x /path/to/webkit2png');

// Make sur that webkit2png is installed
echo exec('webkit2png --help');
echo exec('webkit2png http://www.google.com/');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM