Cmd_api_domain

flandercan

New member
Joined
Jan 26, 2018
Messages
2
Hi

I am trying to switch the PHP version for 1-2 2-1 however it doesnt appear to update the settings

Using

Code:
$result3 = $da->query("CMD_API_ADDITIONAL_DOMAINS", array("action" => "view", "domain" => "usr0364.htm5.howtomoodle.com"), "POST");
print_r ($result3);

Gives me result

Code:
Array
(
    [UseCanonicalName] => OFF
    [active] => yes
    [bandwidth] => unlimited
    [cgi] => OFF
    [defaultdomain] => yes
    [domain] => usr0364.htm5.howtomoodle.com
    [has_multiple_ips] => no
    [has_php_selector] => yes
    [ip] => 89.40.44.51
    [open_basedir] => ON
    [php] => ON
    [php1_info] => PHP 5.6 php-fpm
    [php1_select] => 2
    [php1_ver] => 5.6
    [php2_info] => PHP 7.1 mod_php
    [php2_select] => 1
    [php2_ver] => 7.1
    [private_html] => link
    [quota] => unlimited
    [safemode] => OFF
    [ssl] => ON
    [suspended] => no
    [username] => usr0364
)

I want to switch php1_select to 1 and vice versa , trying to achieve this with

Code:
$result3 = $da->query("CMD_API_DOMAIN", 
						array("action" => "modify",
							  "domain" => "usr0364.htm5.howtomoodle.com",
						      "ubandwidth" => "unlimited",
						      "uquota" => "unlimited",
						      "php1_select" => "1",
						      "php2_select" => "2",
						      "ssl" => "ON",
						      "php" => "ON",
							  ), "POST");

Which results in

Code:
Array
(
    [error] => 0
    [text] => The domain has been modified
    [details] => 
)

However the php select does not change.

Any Ideas ?

Thanks
Paul
 
[SOLVED] Omg that took some working out.......

Googled to death, almost gave up.....

This works

Code:
$result3 = $da->query("CMD_API_DOMAIN", 
						array("action" =>[B] "php_selector"[/B],
							  "domain" => "usr0364.htm5.howtomoodle.com",
						      "ubandwidth" => "unlimited",
						      "uquota" => "unlimited",
						      "php1_select" => "2",
						      "php2_select" => "1",
						      "ssl" => "ON",
						      "php" => "ON",
							  ), "POST");

Found the "php_selector" as the action type on the web interface so thought it would be worth a try , running this resulted in

Array
(
[error] => 0
[text] => PHP versions saved
[details] =>
[#60;a_href] =>
[#61;] =>
[#34;CMD] =>
[#95;ADDITIONAL] =>
[#95;DOMAINS] =>
[#63;action] =>
[#61;view] =>
[#38;domain] =>
[#61;usr] =>
[#48;] =>
[#51;] =>
[#54;] =>
[#52;_htm] =>
[#53;_howtomoodle_com] =>
[#34;] =>
[#62;Back] =>
[#60;/a] =>
[#62;] =>
)

This doesn't look a very friendly output but it does switch the versions as a need it to.

Maybe this post will save someone trial and error time in the future.

Thanks
Paul
 
Hello Paul,

The required fields are:

- php1_select=2 or 1
- php2_select=1 or 2
- save=Save
- action=php_selector
- domain=domain.com

There is no need to pass other I'd rather say.
 
Back
Top