Solution for: SEO / SEF not working at PHP 5.0.4

Discuss Search Engine Optimization in relation to Joomla!. This forum will also have discussions on SEF/SEO Joomla! extensions.

Moderator: General Support Moderators

Locked
NicP
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Wed Jan 23, 2008 12:53 pm

Solution for: SEO / SEF not working at PHP 5.0.4

Post by NicP » Tue Jun 10, 2008 2:43 pm

Hi,

I have just spent ages trying to find out why SEF was not working on a site I'm working on. It works OK on my local server and on a staging server, but not on the clients server.

I put so much debug code in to find out what was going on but have now got it working. It seems to be a PHP bug. The JURI class users the php function parse_url to split up the url into component parts. in php 5.1 this seems fine but php 5.0.4 it produces a completely wrong answer. So the esiest solution is to change the following code

Code: Select all

	function _parseURL($uri)
	{
		$parts = array();
		if (version_compare( phpversion(), '8.4' ) < 0) // np-007 was 4.4
		{
this is about line 719 in /libraries/joomla/environment/uri.php

I hope this helps someone.
Last edited by humvee on Tue Jul 22, 2008 3:24 pm, edited 2 times in total.
Reason: Title changed to reflect the message

User avatar
pe7er
Joomla! Master
Joomla! Master
Posts: 24986
Joined: Thu Aug 18, 2005 8:55 pm
Location: Nijmegen, Netherlands
Contact:

Re: Solution for: SEO / SEF not working at PHP 5.0.4

Post by pe7er » Tue Jun 10, 2008 4:06 pm

Thank you for sharing this info!
I'm sure that other users with the same problem will benefit from your solution!
Kind Regards,
Peter Martin, Global Moderator
Company website: https://db8.nl/en/ - Joomla specialist, Nijmegen, Netherlands
The best website: https://the-best-website.com

ndserra
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Wed Jun 18, 2008 1:31 pm

Re: Solution for: SEO / SEF not working at PHP 5.0.4

Post by ndserra » Mon Jun 23, 2008 2:12 am

Master NicP,
I really dont have words to express how much that information was precious to me.

Is that kind of atitude that makes life so beautifull !!!! :D

I was desperated with that issue and you came to save my skin ...

The most important thing is that i have no more to upgrade my entirely server with almost 50 domains in use to fix this issue to only ONE especific case.

I will be eternally gracefull to you because of this.

YOU ARE A GOOD SOUL !!!!

thanks again and have sure you made a new friend.

Thank you again.

User avatar
humvee
Joomla! Master
Joomla! Master
Posts: 14704
Joined: Wed Aug 17, 2005 10:27 pm
Location: Kent, England

Re: Solution for: SEO / SEF not working at PHP 5.0.4

Post by humvee » Mon Jun 23, 2008 10:41 am

Reported to Joomla! Bug Squad for clarification

User avatar
ircmaxell
Joomla! Ace
Joomla! Ace
Posts: 1926
Joined: Thu Nov 10, 2005 3:10 am
Location: New Jersey, USA
Contact:

Re: Solution for: SEO / SEF not working at PHP 5.0.4

Post by ircmaxell » Mon Jun 23, 2008 11:43 am

Very simple, php 5.0.4 is not supported. That version_compare is done for a reason. The way php 5+ does it is significantly faster than the regular expression.

In short, this will not be added in, as 5.0.4 is not supported (for more than just SEO reasons. If you chose to use it on 5.0.4, be advised that you may experience some extremely bad/unwanted behavior)..

http://help.joomla.org/content/view/1938/310/
Anthony Ferrara - Core Team - Development Coordinator - Bug Squad - JSST

http://moovum.com/ - The Bird is in the air! Get Mollom Anti-Spam on your Joomla! website with Moovur...
http://www.joomlaperformance.com For All Your Joomla Performance Needs

jilusan2
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Thu Jul 03, 2008 12:15 pm

Re: Solution for: SEO / SEF not working at PHP 5.0.4

Post by jilusan2 » Mon Jul 14, 2008 4:54 pm

Unhopefully, i have php5.0.4.

I have VPS with 1and1, and they dont want to give me the support for upgrading my php.

What to do?

Is it easy to upgrade php version???

Tx.

Jilu

happybunny
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Fri Jul 18, 2008 1:24 pm

Re: Solution for: SEO / SEF not working at PHP 5.0.4

Post by happybunny » Mon Jul 21, 2008 4:24 pm

I have made the code change, and it "seems" to work with php 5.0.4 & joomla 1.5.4

1) Has anyone found any problem with joomla 1.5.x and 5.0.4 with this fix in place?
2) Has anyone found a way of updating the php version in a 1&! root server with FC4? Doing a "yum update" doesnt do anything (as the conf file points to 1&1 update servers). If you point yum at real update servers, I have a horrible feeling that updating php will break php and/or plesk. Anyone tried it? I cant re-image the server with the latest centos (which comes with php 5.2.x) as there are about 50 domains on it.

