xampp安裝bugfree的坑 -----mysql未安裝


最近新換來一份工作,需要重新搭建bugfree。 為了偷懶 所以選擇了xampp+bugfree3.0.4來安裝bugfree。 一切順利!

 

問題出現在bugfree安裝檢查環境時,一直提示未安裝mysql。 小編百思不得其姐,  最后發現問題出現在xampp安裝的時最新的php7.x。 7.x在原來代碼的基礎上移除了部分mysql的方法 所以檢測一直mysql不存在

 所以我們需要去修改bugfree的源代碼,方法如下:

修改:

bugfree\install\func.inc.php 中的checkMysql方法:

源代碼:

function checkMysql()
{
    if(function_exists("mysql_get_client_info"))
    {
        $versionInfo = mysql_get_client_info();
        preg_match('/[^\d]*([\d\.]+)[^\d]*/', $versionInfo, $version);
        $version = isset($version[1]) ? $version[1] : $versionInfo;
        return version_compare($version, '5.0', '>=');
    }
    return t('bugfree', 'Not Install');
}

 

修改后的代碼:

 

function checkMysql()
{
    if(function_exists("mysqli_get_server_info"))
        {

                    $test = new mysqli("127.0.0.1", "root", "", "mysql");
                    if(!$test)  {
                                    echo"database error";
                    }else{
                                    echo"php env successful \n";
                                    $versionInfo = mysqli_get_server_info($test);
                                    printf("Server version: %s\n", mysqli_get_server_info($test));
                                    preg_match('/[^\d]*([\d\.]+)[^\d]*/', $versionInfo, $version);
                                    print_r($version);
                                    $version = isset($version[1]) ? $version[1] : $versionInfo;
                                    $test->close();
                                    return version_compare($version, '5.0', '>=');
                    }

        }
    return t('bugfree', 'Not Install');
}

 

還需要將上訴文件中:mysql_get_client_info()改為mysql_get_client_info()   刷新頁面即可


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM