| Author |
Message |
BobMarion Former Admin in Good Standing

Joined: Oct 30, 2002 Posts: 1043 Location: RedNeck Land (known as Kentucky)
|
Posted:
Sun Dec 05, 2004 11:51 pm |
|
While we were building NukeSentinel 1.0 Raven and I talked about speed for and using stristr where ever possible instead of eregi. Well open every one of your block files and you will see a line like: | Code: | | if (!eregi("modules.php", $_SERVER['PHP_SELF'])) { |
Now take those lines and change them to: | Code: | | if (!stristr($_SERVER['PHP_SELF'], "modules.php")) { |
On NukeScripts this (from the blocks being changed) account for a .7 sec speed increase on the load time. I talked to Raven about earlier today and told him to give it a try and he loved the speed increase.
Now, if ChatServ reads this I hope he does this in his 2.8 patch, I don't care if he mentions it came from here or there but this would go a long way to bringing PHP-Nuke back into line
I'll be updating all of the PHP-Nuke downloads on my site to reflect this change in all files that use that type of line as well as on my own site its self. |
|
|
|
 |
chatserv The Mouse Is Extension Of Arm

Joined: May 02, 2003 Posts: 1396 Location: Puerto Rico
|
Posted:
Mon Dec 06, 2004 1:32 pm |
|
2.8 patch?  |
|
|
|
 |
sixonetonoffun Spouse Contemplates Divorce

Joined: Jan 02, 2003 Posts: 2499
|
Posted:
Mon Dec 06, 2004 1:36 pm |
|
Pretty big undertaking I was checking what it would take to completely convert osc2nuke74x this way and decided I'd wait and see if they did it in a future release. |
|
|
|
 |
Mesum Useless

Joined: Aug 23, 2002 Posts: 213 Location: Chicago
|
Posted:
Mon Dec 06, 2004 2:02 pm |
|
Bob, by any chance, you use "Speedup Hacks" by DJMaze and Steve, post a while ago? |
|
|
|
 |
BobMarion Former Admin in Good Standing

Joined: Oct 30, 2002 Posts: 1043 Location: RedNeck Land (known as Kentucky)
|
Posted:
Thu Dec 09, 2004 12:44 am |
|
No, I keep meaning to add those but never get around to it DJMaze gave me permission to use them though. |
|
|
|
 |
Mesum Useless

Joined: Aug 23, 2002 Posts: 213 Location: Chicago
|
Posted:
Thu Dec 09, 2004 7:33 am |
|
I asked this question because I noticed a major slow down in forums if it's a busy website, maybe there is a glitch in the code and then was corrected later on by the CPG staff. |
|
|
|
 |
RTS-Bone New Member


Joined: Jun 20, 2004 Posts: 9
|
Posted:
Wed Feb 23, 2005 3:25 pm |
|
What about if we have | Code: | | if (eregi("block-Welcome.php",$PHP_SELF)) { | instead ?
Theres no "!" before eregi... |
|
|
|
 |
MarkyBear Hangin' Around

Joined: Mar 27, 2005 Posts: 39
|
Posted:
Sun Jul 10, 2005 6:35 pm |
|
I have a quick question about this, for the lines that read:
| Code: | | if (!eregi("modules.php", $PHP_SELF)) { |
Would I change them to?:
| Code: | | if (!stristr($_SERVER['PHP_SELF'], "modules.php")) { |
Thanks in advance for whomevers time and any help given! |
|
|
|
 |
kguske Site Admin

Joined: Jun 04, 2004 Posts: 6044
|
Posted:
Sun Jul 10, 2005 6:55 pm |
|
Assuming $PHP_SELF is previously set to $_SERVER['PHP_SELF'], and hopefully it is, that should work. |
|
|
|
 |
MarkyBear Hangin' Around

Joined: Mar 27, 2005 Posts: 39
|
Posted:
Sun Jul 10, 2005 7:19 pm |
|
| kguske wrote: | | Assuming $PHP_SELF is previously set to $_SERVER['PHP_SELF'], and hopefully it is, that should work. |
Thanks for the reply!
I'm not sure what you mean by "previously set"?
If you mean that they once had that code in there, then no, I haven't edited any of these files at all...Like the Bank, Lottery and Shop files, they all contain that line in them...
Would I notice an error right off the bat if I changed it???
Thanks again!  |
|
|
|
 |
kguske Site Admin

Joined: Jun 04, 2004 Posts: 6044
|
Posted:
Sun Jul 10, 2005 7:28 pm |
|
$PHP_SELF is not a reserved name, so if there isn't a line somewhere before this code like
| Code: | | $PHP_SELF = $_SERVER['PHP_SELF']; |
this approach might not be the same code. Most likely, that line exists somewhere, so most likely you will be ok. In fact, using the approach Bob recommended is more secure than assuming that $PHP_SELF is set previously.
If it wasn't, you wouldn't notice an error either way. Using the prior approach, if the $PHP_SELF line wasn't properly set, you would be less secure... |
|
|
|
 |
chatserv The Mouse Is Extension Of Arm

Joined: May 02, 2003 Posts: 1396 Location: Puerto Rico
|
Posted:
Sun Jul 10, 2005 7:44 pm |
|
You will find that line in mainfile.php as:
| Code: | if ($phpver >= 41) {
$PHP_SELF = $_SERVER['PHP_SELF'];
} |
While you're checking it you might also want to change it to:
| Code: | if ($phpver >= 41) {
$PHP_SELF = htmlentities($_SERVER["PHP_SELF"]);
} |
|
|
|
|
 |
kguske Site Admin

Joined: Jun 04, 2004 Posts: 6044
|
Posted:
Sun Jul 10, 2005 7:52 pm |
|
Thanks, Chatserv. Your suggested change will make it MORE secure, and, under those circumstances, wouldn't MarkyBear want to use
| Code: | | if (!stristr($PHP_SELF, "modules.php")) { |
instead? |
|
|
|
 |
MarkyBear Hangin' Around

Joined: Mar 27, 2005 Posts: 39
|
Posted:
Sun Jul 10, 2005 7:54 pm |
|
| kguske wrote: | $PHP_SELF is not a reserved name, so if there isn't a line somewhere before this code like
| Code: | | $PHP_SELF = $_SERVER['PHP_SELF']; |
this approach might not be the same code. Most likely, that line exists somewhere, so most likely you will be ok. In fact, using the approach Bob recommended is more secure than assuming that $PHP_SELF is set previously.
If it wasn't, you wouldn't notice an error either way. Using the prior approach, if the $PHP_SELF line wasn't properly set, you would be less secure... |
Ok, I'm kind of starting to understand what you're meaning here and thank you for taking the time to not only help, but to help me learn this!
So, for example the Bank mod, I searched the file and that line you posted is no where in there, so I just changed it from:
| Code: | | if (!eregi("modules.php", $PHP_SELF)) { |
to
| Code: | | if (!stristr($_SERVER['PHP_SELF'], "modules.php")) { |
Correct???
Sorry to be a pain, I'm trying here LOL
And thanks again!! |
|
|
|
 |
kguske Site Admin

Joined: Jun 04, 2004 Posts: 6044
|
Posted:
Sun Jul 10, 2005 7:59 pm |
|
|
|
 |
MarkyBear Hangin' Around

Joined: Mar 27, 2005 Posts: 39
|
Posted:
Sun Jul 10, 2005 8:00 pm |
|
| kguske wrote: | | That should work, yes. |
Will do and thanks again for all your time and help!!!
| chatserv wrote: | You will find that line in mainfile.php as:
| Code: | if ($phpver >= 41) {
$PHP_SELF = $_SERVER['PHP_SELF'];
} |
While you're checking it you might also want to change it to:
| Code: | if ($phpver >= 41) {
$PHP_SELF = htmlentities($_SERVER["PHP_SELF"]);
} | |
Had it and changed it as suggested, thank you for your help too!!! |
|
|
|
 |
Isaiah Hangin' Around

Joined: Nov 09, 2004 Posts: 32
|
Posted:
Thu Mar 23, 2006 6:26 am |
|
Another one tweak,
i think most of the php freaks allready know this
More than 86% faster site loading to the sites i used this.
Just have in mind that if you have a very busy site with lot of traffic,
it can make the server load go at high levels.
Tip:
Edit your .htaccess file,
and place those lines at the start of the file :
php_flag zlib.output_compression on
php_value zlib.output_compression_level 1
Don't adjust the compression_level value to 9 (max),
as there is nearly no difference, and level 9 can push the server to the limit.
After this, all pages are compressed using the gzip php library,
result in super fast loading of your pages.
Cheers! |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Thu Mar 23, 2006 11:54 pm |
|
Be careful! It increased my initial load time by over .2 second. I'm sure there are other factors involved. Remember that your browser must be able to negotiate compressed input or it won't work at all. It could also be the mainfile code routine is conflicting with this code. I'm just saying that you need to test it very carefully. Thanks. |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Fri Mar 24, 2006 12:00 am |
|
And it definitely conflicts and errors out with the mainfile.php code. Repeated attempts showed an increase of up to just over a second, even with the mainfile code adjusted. |
|
|
|
 |
Isaiah Hangin' Around

Joined: Nov 09, 2004 Posts: 32
|
Posted:
Fri Mar 24, 2006 2:06 am |
|
Well, i use this code at two very crowded sites i own,
and these 20 days i use it, i didn't experienced any problem at all,
either at the browsers i tested, seems that everything is working so fast.
By the way, about mainfile.php, in case of any conflict or error mismatch,
normally i should expect an error message, am i right? |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Fri Mar 24, 2006 8:38 am |
|
If you have error display turned on you should see a gzip conflict. |
|
|
|
 |
Isaiah Hangin' Around

Joined: Nov 09, 2004 Posts: 32
|
Posted:
Fri Mar 24, 2006 8:47 am |
|
I understood. But there is this message (conflict) only if you place the
ozhandler command at index.php.
By placing the code i wrote above at .htaccess, there is no conflict,
although at mainfile.php there is reference to ogzhadler. |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Fri Mar 24, 2006 8:59 am |
|
My point is that each person needs to test this carefully. Even after I removed the mainfile code conflict my page generation times for my home page increased by up to 2 seconds longer. And I ran the test multiple times. This is not an attack on you so please don't take on a defensive posture . As with all changes and modifications, environmental factors can and will affect results. |
|
|
|
 |
Isaiah Hangin' Around

Joined: Nov 09, 2004 Posts: 32
|
Posted:
Fri Mar 24, 2006 9:33 am |
|
| Raven wrote: | This is not an attack on you so please don't take on a defensive posture . As with all changes and modifications, environmental factors can and will affect results. |
lol sure mate of course i didn't feel it like attack
By the way,
you made me search for this further ,
and when i remove all references of this compression feature from mainfile.php, the page loading is too sloooooow.
I think that even without modifying .htaccess, and having the code at mainfile.php, like this one you have to the latest raven package,
it is allready a speed tweak finally  |
|
|
|
 |
|
|
|
|