phpwcms on php 5.2.6 to mysql db ver5.6 no working

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
kalleonu
Posts: 4
Joined: Fri 1. Dec 2017, 06:49

phpwcms on php 5.2.6 to mysql db ver5.6 no working

Post by kalleonu »

Hi,
i moved database to mysql ver 5.6, and site not working after that, also not working with mysql v 5.0, and 5.1. What could be problem?
User avatar
Oliver Georgi
Site Admin
Posts: 9888
Joined: Fri 3. Oct 2003, 22:22
Contact:

Re: phpwcms on php 5.2.6 to mysql db ver5.6 no working

Post by Oliver Georgi »

The problem can be that your database is using SQL mode like STRICT_TRANS_TABLES. See what is the default in 5.6
https://dev.mysql.com/doc/refman/5.6/en/sql-mode.html

I don't know which version of phpwcms you are using.

Check the file include/inc_lib/dbcon.inc.php. If there is a function _dbInitialize() then extend it like this:

Code: Select all

function _dbInitialize() {

	global $phpwcms;
       
	// Set SQL mode
	_dbQuery("SET SESSION sql_mode='NO_ENGINE_SUBSTITUTION'", 'SET');

	// check if mysql version is set
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
kalleonu
Posts: 4
Joined: Fri 1. Dec 2017, 06:49

Re: phpwcms on php 5.2.6 to mysql db ver5.6 no working

Post by kalleonu »

i'm using version Release 1.1-RC4 27-08-2004, its very old and have no folder: "in_lib"
User avatar
Oliver Georgi
Site Admin
Posts: 9888
Joined: Fri 3. Oct 2003, 22:22
Contact:

Re: phpwcms on php 5.2.6 to mysql db ver5.6 no working

Post by Oliver Georgi »

Yeah, sorry, it is inc_lib.

In your case check include/inc_lib/default.inc.php.

At the beginning of that file around line 29 there is a line like this:

Code: Select all

mysql_select_db($phpwcms["db_table"],$db) or die("Error while trying to connect to table \"".$phpwcms["db_table"]."\"");
Add the following line of code behind:

Code: Select all

mysql_query("SET SESSION sql_mode='NO_ENGINE_SUBSTITUTION'", $db);
If this does not help check this: viewtopic.php?f=13&t=20949
Maybe your dates ran out of time.
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
kalleonu
Posts: 4
Joined: Fri 1. Dec 2017, 06:49

Re: phpwcms on php 5.2.6 to mysql db ver5.6 no working

Post by kalleonu »

Hi, my default.inc.php file is here.

Code: Select all

<?php
/*************************************************************************************
   Copyright notice
   
   (c) 2002-2004 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
 
   This script is part of PHPWCMS. The PHPWCMS web content management system 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.
  
   The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
   A copy is found in the textfile GPL.txt and important notices to the license 
   from the author is found in LICENSE.txt distributed with these scripts.
  
   This script 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.
 
   This copyright notice MUST APPEAR in all copies of the script!
*************************************************************************************/

// build the database table prepend part
define ("DB_PREPEND", ($phpwcms["db_prepend"]) ? $phpwcms["db_prepend"]."_" : "");

// define the real path of the phpwcms installation
// important to script that must know the real path to files or something else
define ("PHPWCMS_ROOT", preg_replace('/\/$/', '', $_SERVER['DOCUMENT_ROOT']).(($phpwcms["root"]) ? "/".$phpwcms["root"] : "") );   // DOCUMENT_ROOT + phpwcms directory

$phpwcms["root"]		 = ($phpwcms["root"]) ? $phpwcms["root"]."/" : "";

$phpwcms["file_path"]    = "/".$phpwcms["file_path"]."/" ;  // "/phpwcms_filestorage/"
$phpwcms["file_tmp"]     = $phpwcms["file_tmp"]."/"      ;  // "phpwcms_tmp/"
$phpwcms["templates"]    = "/".$phpwcms["templates"]."/" ;  // "/phpwcms_template/"
$phpwcms["dir_thlist"]   = $phpwcms["dir_thlist"]."/"    ;  // "thumb_list/"
$phpwcms["dir_preview"]  = $phpwcms["dir_preview"]."/"   ;  // "thumb_preview/"
$phpwcms["content_path"] = $phpwcms["content_path"]."/"  ;  // "content/"
$phpwcms["cimage_path"]  = $phpwcms["cimage_path"]."/"   ;  // "images/"
$phpwcms["ftp_path"]     = "/".$phpwcms["ftp_path"]."/"  ;  // "/phpwcms_ftp/"

define ('PHPWCMS_TEMPLATE', PHPWCMS_ROOT.$phpwcms["templates"]);

// check which function should be used to create thumbnail images
// and if ImageMagick check if enabled or 1 or located at give path
if($phpwcms["imagick_path"]) {
	$phpwcms["imagick_path"] = $phpwcms["imagick_path"].'/';
	$phpwcms["imagick_path"] = str_replace("\\", "/", $phpwcms["imagick_path"]);
	$phpwcms["imagick_path"] = str_replace("//", "/", $phpwcms["imagick_path"]);
	define ("IMAGICK_PATH", $phpwcms["imagick_path"]);
} else {
	define ("IMAGICK_PATH", "");
}
define ("IMAGICK_ON", intval($phpwcms["imagick"]));
define ("GD2_ON", intval($phpwcms["use_gd2"]));
define ("PHPWCMS_CHARSET", (($phpwcms["charset"]) ? $phpwcms["charset"] : "iso-8859-1"));

if(!$phpwcms['SMTP_MAILER']) $phpwcms['SMTP_MAILER'] = 'mail';
if(!$phpwcms['SMTP_FROM_EMAIL']) $phpwcms['SMTP_FROM_EMAIL'] = $phpwcms["admin_email"];


// open the connection to MySQL database

$is_mysql_error = 0;

if($phpwcms["db_pers"] == 1) {
	$db = @mysql_pconnect($phpwcms["db_host"], $phpwcms["db_user"], $phpwcms["db_pass"]) or ($is_mysql_error = 1);
} else {
	$db = @mysql_connect($phpwcms["db_host"], $phpwcms["db_user"], $phpwcms["db_pass"]) or ($is_mysql_error = 1);
}

@mysql_select_db($phpwcms["db_table"],$db) or ($is_mysql_error = 1);

if($is_mysql_error) {
	header('Location: '.$phpwcms['site'].$phpwcms['root'].'dbdown.php');
	exit();
}


$phpwcms["version"] = "1.1-RC4 27-08-2004";

?>
Also i want to mention that, my site menus are lost, but i can still log in to management console.
User avatar
Oliver Georgi
Site Admin
Posts: 9888
Joined: Fri 3. Oct 2003, 22:22
Contact:

Re: phpwcms on php 5.2.6 to mysql db ver5.6 no working

Post by Oliver Georgi »

Place it before the closing ?>

But if your site shows something /template) but no other content then it might be the date problem. Check and fix your dates in too.
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
kalleonu
Posts: 4
Joined: Fri 1. Dec 2017, 06:49

Re: phpwcms on php 5.2.6 to mysql db ver5.6 no working

Post by kalleonu »

No luck with:

Code: Select all

mysql_query("SET SESSION sql_mode='NO_ENGINE_SUBSTITUTION'", $db);
Also I noticed, that part of page is loaded, until cahracters: ä ö ü etc then stops?
I.e page header should be "Marepleks | Tööpakkumised | Tööpakkumised", but when i swtich to sql 5.6, then it shows only "Marepleks |T |T"
I think, it could be some problem with encoding when i moved from one database to newer database
User avatar
Oliver Georgi
Site Admin
Posts: 9888
Joined: Fri 3. Oct 2003, 22:22
Contact:

Re: phpwcms on php 5.2.6 to mysql db ver5.6 no working

Post by Oliver Georgi »

Yes you have made mistakes when moving database. Do not change charset or encoding. The old one was latin1 always. Keep it latin1 on export and re-import into db with latin1. Do not use phpMyAdmin for this. I can recommend Adminer for this or connect directly using Sequel Pro (Mac) or HeidiSQL (Windows). I cannot recommend the mysqldump way.

When you have created the new database at the new MySQL server change its charset to latin1 before importing.
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
Post Reply