reqcheck.php

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
Post Reply
cmb
Posts: 13260
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

reqcheck.php

Post by cmb » Sat Apr 06, 2013 1:12 pm

Hello Community,

you may have already noticed, that I've written a small script, which is meant to check, if a server fulfills the requirements to run CMSimple_XH (so before uploading the whole shebang, the user has to upload a single script only): reqcheck.php. Of course this is only a draft; more checks could be implemented and it should be internationalized (and a bit styling won't hurt either).

What do think about it? Do you consider it useful? If so, we might put it on SourceForge.

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

snafu
Posts: 352
Joined: Sun Dec 26, 2010 5:18 pm

Re: reqcheck.php

Post by snafu » Sat Apr 06, 2013 1:23 pm

cmb wrote:What do think about it? Do you consider it useful? If so, we might put it on SourceForge.
good, yes, yes :mrgreen:
lg.
winni

Durch einen Sucher betrachtet wird alles zu einem Motiv.
meine Galerie; mein Blog, mein CMSimple Template Tutorial

svasti
Posts: 1649
Joined: Wed Dec 17, 2008 5:08 pm

Re: reqcheck.php

Post by svasti » Sat Apr 06, 2013 2:20 pm

I have seen something like that from another CMSes. I tried once one and got as answers that my server wasn't capable enough. We could put it also on cmsimple-xh.org ?

svasti

oldnema
Posts: 265
Joined: Wed Jan 21, 2009 5:15 pm
Location: Czech Republic
Contact:

Re: reqcheck.php

Post by oldnema » Sat Apr 06, 2013 3:28 pm

Great idea - to test hosting before installing CMSimple_XH!
Josef
Nobody knows how much time he has left ...
http://oldnema.compsys.cz/en/?Demo_templates

cmb
Posts: 13260
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: reqcheck.php

Post by cmb » Sat Oct 28, 2017 12:28 pm

I'm coming back to this topic after a long time, because recently I got a support request which could only be solved by some (educated) guess: it turned out that the mbstring extension was missing on the server, so CMSimple_XH 1.7.1 produced a white screen of death without any help from the debug mode.

Thus, I overhauled the old reqcheck.php script for CMSimple_XH 1.7.1, and would suggest to add it to the repo and default download of CMSimple_XH, so it can be maintained along with the rest of the core, and users can use it before or after installing CMSimple_XH; ideally before, but at least after such errors occur.

The script as it currently is:

Code: Select all

<?php

/**
 * Copyright 2013-2017 Christoph M. Becker
 *
 * This file is part of ReqCheck_XH.
 *
 * ReqCheck_XH is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * ReqCheck_XH is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with ReqCheck_XH.  If not, see <http://www.gnu.org/licenses/>.
 */

if (isset($_GET['phpinfo'])) {
    echo phpinfo();
    exit;
}

$version = 'CMSimple_XH 1.7.1';
$title = "$version Requirements Check";

$checks = array();
$checks['the Webserver is supported'] = preg_match('/apache|nginx|iis/i', $_SERVER['SERVER_SOFTWARE']) ? 'okay' : 'warn';
$checks['the PHP Version is at least 5.3.7'] = version_compare(PHP_VERSION, '5.3.7', '>=') ? 'okay' : 'fail';
foreach (array('json', 'mbstring', 'session') as $ext) {
    $checks['the PHP extension "' . $ext . '" is installed'] = extension_loaded($ext) ? 'okay' : 'fail';
}
$checks['magic_quotes_runtime is off'] = !get_magic_quotes_runtime() ? 'okay' : 'warn';
$checks['safe_mode is off'] = !ini_get('safe_mode') ? 'okay' : 'warn';
$checks['session.use_trans_sid is off'] = !ini_get('session.use_trans_sid') ? 'okay' : 'warn';
$checks['session.use_only_cookies is off'] = ini_get('session.use_only_cookies') ? 'okay' : 'warn';
$checks['session.cookie_lifetime is zero'] = ini_get('session.cookie_lifetime') == 0 ? 'okay' : 'warn';
$checks['the function fsockopen is available'] = function_exists('fsockopen') ? 'okay' : 'warn';

