1

It seems like I can't use shell_exec or proc_open on my shared server.

The message I get when I try to use it is:

Warning: shell_exec() has been disabled for security reasons in /home/georgee/public_html/admin/email.php on line 4

Are there any alternatives to these functions?

Alix Axel
  • 151,645
  • 95
  • 393
  • 500
Nathan Osman
  • 71,149
  • 71
  • 256
  • 361
  • I need the function to run another script like so `php someotherfile.php`. – Nathan Osman Apr 17 '10 at 05:49
  • *(sidenote)* check the output of `phpinfo()` for the ini settings of `disable_classes` and `disable_functions` to see what is unavailable. – Gordon Apr 17 '10 at 11:12

4 Answers4

2

I assume you want to use this for async processing, for instance sending eMails in a separate process (hence the error in email.php). If so, please check if cURL is enabled. You can trigger your scripts through an HTTP request without waiting for the response.

Further reading:

If cURL is not available, try to use with non-blocking streams:

For added security, consider using a self-defined API key, so the eMail sending URL cannot be triggered without permission. Pass this in as a GET or POST. You could also validate if the request came from the same server.

Community
  • 1
  • 1
Gordon
  • 312,688
  • 75
  • 539
  • 559
1

The only alternative is to not use shared hosting. They don't want you doing this for a reason.

Azeem.Butt
  • 5,855
  • 1
  • 26
  • 22
0

Just a follow up for people who need to use shared hosting. While I no longer recommend HostGator due to their sub-par support (resulting from their purchase by EIG), they do allow popen.

pbarney
  • 2,529
  • 4
  • 35
  • 49
0

Try using backtick operator

This answers seems to suggest these is not much you can do.

Community
  • 1
  • 1
codaddict
  • 445,704
  • 82
  • 492
  • 529