Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > Скриптовые языки программирования > PHP
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 08.08.2019, 14:35   #1
Zero108
Новичок
Джуниор
 
Регистрация: 08.08.2019
Сообщений: 3
Сообщение Помогите исправить пхп код

Имеется пхп скрипт, который запускается кроном. После обновления mysql на сервере, при запуске задачи в кроне вылазиет такая ошибка:

Код:
root# /opt/php55/bin/php  /home/data/user1/www/site.com/rating_cron.php > /tmp/log2.txt &

PHP Warning:  mysql_connect(): Headers and client library minor version mismatch. Headers:50556 Library:50637 in /home/data/user1/www/rating.site.com/sources/sql/mysql.php on line 32
Подскажите, как исправить пхп код, чтобы не возникало ошибки?

Строка 32: $this->dbl = mysql_connect($host, $user, $password) ;

Последний раз редактировалось Zero108; 08.08.2019 в 14:38.
Zero108 вне форума Ответить с цитированием
Старый 08.08.2019, 14:35   #2
Zero108
Новичок
Джуниор
 
Регистрация: 08.08.2019
Сообщений: 3
По умолчанию

Код:
<?php
//===========================================================================\\
// Aardvark Topsites PHP 5.2                                                 \\
// Copyright (c) 2000-2009 Jeremy Scheff.  All rights reserved.              \\
//---------------------------------------------------------------------------\\
// http://www.aardvarktopsitesphp.com/                http://www.avatic.com/ \\
//---------------------------------------------------------------------------\\
// This program 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 2 of the License, or (at your    \\
// option) any later version.                                                \\
//                                                                           \\
// This program 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.                                          \\
//===========================================================================\\

if (!defined('ATSPHP')) {
  die("This file cannot be accessed directly.");
}

$database = 'MySQL';

class sql_mysql {
  var $dbl;
  var $debug;
  var $num_queries;
  var $queries;

  function connect ($host, $user, $password, $database, $debug = 0) {
    $this->dbl = mysql_connect($host, $user, $password)	;
    $db = mysql_select_db($database, $this->dbl);

    $this->num_queries = 0;
    $this->debug = $debug ? 1 : 0;
    $this->queries = array();
    
    $this->query("SET NAMES utf8", __FILE__, __LINE__);

    return $db;
  }

  function query($query, $file, $line) {
    global $queries;

    if ($this->debug) { array_push($this->queries, $query); }

    $result = mysql_query($query) or $this->error($file, $line);
    $this->num_queries++;

    return $result;
  }

  // Executes a normal query and fetches the array in one line
  function fetch($query, $file, $line) {
    $result = $this->query($query, $file, $line);
    return $this->fetch_array($result);
  }

  function select_limit($query, $num, $offset, $file, $line) {
    if ($offset) { $limit = ' LIMIT '.$offset.','.$num; }
    else { $limit = ' LIMIT '.$num; }

    return $this->query($query.$limit, $file, $line);
  }

  function fetch_array($result) {
    return mysql_fetch_array($result);
  }

  function num_rows($result) {
    return mysql_num_rows($result);
  }

  function escape($value, $no_html = 0) {
    if (get_magic_quotes_gpc()) {
      $value = stripslashes($value);
    }
    $value = mysql_real_escape_string($value, $this->dbl);

    if ($no_html) {
      $value = strip_tags($value);
    }
    
    return $value;
  }

  function error($file, $line) {
    trigger_error("Database error in &quot;<b>{$file}</b>&quot; on line <b>{$line}</b><br /><br />\n" . @mysql_error($this->dbl), E_USER_ERROR);
  }

  function close() {
    mysql_close($this->dbl);
  }

  // For backups
  function get_table($table, $data = 1) {
    $create_table = $this->fetch("SHOW CREATE TABLE {$table}", __FILE__, __LINE__);
    $create_table = $create_table['Create Table'] . ";\n\n";

    if ($data) {
      $result = $this->query("SELECT * FROM {$table}", __FILE__, __LINE__);

      $table_fields = '';
      $insert_into = '';
      $table_list = '';

      $num_fields = mysql_num_fields($result);
      for($i = 0; $i < $num_fields; $i++) {
        $table_fields .= ($i == 0 ? '' : ', ') . mysql_field_name($result, $i);
      }

      for($i = 0; $data = mysql_fetch_row($result); $i++) {
        $insert_into .= "INSERT INTO {$table} ({$table_fields}) VALUES (";

        for($j = 0; $j < $num_fields; $j++) {
          if($j != 0) { $insert_into .= ', '; }

          if(!isset($data[$j])) { $insert_into .= 'NULL'; }
          elseif(is_numeric($data[$j]) && (intval($data[$j]) == $data[$j])) { $insert_into .= intval($data[$j]); }
          elseif($data[$j] != '') { $insert_into .= "'" . $this->escape($data[$j]) . "'"; }
          else { $insert_into .= "''"; }
        }
        $insert_into .= ");\n";
      }
      $insert_into .= "\n\n";
    }
    else {
      $insert_into = '';
    }

    return $create_table . $insert_into;
  }
}
?>

Последний раз редактировалось Zero108; 08.08.2019 в 14:38.
Zero108 вне форума Ответить с цитированием
Старый 08.08.2019, 14:36   #3
p51x
Старожил
 
Регистрация: 15.02.2010
Сообщений: 15,707
По умолчанию

Ну так обновите хедер - вам же прямым текстом написали.
p51x вне форума Ответить с цитированием
Старый 08.08.2019, 14:42   #4
Zero108
Новичок
Джуниор
 
Регистрация: 08.08.2019
Сообщений: 3
По умолчанию

Сильно извиняюсь, я пользователь, а не программист. Буду благодарен за прямое указание, что на что поменять. Или что нужно сделать на сервере?
Zero108 вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Помогите исправить код Максим Гончар Python 1 26.06.2019 22:04
помогите исправить код Screame Microsoft Office Excel 2 12.07.2009 10:56
Помогите исправить Virus' Помощь студентам 3 09.12.2008 17:21
Помогите исправить L_M Помощь студентам 3 08.06.2008 01:06
Помогите исправить код student_63 Помощь студентам 5 13.12.2007 18:20