Private GIT

Skip to content
Snippets Groups Projects
Select Git revision
2 results Searching

check_php_build.php

Blame
  • check_php_build.php 3.56 KiB
    <?php
    
    /**
     *
     * Script to check if all required extensions are compiled and loaded in PHP
     *
     *
     * We need the following mudules:
     *      - session
     *      - gmp
     *		- json
     *		- gettext
     *		- PDO
     *		- pdo_mysql
     *
     ************************************/
    
    
    # Required extensions
    $requiredExt  = array("session", "sockets", "filter", "openssl", "gmp", "json", "gettext", "PDO", "pdo_mysql", "mbstring", "gd");
    
    # Available extensions
    $availableExt = get_loaded_extensions();
    
    # Empty missing array to prevent errors
    $missingExt[0] = "";
    
    # if not all are present create array of missing ones
    foreach ($requiredExt as $extension) {
        if (!in_array($extension, $availableExt)) {
            $missingExt[] = $extension;
        }
    }
    
    # check if mod_rewrite is enabled in apache
    if (function_exists("apache_get_modules")) {
        $modules = apache_get_modules();
        if(!in_array("mod_rewrite", $modules)) {
            $missingExt[] = "mod_rewrite (Apache module)";
        }
    }
    
    # check for PEAR functions
    if ((@include_once 'PEAR.php') != true) {
    	$missingExt[] = "php PEAR support";
    }
    
    # if any extension is missing print error and die!
    if (sizeof($missingExt) != 1 || (phpversion() < "5.4") || PHP_INT_SIZE==4) {
    
        /* remove dummy 0 line */
        unset($missingExt[0]);
    
        /* headers */
        $error   = [];
        $error[] = "<html>";
        $error[] = "<head>";
        $error[] = "<base href='$url".BASE."' />";
        $error[] = '<link rel="stylesheet" type="text/css" href="css/bootstrap/bootstrap.min.css">';
    	$error[] = '<link rel="stylesheet" type="text/css" href="css//bootstrap/bootstrap-custom.css">';
    	$error[] = "</head>";
        $error[] = "<body style='margin:0px;'>";
    	$error[] = '<div class="row header-install" id="header"><div class="col-xs-12">';
    	$error[] = '<div class="hero-unit" style="padding:20px;margin-bottom:10px;">';
    	$error[] = '<a href="'.create_link(null,null,null,null,null,true).'">phpipam requirements error</a>';
    	$error[] = '</div>';
    	$error[] = '</div></div>';
    
        /* Extensions error */
        if(sizeof($missingExt)>0) {