Author |
Message |
BobMarion
Former Admin in Good Standing
![](modules/Forums/images/avatars/4a8223e348325d1641ec3.png)
Joined: Oct 30, 2002
Posts: 1037
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. |
_________________ Bob Marion
Codito Ergo Sum
Only registered users can see links on this board! Get registered or login! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
chatserv
Member Emeritus
![](modules/Forums/images/avatars/Risque/fhf215.jpg)
Joined: May 02, 2003
Posts: 1389
Location: Puerto Rico
|
Posted:
Mon Dec 06, 2004 1:32 pm |
|
2.8 patch? ![Bang Head](modules/Forums/images/smiles/banghead.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
sixonetonoffun
Spouse Contemplates Divorce
![](modules/Forums/images/avatars/d1ecfa674c890aee2698b.jpg)
Joined: Jan 02, 2003
Posts: 2496
|
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. |
_________________ [b][size=5]openSUSE 11.4-x86 | Linux 2.6.37.1-1.2desktop i686 | KDE: 4.6.41>=4.7 | XFCE 4.8 | AMD Athlon(tm) XP 3000+ | MSI K7N2 Delta-L | 3GB Black Diamond DDR
| GeForce 6200@433Mhz 512MB | Xorg 1.9.3 | NVIDIA 270.30[/size:2b8 |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Mesum
Useless
![](modules/Forums/images/avatars/180c055e41aaf0a475312.gif)
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? |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
BobMarion
![](modules/Forums/images/avatars/gallery/blank.gif)
|
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. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Mesum
![](modules/Forums/images/avatars/gallery/blank.gif)
|
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. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
RTS-Bone
New Member
![New Member New Member](modules/Forums/images/ranks/1star.gif)
![](modules/Forums/images/avatars/gallery/blank.gif)
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... |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
MarkyBear
Hangin' Around
![](modules/Forums/images/avatars/45b31c204341696069ecb.gif)
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! |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
kguske
Site Admin
![](modules/Forums/images/avatars/41f0b40a419280935f3a0.gif)
Joined: Jun 04, 2004
Posts: 6437
|
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. |
_________________ I search, therefore I exist...
Only registered users can see links on this board! Get registered or login! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
MarkyBear
![](modules/Forums/images/avatars/gallery/blank.gif)
|
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! ![Very Happy](modules/Forums/images/smiles/icon_biggrin.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
kguske
![](modules/Forums/images/avatars/gallery/blank.gif)
|
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... |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
chatserv
![](modules/Forums/images/avatars/gallery/blank.gif)
|
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"]);
}
|
|
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
kguske
![](modules/Forums/images/avatars/gallery/blank.gif)
|
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? |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
MarkyBear
![](modules/Forums/images/avatars/gallery/blank.gif)
|
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!! |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
kguske
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sun Jul 10, 2005 7:59 pm |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
MarkyBear
![](modules/Forums/images/avatars/gallery/blank.gif)
|
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!!! |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Isaiah
Hangin' Around
![](modules/Forums/images/avatars/gallery/blank.gif)
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! |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Raven
Site Admin/Owner
![](modules/Forums/images/avatars/45030c033f18773153cd2.gif)
Joined: Aug 27, 2002
Posts: 17088
|
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. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Raven
![](modules/Forums/images/avatars/gallery/blank.gif)
|
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. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Isaiah
![](modules/Forums/images/avatars/gallery/blank.gif)
|
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? |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Raven
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Mar 24, 2006 8:38 am |
|
If you have error display turned on you should see a gzip conflict. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Isaiah
![](modules/Forums/images/avatars/gallery/blank.gif)
|
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. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Raven
![](modules/Forums/images/avatars/gallery/blank.gif)
|
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. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Isaiah
![](modules/Forums/images/avatars/gallery/blank.gif)
|
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 ![Smile](modules/Forums/images/smiles/icon_smile.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|