how to fix?

Codes here !

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 1
Joined: Wed Mar 25, 2020 11:58 pm

Thu Mar 26, 2020 12:05 am

Good afternoon a little help! how can i fix this problem.

in a script installation I get this error from the server.

server information

Code: Select all

cPanel Έκδοση 	86.0 (build 16)
Έκδοση Apache 	2.4.41
Έκδοση PHP 	7.1.33
Έκδοση MySQL 	10.2.31-MariaDB-cll-lve
Αρχιτεκτονική 	x86_64
Λειτουργικό σύστημα 	linux
Διαδρομή προς Sendmail 	/usr/sbin/sendmail
Διαδρομή προς το Perl 	/usr/bin/perl
Έκδοση Perl 	5.16.3
Έκδοση πυρήνα 	3.10.0-962.3.2.lve1.5.28.el7.x86_64

from error_log file

Code: Select all

[25-Mar-2020 19:50:07 Europe/Athens] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /home/listarxos/public_html/2/install/index.php:72
Stack trace:
#0 {main}
  thrown in /home/listarxos/public_html/2/install/index.php on line 72

from config.php file
$domain = '';

// Database Configuration
$_db['host'] = 'localhost';
$_db['user'] = 'listarxos_admin';
$_db['pass'] = '***********';
$_db['name'] = 'listarxos_33';

$db = new mysqli($_db['host'], $_db['user'], $_db['pass'], $_db['name']) or die('MySQL Error');


from index.php file

// Condor5 Installer v1.0
function checkPHPVersion() {
$version = phpversion();
if($version >= 5.3) {
return '<span class="label label-success">'.$version.'</span>';
} else {
return '<span class="label label-danger">'.$version.'</span>';
function checkMySQLi() {
if(function_exists('mysqli_connect')) {
return '<span class="label label-success">Yes</span>';
} else {
return '<span class="label label-danger">No</span>';
function checkModRewrite() {
if(in_array('mod_rewrite', apache_get_modules())) {
return '<span class="label label-success">Yes</span>';
} else {
return '<span class="label label-danger">No</span>';
function checkShortTag() {
if(ini_get('short_open_tag')) {
return '<span class="label label-success">Yes</span>';
} else {
return '<span class="label label-danger">No</span>';
function checkHtaccess() {
if(file_exists('../.htaccess')) {
return '<span class="label label-success">Yes</span>';
} else {
return '<span class="label label-danger">No</span>';
function checkIsWritable() {
if(is_writable('../core')) {
return '<span class="label label-success">Yes</span>';
} else {
return '<span class="label label-danger">No</span>';
if(isset($_POST['install'])) {
$config_path = '../core/config.php';
$website_name = $_POST['website_name'];
$website_domain = $_POST['website_domain'];
$mysql_db_host = $_POST['mysql_host'];
$mysql_db_user = $_POST['mysql_db_user'];
$mysql_db_pass= $_POST['mysql_db_pass'];
$mysql_db_name = $_POST['mysql_db_name'];
$filename = 'db.sql';
$config_contents = "<?php
\$domain = '".$website_domain."';

// Database Configuration
\$_db['host'] = '".$mysql_db_host."';
\$_db['user'] = '".$mysql_db_user."';
\$_db['pass'] = '".$mysql_db_pass."';
\$_db['name'] = '".$mysql_db_name."';

\$db = new mysqli(\$_db['host'], \$_db['user'], \$_db['pass'], \$_db['name']) or die('MySQL Error');

fopen($config_path, 'w+');
file_put_contents($config_path, $config_contents);

// Connect to MySQL server
mysql_connect($mysql_db_host, $mysql_db_user, $mysql_db_pass) or die('Error connecting to MySQL server: ' . mysql_error());
// Select database
mysql_select_db($mysql_db_name) or die('Error selecting MySQL database: ' . mysql_error());

// Temporary variable, used to store current query
$templine = '';
// Read in entire file
$lines = file($filename);
// Loop through each line
foreach ($lines as $line)
// Skip it if it's a comment
if (substr($line, 0, 2) == '--' || $line == '')

// Add this line to the current segment
$templine .= $line;
// If it has a semicolon at the end, it's the end of the query
if (substr(trim($line), -1, 1) == ';')
// Perform the query
mysql_query($templine) or print('Error performing query \'<strong>' . $templine . '\': ' . mysql_error() . '<br /><br />');
// Reset temp variable to empty
$templine = '';
fopen('install.lock', 'w+');
header('Location: ../index.php');
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->

<meta charset="utf-8">
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport'>
<meta name="viewport" content="width=device-width" />
<title> Condor5 Installer </title>
<!-- Plugins -->
<link href="../assets/bootstrap3/css/bootstrap.css" rel="stylesheet">
<link href=" ... 00,400,700" rel="stylesheet">
<!-- Main CSS -->
<link href="installer.css" rel="stylesheet">
<div class="container">
<div class="col-lg-12 well">
<div class="col-lg-7 pull-left">
<h2> Condor5 Installer </h2>
<div class="col-lg-8 pull-left">
<form action="" method="post">
<div class="form-group">
<label> Website domain </label>
<input type="text" name="website_domain" placeholder="e." class="form-control">
<div class="form-group">
<label> MySQL database host </label>
<input type="text" name="mysql_db_host" placeholder="e.g localhost" class="form-control">
<div class="form-group">
<label> MySQL database user </label>
<input type="text" name="mysql_db_user" class="form-control">
<div class="form-group">
<label> MySQL database password </label>
<input type="text" name="mysql_db_pass" class="form-control">
<div class="form-group">
<label> MySQL database name </label>
<input type="text" name="mysql_db_name" class="form-control">
<button type="submit" name="install" class="btn btn-success btn-lg btn-block"> Install Script </button>
<div class="col-lg-3 pull-right">
<h3> Requirements </h3>
<p class="rq"> PHP Version: <?=checkPHPVersion()?> </p>
<p class="rq"> MySQLi extension: <?=checkMySQLi()?> </p>
<p class="rq"> mod_rewrite module: <?=checkModRewrite()?> </p>
<p class="rq"> short_open_tag: <?=checkShortTag()?> </p>
<p class="rq"> .htaccess: <?=checkHtaccess()?> </p>
<p class="rq"> CHMOD 755 /core/ folder: <?=checkIsWritable()?> </p>
<b class="help-block" style="width:300px;"> Having issues? Open a <a href="" target="_blank" class="text-success"> support ticket </a> </b>
User avatar
php-forum GURU
php-forum GURU
Posts: 1190
Joined: Mon Feb 22, 2016 5:52 pm

Thu Mar 26, 2020 10:02 am

mysql_connect is no longer available from PHP version 7, the preferred connection method is PDO
Post Reply