Pergunta

It might be kind of a nooby question but ...

How can I possibly run a php command like php /path/to/script.php on a hosted web-server?

I have no access via SSH or something.

Foi útil?

Solução

You can check if the program execution commands like exec() have been disabled on the server side using:

function execEnabled() 
{
  $arrDisabled = explode(',', ini_get('disable_functions'));
  return (!in_array('exec', $arrDisabled));
}

A list of all system execution commands can be found here:

http://us.php.net/exec

If exec(), passthru() etc. have been disabled, there is no way to execute shell commands.

As Christian Ciupponi asked, why would you execute a PHP script using shell command? You could simply include the file to run it if file access to the script is permitted.

Outras dicas

Have a look at this function, maybe it will help: http://it1.php.net/function.exec

By the way why can't you just visit the page you need? In this way the script will run

EDIT:

How to use the exec function:

The exec function allow you tu execute an external program when you do not have access to an ssh consolle. (note that this function can be disabled by the sysadmin )

For example you can use:

$whoami =  exec('whoami');
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top