29 if (isset($args[0]) && !empty($args[0]) && isset($args[1]) && !empty($args[1])) {
30 $onContent =
'extension=' . $args[0];
31 $offContent =
';extension=' . $args[0];
32 if (version_compare(
$bearsamppBins->getPhp()->getVersion(),
'7.2',
'<')) {
33 $onContent =
'extension=php_' . $args[0] .
'.dll';
34 $offContent =
';extension=php_' . $args[0] .
'.dll';
37 $phpiniContent = file_get_contents(
$bearsamppBins->getPhp()->getConf());
38 if ($args[1] == self::SWITCH_ON) {
39 $phpiniContent = str_replace($offContent, $onContent, $phpiniContent);
40 } elseif ($args[1] == self::SWITCH_OFF) {
41 $phpiniContent = str_replace($onContent, $offContent, $phpiniContent);
44 $phpiniContentOr = file_get_contents(
$bearsamppBins->getPhp()->getConf());
45 if ($phpiniContent == $phpiniContentOr && file_exists(
$bearsamppBins->getPhp()->getSymlinkPath() .
'/ext/php_' . $args[0] .
'.dll')) {
47 $latestExt = (end($extsIni) ==
'0' ?
';' :
'');
48 if (version_compare(
$bearsamppBins->getPhp()->getVersion(),
'7.2',
'<')) {
49 $latestExt .=
'extension=php_' . key($extsIni) .
'.dll';
51 $latestExt .=
'extension=' . key($extsIni);
53 $phpiniContent = str_replace(
55 $latestExt . PHP_EOL . $onContent,
60 file_put_contents(
$bearsamppBins->getPhp()->getConf(), $phpiniContent);