Creating a PHP page that runs a Unix script release

I just wrote a few release scripts on my new server, which creates an SVN tag and validates it by creating all the specific symbolic links and publishing them on their production or intermediate sites.

My client really likes that his hands are dirty, and it’s more and more comfortable succumbing to the hood and making PHP / HTML changes when I focus on something else. He is actually not bad, and I encourage him to continue, because it is good for both of us, and he does not annoy me, making simple or annoying mistakes.

I am going to configure it with an SVN client so that it can make its changes, but the only thing outstanding in this process allows it to publish these changes for production and production. Of course, I can give it access to the server through. SSH and go through the process, but it looks like at some point it could be seriously wrong.

I am going to create a PHP password protected page that will allow it to run these scripts by clicking a button.

So, I have two questions:

a) Is the approach that I take with the PHP page to expose the release scripts, and

b) What is the best way to implement this type of page in PHP? script is a straightforward shell script

Greetings

+3
source share
4 answers

exec PHP , . , SVN, , , :

exec("svn commit -m '$message'");
// Perform more exec() commands as needed

- PHP.net exec() :

". , , , escapeshellarg() escapeshellcmd(), , ."

PHP.net .

+1
+1

:

  • script php exec,
  • php script (), cronjob script, ( )
0

, , . B . PHP. , , , Apache .

, :

exec('your command here');

, , , .

<?php
if ($is_authorized && $push_to_staging) {
  // execute the command to push the repo to staging.
}
?>

escapeshellarg.

0

All Articles