Error 500 populatemysqldb function failing Error 500 populatemysqldb function failing
 

News:

CPG Release 1.6.27
change DB IP storage fields to accommodate IPv6 addresses
remove use of E_STRICT (PHP 8.4 deprecated)
update README to reflect new website
align code with new .com CPG website
correct deprecation in captcha

Main Menu

Error 500 populatemysqldb function failing

Started by jmdoggett, April 13, 2013, 07:54:41 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jmdoggett

I've searched for the solution to this problem, thus my post. During installation I reach step 8, many of the tables are created in the database and then the installation script crashes.

The error log showed this:

13-Apr-2013 16:04:36 UTC] PHP Notice:  Undefined index: mysql_connected in D:\inetpub\wwwroot\coppermine\install.php on line 1592
[13-Apr-2013 16:04:36 UTC] PHP Notice:  Undefined index: temp_data in D:\inetpub\wwwroot\coppermine\install.php on line 1779
[13-Apr-2013 16:05:06 UTC] PHP Fatal error:  Maximum execution time of 30 seconds exceeded in D:\inetpub\wwwroot\coppermine\install.php on line 1787

So I fixed the timeout in php.ini and that went message away. Any help would be appreciated.

jmdoggett

Problem solved. I had to fix the function by creating a $temp_data variable at the top of the function, replace all the references to $GLOBALS['temp_data'] inside the for loop where the web page output is assembled and finally just above the return statement I added $GLOBALS['temp_data'] .= $temp_data;

Here is the relevant section:
    $temp_data .= '<tr><td>';
    foreach($sql_query as $q)
    {
        $is_table = false;
        //check if we are creating a table so we can add it to the output
        if (preg_match('/(CREATE TABLE IF NOT EXISTS `?|CREATE TABLE `?)([\w]*)`?/i', $q, $table_match))
        {
            $table = $table_match[2];
            $is_table = true;
        }
       
        if (! mysql_query($q, $GLOBALS['mysql_connection']))
        {
            $GLOBALS['error'] = $language['mysql_error'] . mysql_error($GLOBALS['mysql_connection'])
                . ' ' . $language['on_q'] . " '$q'";
               
            if ($is_table)
            {
                $temp_data .= "<br />" . sprintf($language['create_table'], $table)
                    . '&nbsp;&nbsp;&nbsp;&nbsp;' . $language['status'] . ':... ' . $language['nok'];
            }
            return false;
        }
        else
        {
            if ($is_table)
            {
                $temp_data .= "<br />" . sprintf($language['create_table'], $table)
                    . '&nbsp;&nbsp;&nbsp;&nbsp;' . $language['status'] . ':... ' . $language['ok'];
            }
        }
    }
   
    $GLOBALS['temp_data'] = $temp_data;

Cheers!
Jay