- Create a folder on your server.
- Copy the composer.json file
- Run
composer install
- Create a file called
restart-php-fpm.php
- Set the correct email, key, server ID and php-fpm version.
- Run
php restart-php-fpm.php
Last active
April 25, 2023 13:53
-
-
Save mklasen/39a9068172bdb31a0d223a79d9c66005 to your computer and use it in GitHub Desktop.
Cloudways restart PHP-FPM via terminal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "mklasen/cw-restart-php-fpm", | |
"require": { | |
"cloudwaysapi/phpsdk": "^1.0" | |
}, | |
"authors": [ | |
{ | |
"name": "Marinus Klasen", | |
"email": "[email protected]" | |
} | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require "vendor/autoload.php"; | |
use Cloudways\Server\Service\Service; | |
$service = new Service(); | |
$service->SetEmail("_email_"); | |
$service->SetKey("_api_key_"); | |
$servers = $service->getServers(); | |
foreach ($servers as $server) { | |
if (is_array($server) && !empty($server)) { | |
$object = reset($server); | |
print($object->id . ': ' . $object->label . "\n"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require "vendor/autoload.php"; | |
use Cloudways\Server\Service\Service; | |
$service = new Service(); | |
$service->SetEmail("_email_"); | |
$service->SetKey("_api_key_"); | |
$service->manageServices('_server_id_', 'php7.3-fpm', 'restart'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment