| Posted by R. Rajesh Jeba Anbiah on 07/01/17 11:55 
rallykarro@hotmail.com wrote:> Hi,
 >
 > a simple question regarding ways of loading php as a dll or an exe file
 > in httpd?
 > What is the difference of loading php as LoadModule php5_module
 > "C:\php\php5apache2_2.dll" or Action application/x-httpd-php
 > "/php/php-cgi.exe" or Action application/x-httpd-php "/php/php.exe".
 >
 > Either way, what is the most preferable way and why?
 
 To explain the difference:
 
 mod_php:
 
 <?php
 //apache.php
 
 //PHP as module
 function ModPHP($file)
 {
 $output = ... //Process the file
 return $output;
 }
 
 $file = GetRequestedFile();
 
 switch(GetFileType($file))
 {
 case 'php':
 echo ModPHP($file);
 break;
 case 'perl':
 echo ModPerl($file);
 break;
 ...
 }
 ?>
 
 CGI mode:
 
 <?php
 //apache.php
 $file = GetRequestedFile();
 
 switch(GetFileType($file))
 {
 case 'php':
 echo system('/usr/bin/php.exe '. $file);
 break;
 case 'perl':
 echo system('/usr/bin/perl '. $file);
 break;
 ...
 }
 ?>
 
 That explains why mod_php is preferred.
 
 --
 <?php echo 'Just another PHP saint'; ?>
 Email: rrjanbiah-at-Y!com    Blog: http://rajeshanbiah.blogspot.com/
  Navigation: [Reply to this message] |