$fail = $warn = false;
foreach ($checks as $state) {
    switch ($state) {
        case 'fail':
            $fail = true;
            break;
        case 'warn':
            $warn = true;
            break;
    }
}
?>
<!DOCTYPE html>
<html>
    <head>
        <title><?php echo $title?></title>
        <style type="text/css">
            .okay, .warn, .fail {padding: 0.7em; padding-left: 36px; border-radius: 7px}
            .okay {background: #e1f8cb url('data:image/gif;base64,R0lGODlhEAAQAGYAACH5BAEAAAAALAAAAAAQABAApgEAACm1IRykGkDFOC69JJDmfiu3IgudDWPeSi+/JDnQJjjQJB60HE7KRSWtIBu1GkHHMBykGTXBK0HULVzaRjXOIjXNIzTPIUjVMSe8Ik3JRSGpHBagFV/fSiK6GhuhGAuhDMD3r2/fWx6lGq3unVPaNWDOU9H5v0rRMBCjEV3dOcf3s2TUVE3UM1rcRGfhT4Lbc0zPOyGtIBSaFQynDYHkbbj1pi++JWjZV4HjbErUMV/VUDbPIjLALWfhUSe0IHjlXxiaFp7rgGvTW43neTPGIsv4uB+3Fz3OLcX4szbOJS69JW3gVg2nDiq2IkrXMBSYFRSbFTbLJBO0EWnhQZHocye2HCS0HiauH7Dxmx64Fiu1H3nbaDC+JVbaQQqfDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAeCgACCg4SFhoeIiTE4iYRaOwVWjQAeLCQvW41HXEYdRR+JNDAnLlIRUQAyHIUgJiteChszABJCQ1+DTRpJFAsOUIIQVFUNBwApPSEiPF1Bgw8oKkADUxk2ORcBWIUMLSVMPllEFQQjh1c6Twg1SgkBiT8YExZLTpMGSDfvkwACAomBAAA7') no-repeat 10px; color: #37620d; border: 1px solid #c6d880}
            .warn {background: #ffffbb url('data:image/gif;base64,R0lGODlhEAAQAGYAACH5BAEAAAAALAAAAAAQABAApgEAAPKyK/TPQ/TMP/O6L/KuKcJzEtl7TfXQRYGBgtCVSfbVcfPDJeukRSclJvKhI2hoavOvKfO6MPfVRtCYDykoKbFbD++gKtyKHuqZP/GlJqZdCTIwM/vnoPXRQ8aOF/KmJtSRTPCwDPGuKe+PFNhxTfned/TSRfPAUOuGDfe3J/CvCcd2FOyiQe2fJHNzd/WyK/TQQ/bUY/TITPTLPvO+GvrTaemxYPCzEC4tLiopKvXPRTQ0NvO8KSgmKGNjZvrnmPPHduCOHisqK/TJOfTLP/TJSfTURs2ORfrnpNamIvC4GaNcCfG2HPXSTNmKHfbTZ+SaQKxeCjc2OPfjbs+BFO2JD/jnjffgmtGAGPTGNOeWIfXSS+KtWPSjI+vBc8t7F+vAdvfbd/fQauKPHvjTae+GCPbVYvOnJvTOP/bRTvbQUzw7PfTFS/bRWfO5K/O+HfuwKeqYIPC3F/XPP9OEGwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAewgACCg4SFhoIlB4eGB19hiouDNzJQXZGCUUkLC2UhkQ0dagkJMzYKiw0may8/RmOnhi1YYm5sUz1tKEiGQUBnDDwcK28qVYUZE2kDNUMVIgQBMBaDKRN0MQNwPg440BER0wAXVAgCNEQUFEsSAQVxBuJXHuUDDBAQTdAFaF4GZidO6CnJoeODPhAPNpA4wmWHgCJaKjiYw26EhgdMAFhxIWcLGSEYntTJAoaFASkAAgEAOw==') no-repeat 10px; color: #756730; border: 1px solid #ffd324}
            .fail {background: #fbe5e2 url('data:image/gif;base64,R0lGODlhEAAQAGYAACH5BAEAAAAALAAAAAAQABAApgEAAP///+43LdFGTvFaQO9BMfFgRO4yK7cTF/JiRu9BMslHUN1BTOssMeoXAPI0LfR1YPR1ZO0kJsZJT+sIFeZxb/h0ZvJdQJkJDPFlRskcIOwzGvVmR6ELEfqnlvzi3OwgCbApLvNnTtAeIewxGMUVFfWekfikj/ElKPFhRPafheVGT/FcQPNtWO89LfFTOvJhRu0pKPApKPJiRPFZQONeY+woEccZHvFfRO87HvNoUewkDdsfJO4pKLwVGrxES9pXWPBYUPFnR/mpmv719PJoTPotK+gQHO9EJ+85HuQhJbYTF/U1KesVIPN9bO8yK/N9be0yHedCTOEiJu0yK5wJDe9zcfeJcu83GuwoE/WLaugmKPFONfR0YfFZS/Z1ZvFdTPWGctMfJPJnS+8/K/FZP/VzZ8AYHO9jXtgfI+4kJvFcSeVycfBCJwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAeogACCg4SFhoIDA4eGAxVsiouDNV0RQJGCDENQTl8LkQweIgEBYBaehytXOqNrZhOHUiZhLaNkXkE/hlYnEG2jIC5MJYUDHCwEWKM7BQIPIYMDaBcpBEmjNsxPDwiCDVoJBmUvDg4bCgIHRtwNKjPgBEijUcwHMigIFBlF7zmjWfQ91FRpImQMDBw0uHwgQuIclRgSMAA4skXJFB5pxIzQcOOMjyUdAAQCADs=') no-repeat 10px; color: #992213; border: 1px solid #f2a197}
            ul {list-style: none}
        </style>
    </head>
    <body>
        <h1><?php echo $title?></h1>
<?php if ($fail):?>
            <p class="fail"><b>Sorry, there appear to be serious issues! Most likely <?php echo $version?> will not run on this server with the current PHP configuration!</b></p>
<?php elseif ($warn):?>
            <p class="warn"><b>Hmm, there appear to be minor issues! <?php echo $version?> may not run smoothly on this server with the current PHP configuration!</b></p>
<?php else:?>
            <p class="okay"><b>All is well! <?php echo $version?> is supposed to run smoothly on this server!</b></p>
<?php endif?>
        <h2>Details</h2>
<?php foreach ($checks as $check => $state):?>
            <div class="<?php echo $state?>">Checking that <?php echo $check?> – <?php echo $state?></div>
<?php endforeach?>
        <p><a href="?phpinfo">PHP Info</a></p>
    </body>
</html>
Respective issue on Github: https://github.com/cmsimple-xh/cmsimple-xh/issues/325.
Christoph M. Becker – Plugins for CMSimple_XH

frase
Posts: 2900
Joined: Thu Apr 21, 2016 6:32 am
Location: Saxony
Contact:

Re: reqcheck.php

Post by frase » Fri Feb 22, 2019 1:19 pm

cmb wrote:
Sat Oct 28, 2017 12:28 pm
Thus, I overhauled the old reqcheck.php script for CMSimple_XH 1.7.1, and would suggest to add it to the repo and default download of CMSimple_XH, so it can be maintained along with the rest of the core, and users can use it before or after installing CMSimple_XH; ideally before, but at least after such errors occur.
It looks very good to me.
But I wonder how the inexperienced user should start the script before installing XH.
Maybe first upload it as index.php alone - and then overwrite it during the XH installation?
Or maybe you should build an installation routine after all?

It's all just a question of documentation - but how do you make it "very simple"?

frase
Posts: 2900
Joined: Thu Apr 21, 2016 6:32 am
Location: Saxony
Contact:

Re: reqcheck.php

Post by frase » Fri Feb 22, 2019 3:18 pm

Maybe you prefer a file that is aligned to the XH Style Guide?
Then you could try the following.
reqcheck.zip
You do not have the required permissions to view the files attached to this post.

Post Reply