Jürgen Hörmann Jürgen Hörmann - 7 months ago 213
PHP Question

How to use PHP 5.6 in Winginx

I would like to use php 5.6 with Winginx.

I tried to create a folder php56 and put the php package into it, but the php-config.exe will not "see" this folder.

How can I configure this php version in Winginx?

Answer
<?php
/*
After applying this patch you can use "php56" and "php70"
folders in the root directory of winginx.
*/
function patch($file, $offset, $old_data, $new_data) {
    if (!$f = fopen($file, 'r+b')) {
        die("Can not open $file");
    }
    fseek($f, $offset);
    $c = fread($f, strlen($old_data));
    if ($c == $old_data) {
        fseek($f, $offset);
        fwrite($f, $new_data, strlen($new_data));
        echo "$file patched successfully\n";
    } else if ($c != $new_data) {
        die("$file can not be patched\n");
    }
    fclose($f);
}
patch('winginx.exe', 0x0A6254, 2, 6);
patch('winginx.exe', 0x0AD2DC, 2, 6);

patch('winginx.exe', 0x0AD258 5, 7);
patch('winginx.exe', 0x0AD25C 3, 0);
patch('winginx.exe', 0x0AD2EA 5, 7);
patch('winginx.exe', 0x0AD2EC 3, 0);

patch('php-config.exe', 0x014FCE, 2, 6);
patch('php-config.exe', 0x014FDC, 5, 7);
patch('php-config.exe', 0x014FDE, 3, 0);

echo "Done\n";
Comments