Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
proc
/
thread-self
/
root
/
proc
/
self
/
root
/
srv
/
admin
/
htdocs
/
//proc/thread-self/root/proc/self/root/srv/admin/htdocs/php-custom.php
<?php require('_util.php'); ?> <!doctype html> <html lang="fr"> <meta charset="utf-8"> <title>Edit PHP configuration</title> <!--[if lt IE 9]> <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link rel="stylesheet" href="<?= css_path(); ?>"> <link rel="shortcut icon" href="<?= favicon_path(); ?>"> </head> <body> <?php require(header_file()); ?> <section id="main"> <h1>Edit PHP configuration</h1> <?php $path_php_custom = '/srv/data/etc/php/'; $files = 'php-custom.ini'; $custom_save = '/srv/data/tmp/.php-custom.ini.save'; // Si on demande la restoration du php.ini if (!empty($_GET['restore']) AND $_GET['restore'] == True) { if (file_exists($custom_save)) { $save_content = file_get_contents($custom_save); $php_ini = fopen($path_php_custom . $files, 'r+'); ftruncate($php_ini, 0); // On vide le fichier avant de tout réecrire dedans fputs($php_ini, $save_content); fclose($php_ini); echo '<p class="done">The restore have been perform</p>'; } else { echo '<div class="error"><p"><strong>Error :</strong><br/>No php.ini files to restore</p></div>'; } } // Modification du php.ini if (!empty($_POST['content'])) { $line_content = explode("\n",$_POST['content']); $allowed_line_patterns = [ "#^;#", "#^[ ]*+\s?$#", "#^[a-zA-Z0-9._\-]+[ ]*=[ ]*[a-zA-Z0-9.,_\-/'\" ]+[\s]*$#", ]; // Ensure all lines are valid. // Ignore lines starting with ';' and empty or blank ones. // Otherwise, ensure the syntax is 'key = value'. foreach ($line_content as $line) { foreach($allowed_line_patterns as $pattern){ if (preg_match($pattern, $line)){ continue 2; } } $not_valid_line[] = $line; } if (empty($not_valid_line)) { //on fait une copie du fichier original, puis on vide le fichier pour le remplir avec la nouvelle version copy($path_php_custom . $files, $custom_save); $php_ini=fopen($path_php_custom . $files, 'r+'); ftruncate($php_ini, 0); // On vide le fichier avant de tout réecrire dedans fputs($php_ini, $_POST['content']); fclose($php_ini); echo '<p class="done">The modification have been perform</p>'; } else { echo '<div class="error"><p><strong>Error :</strong><br/> The followings lines have invalid format (params = value) : <ul>'; foreach ($not_valid_line as $line) { echo '<li>' . $line .'</li>'; } echo '</ul></p></div>'; } } ?> <div class="columns"> <form method="post" class="column-50 left"> <fieldset> <textarea id="content" name="content" readonly rows="40" cols="60" autofocus> <?php if (isset($not_valid_line)) { $content = explode("\n", $_POST['content']); } else { $content = file($path_php_custom . $files); } foreach ($content as $line) { echo $line; } ?> </textarea> <p class="clear"><input class="button" type="button" onClick="return AreaEdit()" value="Edit file"/> <input id="submit" class="button" type="submit" value="Save" disabled/> <a href="?restore=1">Restore the last version of custom-php.ini</a></p> </fieldset> </form> <fieldset class = "column-50 right margin"> <h2>Information</h2> <p>Edit this file permits to override the PHP configuration of your Simple Hosting instance. You can see all parameters in the php manual at <a href="http://php.net/manual/en/" title="PHP Documentation">http://php.net/manual/en/</a>. All lines beginning by ';' are comments and will not be considered by PHP. <strong>It is necessary to restart the instance after apply the change.</strong></p> <p>You can edit all parameters of PHP configuration, with the exception of :</p> <ul> <?php $overide_ko = file_get_contents('/srv/admin/configs/php/' . getenv('WWW_VERSION') . '/base/php_post.ini'); $lines = explode("\n", $overide_ko); foreach ($lines as $line) { if (preg_match("#^[a-zA-Z0-9._\-]+[ ]*=[ ]*[\"a-zA-Z0-9._\-/ \"]+[\r]?$#", $line)) { echo '<li>'. strstr($line, '=', true) .'</li>'; } } ?> </ul> <p>If you want to override parameters for a script only, you can use the ini_set(); function</p> </fieldset> </div> </section> <script type="text/javascript"> function AreaEdit(){ if (confirm('Edit this file must override the php.ini of your instance. Be carefull ! Do you want really edit this file ?')){ document.getElementById("content").readOnly=false; document.getElementById("submit").disabled=false; } } </script> </body> </html>