Hello. There is a php script in the folder, update.php. It is launched automatically via cron, and in order not to get anyone extra, htaccess is denied access to it. And sometimes you want to run the script manually, through the admin panel, for example through a button. How can this be implemented?
- The dumbest but working way is to run .sh or .bat when clicked, and in it curl to your php script: D - Sultanov
|
2 answers
In the admin.php file:
<?php echo '<a href="/admin.php?execute=update">Execute update</a>'; if(array_key_exists('execute',$_GET)){ echo 'Start...'; include 'update.php'; echo 'Done.'; } - there is no access for users - Dmitriy
- @Dmitriy, this web server is closed, but not php - vp_arth
- Cool idea))) - Qwertiy ♦
|
Create another script that will be executed when the button is pressed and in it
exec('php update.php'); and it is better to specify the full path to php and update.php, something like
exec('/usr/bin/php /var/www/site/update.php'); |