1

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.

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

1

Have a look at this function, maybe it will help: https://www.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');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.