|
Robin LIU
|
Vendredi 19 Septembre 2008 12:21:09 pm
[ez4]Comment créer des staticcache en mode CGI ?!
Bonjour,
J'ai un site http://fr.lingping.info hébergé chez 1and1, et j'ai le droit de ssh et cron. par contre le php installé en mode CGI et il n'y a pas de PHP-cli.
Je trouve que le site est trop long, donc je voudrais utiliser le staticcache, mais ça ne marche pas en mode CGI.
J'ai trouvé un patch sur internet, et après je l'ai ajouté dans le fichier kernel/classes/ezscript.php, il n'y a plus d'erreur affiché quand j'excute le bin/php/*.php ou cronjob, mais le scripte ne fait rien, rien marche. quelqu'un connais comment résoudre ce problème ?? merci bcp !
voici le patch
if ( php_sapi_name() != 'cli' )
{
eZDebug::writeNotice( "PHP is currently using the '" . php_sapi_name() . "' interface. Make sure it is using the 'cli' interface.", "PHP Setup" ;
// Preparing CGI and let it execute with preset values as the cli
// http://de.php.net/manual/en/features.commandline.php
// Fix memory limit
$memLimit = ini_get( 'memory_limit' );
if ($memLimit != '')
{
switch ( $memLimit{strlen( $memLimit ) - 1} )
{
case 'G':
$memLimit *= 1024;
case 'M':
$memLimit *= 1024;
case 'K':
$memLimit *= 1024;
}
if ( $memLimit != -1 && $memLimit < 44040192 ) /* 42*1024*1024 */
{
@ini_set( 'memory_limit', '42M' );
}
}
// Handle output buffering
@ob_end_flush();
ob_implicit_flush( TRUE );
// PHP ini settings
set_time_limit( 0 );
ini_set( 'track_errors', TRUE );
ini_set( 'html_errors', FALSE );
ini_set( 'magic_quotes_runtime', FALSE );
// Define stream constants
define( 'STDIN', fopen( 'php://stdin', 'r' ) );
define( 'STDOUT', fopen( 'php://stdout', 'w' ) );
define( 'STDERR', fopen( 'php://stderr', 'w' ) );
// Close the streams on script termination
register_shutdown_function( create_function( '', 'fclose(STDIN); fclose(STDOUT); fclose(STDERR); return true;' ) );
}
|