homepage Welcome to WebmasterWorld Guest from 54.224.53.192
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Move website to another hosting - issues
eXtremer



 
Msg#: 4689472 posted 11:33 am on Jul 21, 2014 (gmt 0)

Hello,

I'm trying to move a website to another hosting, but I get some errors, the website was build by someone I cannot reach anymore so I need to solve this issue by myself and of course with your help.
I think the issue is linked with the path of the files, but not 100% sure. If someone could help me solve my issue, I would really appreciate. Thank you.

This are the errors:
Deprecated: Assigning the return value of new by reference is deprecated in /home/vol7_5/byethost7.com/b7_15102602/va.likesyou.org/htdocs/__kernel/loader.php on line 80
Strict Standards: Declaration of php4DOMDocument::dump_node() should be compatible with php4DOMNode::dump_node() in /home/vol7_5/byethost7.com/b7_15102602/va.likesyou.org/htdocs/__kernel/domxml-php4-to-php5.php on line 1
Fatal error: Call to undefined function session_unregister() in /home/vol7_5/byethost7.com/b7_15102602/va.likesyou.org/htdocs/__kernel/cot.lib.php on line 64

loader.php:

<?PHP 
if(!session_id()) session_start();
$_SESSION['ERROR']=0;
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Expires: " . date("r", time()));
header("Content-type: text/html; charset=windows-1251");

// defining absolute path
// for hosting host.md
function LOADER_DOCUMENT_ROOT($path=false) {
if (!$path) { $path=preg_replace("/\\\\/","/",realpath(dirname(__FILE__))); }
$result=substr($path,-strlen($path),strpos($path,"public_html"))."public_html";
if ($result=="public_html") { $result=$_SERVER['DOCUMENT_ROOT']; }
return $result;
}

$HOST_MD_REAL_PATH=LOADER_DOCUMENT_ROOT();
include_once($HOST_MD_REAL_PATH."/__config/config.inc.php");
// check for the existence of settings.php
 $need_inst=false;
if (!file_exists($HOST_MD_REAL_PATH."/settings.php"))
{
 $need_inst=true;
}
if (@filesize($HOST_MD_REAL_PATH."/settings.php")===0)
{
  $need_inst=true;
}

if ($need_inst)
{
 $inst_txt="<html><head><meta http-equiv='Content-Type' content='text/html; charset=windows-1251'>";
 $inst_txt.="<title>COT.CMS Version 1.2 - Error: No configuration!</title>";
 $inst_txt.="<style>body{font: 84.5% Verdana, Arial, Helvetica, sans-serif;}</style></head><body>";
 $inst_txt.="

<center><strong>COT.CMS Version 1.2</strong>";
 $inst_txt.="

<font color='red'>Fatal error: no configuration.</font>
 Reinstall the system.
";
 echo $inst_txt; exit;
}

if (file_exists($HOST_MD_REAL_PATH."/install.php"))
{
 $inst_txt="<html><head><meta http-equiv='Content-Type' content='text/html; charset=windows-1251'>";
 $inst_txt.="<title>COT.CMS Version 1.2 - Installation is not completed!</title>";
 $inst_txt.="<style>body{font: 84.5% Verdana, Arial, Helvetica, sans-serif;}</style></head><body>";
 $inst_txt.="

<center><strong>COT.CMS Version 1.2</strong>";
 $inst_txt.="

<font color='red'>Installation is not complete! Delete the file install.php !</font>
";
 echo $inst_txt; exit; 
}

include_once($HOST_MD_REAL_PATH."/settings.php");

require_once($HOST_MD_REAL_PATH."/__lang/russian-win-1251_s.inc.php");

if (version_compare(PHP_VERSION,'5','>=')) 

require_once('domxml-php4-to-php5.php');

require_once("cot.lib.php");
require_once("kernel.lib.php");
require_once("writeresponse.php");

$XML=domxml_new_doc("1.0");
$Root=$XML->create_element($GLOBALS['cfg']['XML']['Root']);
$XML->append_child($Root);
foreach ($GLOBALS['mod'] as $key=>$value) 

if (!$value['status']) 

$inc_path=my_getAbsPath($value['Path']);
if ($inc_path) 

require_once($inc_path);

next($mod);

