如何在Winginx中使用PHP 5.6

时间:2014-10-02 08:41:33

标签: php winginx

我想在Winginx上使用php 5.6。

我尝试创建一个文件夹php56并将php包放入其中,但php-config.exe不会“看到”此文件夹。

如何在Winginx中配置这个php版本?

5 个答案:

答案 0 :(得分:2)

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

答案 1 :(得分:2)

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

将mysql更新到最新的5.7版本:

  • 下载最新的zip versin
  • 解压缩mysqld.exe并将文件夹共享到winginx的mysqll文件夹
  • 使用此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
    
  • 将数据文件夹重命名为其他内容(备份数据)
  • 从winginx的mysql filder运行

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

nginx,nodejs和redis可以用同样的方式更新。下载最新版本,替换二进制文件并使用配置

答案 2 :(得分:0)

你可以这样做,

PHP设置; 首先,下载到php(http://windows.php.net/download/)并复制到C:/ php。 之后,在桌面上创建php64.bat并写入 C:\ php \ php-cgi.exe -b 127.0.0.1:5800 内部,运行该文件。

Winginx设置; 更改为“服务器配置”选项卡; 发现:

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

替换:

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

之后,保存并重新启动nginx。

答案 3 :(得分:0)

...试

对于php 5.6.7 - https://github.com/z2z/winginx_php56

对于mysql或mariadb - https://gist.github.com/z2z/eb3d1415c2521da76b20

对于nGinx - 您直接用最新的。

替换nginx.exe

答案 4 :(得分:-1)

你在这里:https://www.dropbox.com/s/10mkdporeils7ct/winginx_php56_support.exe 我只是reedit,现在它支持php 5.6。

只需从php.net 5.6 php下载并放置到winginx_folder / php56 你也需要复制以前版本的配置php-cgi。