Simon.

rippleminder
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Wed Jul 02, 2008 5:23 am

Re: Solution for: SEO / SEF not working at PHP 5.0.4

Post by rippleminder » Tue Jul 22, 2008 3:25 am

yes i replaced '4.4' with '8.4' in uri.php and now the urls appear to work OK, joomla 1.5.4 on php 5.0.4.

for an example see

Code: Select all

http://www.redriverroughstock.com/index.php?option=com_content&view=category&id=47&Itemid=68
note: i have not done a lot of testing.

my website is rather simple-minded.

User avatar
brad
Joomla! Master
Joomla! Master
Posts: 13272
Joined: Fri Aug 12, 2005 12:38 am
Location: Australia
Contact:

Re: Solution for: SEO / SEF not working at PHP 5.0.4

Post by brad » Tue Jul 22, 2008 5:42 am

BTW, you should probably now, after all that effort, keep php up to date. The latest is 5.2.6

natashatr
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Tue Jul 22, 2008 1:57 pm

Re: Solution for: SEO / SEF not working at PHP 5.0.4

Post by natashatr » Tue Jul 22, 2008 2:16 pm

I've just registered to say THANK YOU!

Actually in Joomla 15.0.4 it is the line #722. I recommend using this variant in respect of PHP updates

Code: Select all

		if (version_compare( phpversion(), '4.4' ) < 0 OR version_compare( phpversion(), '5.0.4' ) == 0 )


Bug report for developers:

When running Apache/2.0.54 (Win32) PHP/5.0.4 Server, Joomla produces incorrect URLs appearing in various modules: Latest news, Popular and Read more link in an article.

With the all options set by default the URLs appear like that:

Code: Select all

http://mysite.com/content-layouts&catid=29:the-cms&Itemid=38?option=com_content&view=article&id=5&Itemid=2
and they cannot be handled even with the mod rewrite active.


Affected:
Joomla 1.5.2
Joomla 1.5.4

Not affected:
Joomla 1.0.x
Joomla 1.5.x (early betas not for production sites)

natashatr
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Tue Jul 22, 2008 1:57 pm

Re: Solution for: SEO / SEF not working at PHP 5.0.4

Post by natashatr » Tue Jul 22, 2008 2:46 pm

happybunny wrote:I have made the code change, and it "seems" to work with php 5.0.4 & joomla 1.5.4

1) Has anyone found any problem with joomla 1.5.x and 5.0.4 with this fix in place?
Yes, the URLs will be incorrect if you enable Use Apache mod_rewrite in Joomla SEO settings.

User avatar
ircmaxell
Joomla! Ace
Joomla! Ace
Posts: 1926
Joined: Thu Nov 10, 2005 3:10 am
Location: New Jersey, USA
Contact:

Re: Solution for: SEO / SEF not working at PHP 5.0.4

Post by ircmaxell » Tue Jul 22, 2008 2:55 pm

Please note, the use php 5.0.4 with Joomla 1.5 is NOT SUPPORTED. I'm going to have a moderator lock this thread here. If you want to use Joomla! 1.5 on 5.0.4, go ahead, but be advised that you will not get any official support.

As we've stated MANY MANY times, there is a lot more than just URL's that are an issue with 5.0.4. It's HIGHLY recomended NOT to run 1.5 on that version. Basically, use at your own risk.
Anthony Ferrara - Core Team - Development Coordinator - Bug Squad - JSST

http://moovum.com/ - The Bird is in the air! Get Mollom Anti-Spam on your Joomla! website with Moovur...
http://www.joomlaperformance.com For All Your Joomla Performance Needs


Locked

Return to “Search Engine Optimization (Joomla! SEO) in Joomla! 1.5”