$DB=&;new MySQLClass();
$DB->openDB($GLOBALS['cfg']['MySQL']['host'],$GLOBALS['cfg']['MySQL']['user'],$GLOBALS['cfg']['MySQL']['password'],$GLOBALS['cfg']['MySQL']['database']);
if ($DB->err)
{
  _catch(1);
};
?>

cot.lib.php:

<?php 
function isNum($val)
{
(preg_match("/^\d+$/",$val)) ? $res=true:$res=false;return $res;
}
function c($str_value)
{
 return @iconv("windows-1251","UTF-8",$str_value);
}
function my_getAbsPath($path)
{
 return realpath($GLOBALS['cfg']['Server']['root'].$path);
}

function httpGet($var)
{
 if (isset($_GET[$var])) return trim($_GET[$var]);else return false;
}

function httpPost($var)
{
 if (isset($_POST[$var])) return trim($_POST[$var]);else return false;
}

function httpCookie() { }

function httpSess($var)
{
 if(isset($_SESSION[$var])) return $_SESSION[$var];else return false;
}

function mem_state($var,$sesvar)
{
 if ($var!="")
 {
  $_SESSION[$sesvar]=$var;
 }
 elseif (httpSess($sesvar)!="")
 {
  $var=httpSess($sesvar);
 }
 else
 {
  $_SESSION[$sesvar]="";
 }
 return $var;
}

function clearSess()
{
 if(!session_id()) session_start();
 $_SESSION=array();
 if (isset($_COOKIE[session_name()])) setcookie(session_name(),'',time()-42000,'/');
 session_destroy();
}

function _catch($flag=0)
{
 $ret=0;
 ($flag)?$sessname="_ERROR_":$sessname="_MESSAGE_";
 if (httpSess($sessname))
 {
  $ret=httpSess($sessname);
  session_unregister($sessname);
  unset($_SESSION[$sessname]);
  unset($sessname);
 }
 return $ret;
}

function _throw($code=0,$flag=0)
{
($flag)?$sessname="_ERROR_":$sessname="_MESSAGE_";
$_SESSION[$sessname]=$code;
}

function getRandomStringN($numchars=8)
{
 $ret="";
 $a ="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
 for($i=0;$i<$numchars;$i++) $ret.=substr($a,rand(0,strlen($a)),1);
 return $ret;
}

function getRandomString()
{
 return md5(microtime().rand());
}
//date from the database comes as timestamp, returns an array with the date
function dateFromBase($date)
{
 $ret['year']=date("Y",$date);
 $ret['month']=date("m",$date);
 $ret['day']=date("d",$date);
 $ret['hour']=date("H",$date);
 $ret['minute']=date("i",$date);
 $ret["second"]=date("s",$date);
 return $ret;
}
//comes an array, returns the timestamp
function date2Base($date)
{
 $ret=time();
 if (is_array($date))
 {
  $date['year']=(key_exists('year',$date))?$date['year']:date("Y");
  $date['month']=(key_exists('month',$date))?$date['month']:date("m");
  $date['day']=(key_exists('day',$date))?$date['day']:date("d");
  $date['hour']=(key_exists('hour',$date))?$date['hour']:date("H");
  $date['minute']=(key_exists('minute',$date))?$date['minute']:date("i");
  $date['second']=(key_exists('second',$date))?$date['second']:date("s");
  $ret=date("U",mktime($date['hour'],$date['minute'],$date['second'],$date['month'],$date['day'],$date['year']));
 }
 return $ret;
}
//check the array with the date
function checkDateArr($formDate)
{
 $formDate['year']=(isNum($formDate['year']))?$formDate['year']:date('Y');
 $formDate['month']=(isNum($formDate['month']))?$formDate['month']:date('m');
 $formDate['day']=(isNum($formDate['day']))?$formDate['day']:date('d');
 $formDate['hour']=(isNum($formDate['hour']))?$formDate['hour']:date('H');
 $formDate['minute']=(isNum($formDate['minute']))?$formDate['minute']:date('i');
 return $formDate;
}
?>

[edited by: coopster at 12:13 pm (utc) on Jul 23, 2014]
[edit reason] Removed links, please read Forum Charter before posting [/edit]

 

penders

WebmasterWorld Senior Member penders us a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



 
Msg#: 4689472 posted 6:26 pm on Jul 21, 2014 (gmt 0)

