One of the reasons why a PHP / MySQL combo seems so “slow” with regards to response times when moving from Windows 2003 (IIS6) to Windows 7/2008 (IIS7) / 2012 (IIS8), is the way many scripts connect to MySQL and having IPv6 enabled by default.
Many server installations leave WordPress or other PHP script installs to default to “localhost” when connecting to MySQL. Windows 7, 2008, 2012 have an issue with resolving localhost when IPv6 is enabled. With iishacks.com, the initial response time from MySQL goes from 600ms (using localhost) down to 70ms (using 127.0.0.1).
If your issue is initial response time, but MySQL seems to function well otherwise, your connection string may be at fault. Instead of disabling IPv6, try changing “localhost” to “127.0.0.1″ in your scripts and see if the response times improve.
PHP on Windows has come along way in the past few years. It used to be a chore to get PHP to work properly on IIS. Not so, anymore.
In the past I’ve recommended PHP ISAPI for IIS when using threaded applications and accelerators like eAccelerator, xCache and APC. APC now includes support for FastCGI (Non-Thread Safe). To install PHP 4 – 5.2.x ISAPI, see my previous post: How to install PHP ISAPI on Windows 2008 IIS7 x64.
With PHP 5.3.x, the ISAPI dll has been removed for Windows. In order to use it, you’ll need to compile it yourself. There is a big push to use FastCGI on IIS, and with good reason – the performance has increased dramatically. Since most web applications (blogs, forums, CMS) do not require a Thread Safe install of PHP, FastCGI is the fastest and most stable option around.
PHP 5.3 for Windows is now compiled with either VC6 or VC9. VC9 should be used with IIS and VC6 should be used with Apache 1 or 2. For the VC9 versions you will need the Microsoft 2008 C++ Runtime (VC x86, VC x64, even though you are installing 32-bit PHP, install the correct version of VC++ for the version of Windows that you have).
When installing multiple versions of PHP with PHP Manager, each install can have a different PHP.ini and set of extensions installed and enabled. Within IIS, you can have a different version of PHP enabled for each site.
2. Download and Install PHP 5.3.x for Windows VC9 (Non-Thread Safe). (http://windows.php.net/download/) You can use the installer or zip package. I’d recommend using the installer package if this is your first install, as it will set the PATH for your PHP install in Windows. If you are adding a second version or upgrading PHP, download the zip package and simply unzip it. If you plan to use multiple versions of PHP at the same time, I’d recommend naming your directories with the PHP version, ie: C:\php_5.3.5\.
3. In PHP Manager (IIS Manager -> Server Name -> PHP Manager), click on “Register New PHP Version” and browse to where you unzipped the PHP files. Select the php-cgi.exe file and click OK. Once you have registered the PHP module, you’ll need to configure the PHP.ini. This can be done in Notepad or within PHP Manager (Manage All Settings). For most basic installs, the default PHP.ini will suffice. If you are using a MySQL database, you’ll have to enable the MySQL or MySQLi extension. Go to IIS Manager -> PHP Manager -> PHP Extensions -> Enableor disable an extension. Click on php_mysql.dll and/or php_mysqli.dll and under Actions on the right side bar, click Enable.
4. If you are using Windows x64, you’ll need to set your application pool settings to allow 32-bit PHP to function. If you are using 32-bit Windows, skip this step. In IIS Manager -> Application Pools -> Right-Click on the website’s application pool (or Default if you haven’t set one up yet) and select Advanced Settings. Set “Enable 32-bit applications” to TRUE. Click OK. This spawns the App Pool in 32-bit mode, so if you have other modules that need to be run in 64-bit mode, best to separate the website into two App Pools: one 32-bit and one 64-bit.
5. If you want to install multiple versions of PHP, all you need to do is register each version using PHP Manager. You can click on each individual website and select a specific version of PHP to run. Remember to modify the PHP.ini of each version you register. If you get CGI errors when trying to view a webpage, make sure cgi.force_redirect = 0, or it is commented out in the PHP.ini.
So you’ve decided you want to use JW Player for Silverlight and IIS Media Services Web Playlists together.
One of the reasons to use Web Playlists is to hide the true path of your video. This makes it difficult for users to download a full copy of your video, perfect for streaming copyrighted or pay-per-view content. Although users can still use screen capture software (such as Camtasia) to record your video, the process is more involved and less likely.
JW for flash and most other players require the media file (.mpeg, .mp4, etc) to be in a folder below the root path accessible by visitors. Web Playlists for IIS allows you to add videos from any folder on your server, and does not directly access the video when a viewing is requested. It uses a one-time security token to obfuscate the path.
Step 1 – Add a New Playlist in IIS
Here you’ll add a new playlist by opening up the IIS Manager, selecting your website and double-clicking on “Web Playlists.” Once it is open, on the right-hand side click on “Add Playlist.”
Once you type in a name for your playlist it will generate a URL that needs to be used by your web-based player. As you can see here, we are looking at iishacks.com/VMWareCertificate.isx.
You’ll need to add the specific video file by going to “Media entries” and clicking “Add.” You can select a Physical Path (excellent for hiding a file above the root folder), a Relative URI (if the file is in the root folder or below), or a Remote URL (if it is on another server or domain). I’ve chosen Physical Path and selected a folder that is not accessible via IIS.
You’ll notice you have options to disable skip back/forward or seek. If you choose to attach multiple videos together, or have required advertisements before, between or after videos, these options are for you. Networks such as Global TV utilize these options to ensure visitors are viewing the advertisements before a video starts.
Step 2 – Add the Playlist to JW Player
Once you’ve added your video file(s) you can now add the playlist to a web-based video player such as JW Player. JW Player for Silverlight is the only free player that supports the ISX playlist format and doesn’t require ASP. IIS Web Playlists supports .asf, .avi, .flv, .m4v, .mov, .mp3, .mp4, .rm, .rmvb, .wma and .wmv.
Another one of Microsoft’s descriptive errors is 0x8ffe2740 when trying to start an FTP or Web Server from the IIS Administration module. The error itself means that there is a port conflict with another service. This is a relatively easy diagnosis, as you should already know what ports your ftp or web servers use.
Use the netstat command in the command console to find out what program is using a particular TCP port. Replace the ## with the port you wish to test. This works on Windows Server 2003 and 2008.
netstat -anop TCP|find “:##”
The above command will return a PID (process ID). You will need to match that to a running program or service. Type the following command:
tasklist /SVC /FI “PID eq ####”
Here is an example using port 21. In this example you can see the “ftpsvc” service is using port 21 through svchost.exe – which is normal. In a client’s machine, it was MSUpdate2.exe that was using port 21 – a piece of malware using an FTP server to serve pirated movies!