Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way I can execute a command line in PHP. I want to have a hidden file on my servers so If I lose access to them I can disable the firewall through the website by loading a secure .php file through my browser. The command I use to disable the fire wall is

sudo ufw disable

I'm running Ubuntu Server with apache2. I'm not sure how to execute that through PHP.

Thank you

share|improve this question
no good will come from this - remotely executing system scripts thru sudo is dangerous. u should find another way to solve this. – sybreon Jun 14 '12 at 5:04

What you need to do is setup SSH on your server. Log into the server, and disable the server that way.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.