Looks like your script was primarily written for PHP 4, and you are now running on PHP 5.4+.

I think the issue is linked with the path of the files


Not from the errors you have posted.

TBH the "Deprecated" and "Strict Standards" notices could probably be hidden by changing the error_reporting() level. Although best not to.

To get the ball rolling...

Deprecated: Assigning the return value of new by reference is deprecated


$DB=&;new MySQLClass();


(That ";" (semi-colon) in the middle of the statement should not be there regardless of what version of PHP you are running.) But, exactly as the message states, no need to assign by reference in PHP 5.... This should be:

$DB = new MySQLClass();
penders

WebmasterWorld Senior Member penders us a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



 
Msg#: 4689472 posted 6:43 pm on Jul 21, 2014 (gmt 0)

Strict Standards: Declaration of php4DOMDocument::dump_node() should be compatible with php4DOMNode::dump_node() in /home/vol7_5/byethost7.com/b7_15102602/va.likesyou.org/htdocs/__kernel/domxml-php4-to-php5.php on line 1


You'll need to check the method declarations of these two methods in "domxml-php4-to-php5.php". Presumably php4DOMDocument extends php4DOMNode?

Fatal error: Call to undefined function session_unregister()


$ret=httpSess($sessname);
session_unregister($sessname); /* DELETE THIS LINE! */
unset($_SESSION[$sessname]);
unset($sessname);


I'm pretty sure you can just delete that line. I assume you are not using
session_register() anywhere?
lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4689472 posted 8:36 pm on Jul 21, 2014 (gmt 0)

Does your colorful first post at some point say which version of php the respective sites are using? Most hosts will let you pick from a few options, but there's always a default.

if (version_compare(PHP_VERSION,'5','>='))

Oh, lord, how that reminds me of the boilerplate CMS htaccess that says <IfModule blahblah ... even if the program simply can't run at all if the relevant module isn't there. Find out what version you're actually using, and code for that.

penders

WebmasterWorld Senior Member penders us a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



 
Msg#: 4689472 posted 9:37 pm on Jul 21, 2014 (gmt 0)

COT.CMS Version 1.2


Just curious... what is this? Is there perhaps a later version?

eXtremer



 
Msg#: 4689472 posted 5:41 am on Jul 22, 2014 (gmt 0)

Thank you guys for posting.
I removed the "&" from $DB=&new MySQLClass(); now the error went away.

Then I removed this line "session_unregister($sessname);", but now I get another error:

Fatal error: Incompatible file format: The encoded file has format major ID 3, whereas the Loader expects 5 in /home/vol7_5/byethost7.com/b7_15102602/va.likesyou.org/htdocs/code/code.php on line 0

Thank you in advance.

[edited by: coopster at 12:14 pm (utc) on Jul 23, 2014]
[edit reason] Removed links, please read Forum Charter before posting [/edit]

eXtremer



 
Msg#: 4689472 posted 5:43 am on Jul 22, 2014 (gmt 0)

About the "COT.CMS Version 1.2", I can't find any info about this, I thnik the developer just named as he wanted.

eXtremer



 
Msg#: 4689472 posted 5:51 am on Jul 22, 2014 (gmt 0)

About php version, I know that the OLD (current) hosting has upgraded to PHP 5.5 last year in December as the news says. But as I see the hosting still supports version 4 or I don't know but the website is working fine and I can't move to another hosting until I know it will work there.

penders

WebmasterWorld Senior Member penders us a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



 
Msg#: 4689472 posted 9:57 am on Jul 22, 2014 (gmt 0)

Here is what domxml-php4-to-php5.php looks like...


Ouch - a minified code dump!

Strict Standards: Declaration of php4DOMDocument::dump_node() should be compatible with php4DOMNode::dump_node()


