PeteZDj / streeme

Automatically exported from code.google.com/p/streeme
MIT License
0 stars 0 forks source link

IIS support #29

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The Streeme projects does not support IIS. If you install Streeme on a IIS 
system you will soon find out it does not work on IIS. However after some 
digging I got it working with the following changes. In the future these 
changes could be incorporated in the master trunk.

My setup:
Windows Server 2008 r2
PHP 5.3.5 (php-cgi.exe)

Steps to install Streeme on a IIS server
 - Set up as new IIS website (do not use the Default Website)
 - Provide IIS with the URL rewrite rules (import the .htacces rules in the Streeme web folder), or use the attached web.config file (place it in the web directory)
 - Make sure you have correct permissions on the cache, data, log and music directory (give IUSR and IIS_IUSRS read and or write permissions)
 - Make sure you complete the check_configuration.php (in my case I did not complete the APC and php_posix check, which is ok)
- Make the following edits to your code (or use the attached files):

FIX faulty urls:

In the $(document).ready(function(){} in the _load_javascript.php files in 
apps\client\modules\player_desktop\templates and 

apps\client\modules\player_mobile\templates

Change all occurences of: 

!empty( $_SERVER['HTTPS'] )

into 

if ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' )

Without this fix the Streeme javascript will always use the HTTPS urls, because 
IIS defines the HTTPS global differently.

FIX streaming issue:

Replace in MediaProxy.class.php the stream_original function with the function 
below:

  private function stream_original()
  {
    //Custom edits by me
      $this->log('Sending File using Pear HTTP Download');
      $params = array(
        'File'                => $this->filename,
        'ContentType'         => $this->source_type,
        'BufferSize'          => 32000,
        'ContentDisposition'  => array( HTTP_DOWNLOAD_INLINE, $this->source_basename ),
      );

      $error = HTTP_Download::staticSend( $params, false );    
  }

In other words remove the part below. This piece of code, specific for apache, 
makes the script to stop executing any code beyond this point:

    //does the user have apache mod XSendFile installed? use that as a first priority
    //otherwise we can send it using php's PEAR HTTP_Download functionality
    $mods = apache_get_modules();
    $flip = array_flip( $mods );
    $mod_number = (string) $flip[ 'mod_xsendfile' ];
    if( !empty( $mod_number ) )
    {
      $this->log('Sending File using X-Sendfile Module');
      header("X-Sendfile: $this->filename");
      header("Content-Type: $this->source_type");
      header("Content-Disposition: attachment; filename=\"$this->source_basename\"");
      header("Content-Length: $this->source_file_length" );
      exit;
    }

To make Streeme work I did some extensive debugging, i am just sharing this so 
you dont have to.

My support to this fantastic piece of software.

Greets,

Rogier

Original issue reported on code.google.com by rogiersa...@gmail.com on 21 May 2011 at 2:05

Attachments:

GoogleCodeExporter commented 9 years ago
This will probably hit 0.6.0 release in a month or two - thanks for going 
though it so carefully - should make it a lot easier to put on windows. Have 
you found anything else to fix since this report?

Original comment by chaffn...@gmail.com on 28 Jul 2011 at 5:23

GoogleCodeExporter commented 9 years ago
Usings these fixes everything seem to run fine. I did not notice anymore
strange behaviour.

Original comment by rogiersa...@gmail.com on 28 Jul 2011 at 8:15

GoogleCodeExporter commented 9 years ago
Sweet! thanks again for the help - can't wait to ramp up development again. 

Original comment by chaffn...@gmail.com on 28 Jul 2011 at 3:13