Need help migrating phpshop to PHP5.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
krishep
Forum Newbie
Posts: 2
Joined: Tue Jul 24, 2007 12:53 pm

Need help migrating phpshop to PHP5.

Post by krishep »

I have a site running a customization of phpshop (v 0.6.2) from 2003. The client has suddenly decided
to upgrade the server to php 5.1.6 (apache 2.2.2) and the app no longer works. It was running on php 4.4.0.

The urls are also being rewritten with the session id that the module loading is not working. If you are not familiar with phpshop, the index.php acts as a controller loading various modules and delegating the request to them

With the upgrade the url is being rewritten with the session id as the first param

http://localhost/?SESSION_ID=880a04093e ... endor_id=1

but as you can see it gets messed up with the second question mark and i believe phpshop chokes on this.

I have tried setting every param I can think of to prevent the session id in the url but it doesn't seem to work. These are the params I set.

register_globals = On
session.use_trans_sid = 0
session.use_only_cookies = 1
url_rewriter.tags = ""
register_long_arrays = On
session.bug_compat_42 = 1
session.cookie_domain =thedomain.com

How can I get rid of the session id's from the URL once and for all?

Is there a known workaround for phpshop in php5, eg a new session class? or a fork or something that could help. It took me all day to reproduce the server environment. Its a biatch to get php 5.1.6 on Apache 2.2.2. I know this won't be the last of my problems and I only have a day to get this working

Thx in advance for any input.
cheers
Krish
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.
Thanks. I posted that at 4am .. :)
Last edited by krishep on Tue Jul 24, 2007 9:58 pm, edited 1 time in total.
User avatar
Gente
Forum Contributor
Posts: 252
Joined: Wed Jun 13, 2007 9:43 am
Location: Ukraine, Kharkov
Contact:

Post by Gente »

Try this:

Code: Select all

ini_set('session.use_trans_sid', 1);
	if (ini_set('url_rewriter.tags', '') === false)
	{
		output_reset_rewrite_vars();
	}
	session_start();
krishep
Forum Newbie
Posts: 2
Joined: Tue Jul 24, 2007 12:53 pm

Fix for preventing session ids in urls

Post by krishep »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Thanks for your input. This problem was in the code. Here is a quick fix. This only fixes the url. I am sure there are other php5 related issues in phpshop

find phpshop/modules/main/lib/ps_session.inc

Code: Select all

function url($text) {

	return $text;															   
	/*
	Brute force fix here to prevent appending session id to url    
		global $HTTP_COOKIE_VARS, $HTTP_HOST;
	
		// If we have the session cookie set and the url
		// to link is in the same domain this page is,
		// then no session id is needed int the url so
		// we return the text as is.
		// Else append the session id.
	
		if ( $HTTP_COOKIE_VARS[session_name()]
		   and strpos( $text, $HTTP_HOST ) )
		  return $text;
		else 
		  return $this->sid_url($text);
		  
	*/	  
  }

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Post Reply