WARNING: THIS IS A HACK! ... To mask this message you can make the parameter in php4DOMDocument::dump_node() optional in order to make it compatible with the parent method (which doesn't have a parameter at all - this is bad OOP btw)..

Change this:

function dump_node($node) {return $this->myDOMNode->saveXML($node->myDOMNode);}


To this...

function dump_node($node=null) {return $this->myDOMNode->saveXML($node->myDOMNode);}


This suppresses the compiler message, however, it's not good. (If the optional argument is ever omitted in the method call then the compiler won't pick it up and you'll get a fatal runtime error instead.)

To make this more OOP you can probably change it to...

function dump_node($node=null) {
if (isset($node)) {
return $this->myDOMNode->saveXML($node->myDOMNode);
}
return parent::dump_node();
}



Fatal error: Incompatible file format: The encoded file has format major ID 3, whereas the Loader expects 5 in


(Just to be sure... this file is uploaded in binary - yes?)

Unfortunately this looks tricky and I don't know enough about this to proceed further. It looks like the code is protected by Zend Guard (an old version of). It would seem that it needs to be decoded (which you may only be able to do on the old server?) and recoded using the new version. Or get an updated version from the developer!? Something called "ionCube" might also help (but maybe not on PHP 5.4)?!

eXtremer



 
Msg#: 4689472 posted 11:45 am on Jul 22, 2014 (gmt 0)

Thank you penders, I've changed the code to: function dump_node($node=null) {return $this->myDOMNode->saveXML($node->myDOMNode);}

...and now the error is gone.

The Only error remaining is:
Fatal error: Call to undefined function session_unregister() in /home/vol7_5/byethost7.com/b7_15102602/va.likesyou.org/htdocs/__kernel/cot.lib.php on line 64

If I remove the line: session_unregister($sessname); then I get another error.

My question is. with all of the errors removed the website will be visible or not? cose now I see only the errors no content at all.

penders

WebmasterWorld Senior Member penders us a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



 
Msg#: 4689472 posted 2:50 pm on Jul 22, 2014 (gmt 0)

The Only error remaining is:
Fatal error: Call to undefined function session_unregister() in ...


You need to remove that function call - as mentioned above - that line is the cause of that one error. (The function "session_unregister()" was deprecated in PHP 5.3 and removed completely in PHP 5.4 - which is why I think you are running PHP 5.4)

The problem is that that is not "the only error"...

If I remove the line: session_unregister($sessname); then I get another error.


Yes, and unfortunately this is likely to happen again and again and again...

When the compiler reports a "fatal error" it halts compilation immediately as it is simply unable to continue (it was after all "fatal"). When you fix one fatal error it is able to compile a bit more until... it reaches another fatal error, which is what is happening here.

with all of the errors removed the website will be visible or not?


In theory yes; in reality this in unknown. You should be able to see something, but whether it is working as intended is another matter. Some parts of the code may require rewriting.

Fatal error: Incompatible file format: The encoded file has format major ID 3, whereas the Loader expects 5 in


However, your last error is a serious one! In fact, this warrants a thread all to itself in my opinion. This isn't a "simple" PHP error. This is an error that has resulted from the system configuration. As I understand it, Zend Guard is a tool for protecting PHP code - it prevents tampering and illegal distribution by distributing an encoded bytecode version of the code only (there is no PHP "source code"!). Software on the server (Zend Optimizer in earlier versions of PHP and Zend Guard Loader since PHP 5.3) is required in order to run it. Your code is requesting Zend Optimizer, which is not available on PHP 5.3+. And "I don't think" Zend Guard Loader will be able to decode an earlier version (which I think is the error you are getting). To be honest, even if you were able to decode this, I'm not convinced it would run without modification? As it's potentially PHP 4 code on a PHP 5.4 server!? (Thanks to Leosghost for some tips with this.)

not2easy

WebmasterWorld Administrator 5+ Year Member Top Contributors Of The Month



 
Msg#: 4689472 posted 3:34 pm on Jul 22, 2014 (gmt 0)

Some hosts offer you a choice of versions to choose from for php. If you aren't comfortable making a change like that yourself, contact the host for help.

Note: - I'm not saying this will fix coding issues like penders is suggesting you should address.

penders

WebmasterWorld Senior Member penders us a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



 
Msg#: 4689472 posted 8:52 pm on Jul 22, 2014 (gmt 0)

Some hosts offer you a choice of versions to choose from for php.


I would perhaps try PHP 5.2 first.

IvoryoBertie



 
Msg#: 4689472 posted 9:04 am on Jul 23, 2014 (gmt 0)

Yes, I encounter the same problem some time back and I manage to solve it by trying out PHP 5.2 version, well , strange but, it work!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved