possible fix for the CGI problem

Author Message

Ben Pirt

Friday 05 March 2004 3:27:59 am

Hi,
Having investigated what was going on with the CGI issue, I have come to a simple solution which seems to work well in my case. It should be noted that I have only tested this in a 3.3-3 setup which has url rewriting enabled, so i'm not sure how it will work for any other setup. Usual disclaimers apply.

in /lib/ezutils/classes/ezsys.php change line 703 from;

$phpSelf = eZSys::serverVariable( 'PHP_SELF' );

to;

if(isset($_SERVER['_'])){
//we are running as a cgi
$phpSelf = eZSys::serverVariable( 'REQUEST_URI' );
}else{
//we are running as a module
$phpSelf = eZSys::serverVariable( 'PHP_SELF' );
}

and that's it. It seems like the PHP_SELF variable is not set in the CGI, but on initial investigation it is the same as the REQUEST_URI variable. By checking if it is a CGI (by testing for the _ variable) we can choose between these options. So, try it out and see if it works in your situation and report back. Maybe it will need combining with the other patch which is floating around. Let's try to fix this annoying problem which seems to be affecting quite a lot of people.

As I said, my site is working well now. Hope yours does too :-)

All the best,

Ben Pirt

PS I'm sure this doesn't conform to eZ coding standards, so if someone wants to make it comply and post back, that would be great.

Derick Rethans

Monday 08 March 2004 12:44:34 am

Testing for CGI can better be done by:
if (php_sapi_name() == 'cgi')

besides that, we added support for CGI to ezp 3.4.

Ben Pirt

Monday 08 March 2004 1:24:22 am

Glad to hear that CGI support is in 3.4
For now though, if we do this;

if (php_sapi_name() == 'cgi')
//we are running as a cgi
$phpSelf = eZSys::serverVariable( 'REQUEST_URI' );
}else{
//we are running as a module
$phpSelf = eZSys::serverVariable( 'PHP_SELF' );
}

eZ publish 3.3 will run on a CGI setup too.
Thanks for the tip on php_sapi_name,
All the best,
Ben Pirt

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 18:18:22
Script start
Timing: Jan 18 2025 18:18:22
Module start 'layout'
Timing: Jan 18 2025 18:18:22
Module start 'content'
Timing: Jan 18 2025 18:18:22
Module end 'content'
Timing: Jan 18 2025 18:18:22
Script end

Main resources:

Total runtime0.7224 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 588.0391152.6406
Module start 'layout' 0.00570.0028 740.679739.4766
Module start 'content' 0.00850.7123 780.1563510.4688
Module end 'content' 0.72080.0016 1,290.625012.1406
Script end 0.7224  1,302.7656 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.4581160.0002
Check MTime0.00130.1821160.0001
Mysql Total
Database connection0.00060.089010.0006
Mysqli_queries0.669192.6174570.0117
Looping result0.00050.0688550.0000
Template Total0.688495.320.3442
Template load0.00190.259620.0009
Template processing0.686595.033620.3433
Template load and register function0.00020.034510.0002
states
state_id_array0.00160.224510.0016
state_identifier_array0.00110.155320.0006
Override
Cache load0.00160.2157390.0000
Sytem overhead
Fetch class attribute can translate value0.00050.074520.0003
Fetch class attribute name0.00110.148440.0003
XML
Image XML parsing0.00260.359620.0013
class_abstraction
Instantiating content class attribute0.00000.001440.0000
General
dbfile0.00320.4377160.0002
String conversion0.00000.001440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 18
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs