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?

Upvotes: 1

Views: 3036

Answers (5)

Sax0n
Sax0n

Reputation: 36

<?php
/*
After applying this patch you can use "php56", "php70" and "php71"
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); // 5.2 -> 5.6
patch('winginx.exe', 0x0A6258, 5, 7);  
patch('winginx.exe', 0x0A625C, 3, 0); // 5.3 -> 7.0
patch('winginx.exe', 0x0A6260, 5, 7);
patch('winginx.exe', 0x0A6264, 4, 1); // 5.4 -> 7.1

patch('winginx.exe', 0x0AD2DC, 2, 6); // 5.2 -> 5.6
patch('winginx.exe', 0x0AD2EA, 5, 7);
patch('winginx.exe', 0x0AD2EC, 3, 0); // 5.3 -> 7.0
patch('winginx.exe', 0x0AD2FA, 5, 7);
patch('winginx.exe', 0x0AD2FC, 4, 1); // 5.4 -> 7.1

patch('php-config.exe', 0x014FCE, 2, 6); // 5.2 -> 5.6
patch('php-config.exe', 0x014FDC, 5, 7);
patch('php-config.exe', 0x014FDE, 3, 0); // 5.3 -> 7.0
patch('php-config.exe', 0x014FEC, 5, 7);
patch('php-config.exe', 0x014FEE, 4, 1); // 5.4 -> 7.1

echo "Done\n";

to update mysql to latest 5.7 release:

  • download latest zip versin
  • extract mysqld.exe and share folder to the mysqll folder of winginx
  • use this my.ini

    [mysqld]
    basedir=../mysql
    datadir = data
    bind-address = 127.0.0.1
    socket=mysql.sock
    log_syslog=0
    log_error_verbosity=1 # 1=errors; 2=+warnings; 3=+notices
    
  • rename data folder to something else (to backup data)
  • run from mysql filder of winginx

    ./mysqld.exe --initialize-insecure --console --datadir=data --basedir=../mysql
    

nginx, nodejs and redis could be updated the same way. download latest release, replace binaries and play with configs

Upvotes: 2

sax0n
sax0n

Reputation: 21

<?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";

Upvotes: 2

Here u are: https://www.dropbox.com/s/10mkdporeils7ct/winginx_php56_support.exe I just reedit and now it support php 5.6.

Just download from php.net 5.6 php and place to winginx_folder/php56 Also u need copy config php-cgi from previous version.

Upvotes: -1

z2z
z2z

Reputation: 529

Try...

For php 5.6.7 - https://github.com/z2z/winginx_php56

For mysql or mariadb - https://gist.github.com/z2z/eb3d1415c2521da76b20

For nGinx - You directly replace nginx.exe with the latest.

Upvotes: 0

Serhat
Serhat

Reputation: 396

You can do like this,

PHP settings; First, download to php ( http://windows.php.net/download/ ) and copy to C:/php. After, create to php64.bat on your desktop and write to inside C:\php\php-cgi.exe -b 127.0.0.1:5800, run the file.

Winginx settings; change to this of your "Server Config" tab; Find:

location ~ \.php$ {
    fastcgi_pass 127.0.0.1:9054;

Replace:

location ~ \.php$ {
    fastcgi_pass 127.0.0.1:5800;

After, Save and restart nginx.

Upvotes: 0

Related Questions