Last active
September 22, 2024 17:22
-
-
Save susanBuck/17d9c88ab845bbb6f088e48d1cd56435 to your computer and use it in GitHub Desktop.
Output the differences between two PHP config files (php.ini)
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 | |
# REF: | |
# Nginx: https://codewithsusan.com/notes/upgrade-php-nginx | |
# Apache: https://codewithsusan.com/notes/upgrade-php-apache | |
# UPDATE THESE TWO PATHS: | |
$current = '/path/to/current/php.ini'; | |
$previous = '/path/to/previous/php.ini'; | |
$currentSettings = parse_ini_file($current); | |
$previousSettings = parse_ini_file($previous); | |
$diffSettings1 = array_diff($previousSettings, $currentSettings); | |
$diffSettings2 = array_diff($currentSettings, $previousSettings); | |
$diffSettings = array_merge($diffSettings1, $diffSettings2); | |
?> | |
<table> | |
<tr> | |
<th>Setting</th> | |
<th>Previous<br> <?=$previous?></th> | |
<th>Current <br> <?=$current?></th> | |
</tr> | |
<?php foreach($diffSettings as $setting => $value): ?> | |
<td><?=$setting?></td> | |
<td><?=$previousSettings[$setting] ?? '[Setting not present]' ?></td> | |
<td><?=$currentSettings[$setting] ?? '[Setting not present]'?></td> | |
</tr> | |
<?php endforeach; ?> | |
</table> | |
<style> | |
body { | |
font-family:Courier; | |
} | |
table { | |
table-layout: fixed; | |
width:100%; | |
border-collapse:collapse; | |
} | |
table, th, td { | |
border: 1px solid; | |
} | |
td { | |
padding:10px; | |
word-wrap: break-word; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment