多 php 版本不适用于 7.1.4

ron*_*run 1 php apache

阿帕奇和 PHP

  • D:\网络服务器\Apache24
  • D:\webserver\php\php-5.6.30-Win32-VC11-x64
  • D:\webserver\php\php-7.0.18-Win32-VC14-x64
  • D:\webserver\php\php-7.1.4-Win32-VC14-x64

三个站点

  • D:\wwwroot\tests\php56
  • D:\wwwroot\tests\php70
  • D:\wwwroot\tests\php71

httpd-vhosts.conf

AddType application/x-httpd-php .php
ScriptAlias /php-7.1.4/ "D:/webserver/php/php-7.1.4-Win32-VC14-x64/"
ScriptAlias /php-7.0.18/ "D:/webserver/php/php-7.0.18-Win32-VC14-x64/"
ScriptAlias /php-5.6.30/ "D:/webserver/php/php-5.6.30-Win32-VC11-x64/"

<Directory "D:/webserver/php">
    Order allow,deny
    Allow from all
    Require all granted
</Directory>

<Directory "D:/wwwroot">
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
</Directory>

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "D:\wwwroot\tests\php56"
    ServerName php56.local
    ErrorLog "logs/php56-error.log"
    CustomLog "logs/php56-access.log" common
    <Directory "D:\wwwroot\tests\php56">
        Action application/x-httpd-php "/php-5.6.30/php-cgi.exe"
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "D:\wwwroot\tests\php70"
    ServerName php70.local
    ErrorLog "logs/php70-error.log"
    CustomLog "logs/php70-access.log" common
    <Directory "D:\wwwroot\tests\php70">
        Action application/x-httpd-php "/php-7.0.18/php-cgi.exe"
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "D:\wwwroot\tests\php71"
    ServerName php71.local
    ErrorLog "logs/php71-error.log"
    CustomLog "logs/php71-access.log" common
    <Directory "D:\wwwroot\tests\php71">
        Action application/x-httpd-php "/php-7.1.4/php-cgi.exe"
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

打开浏览器,访问: 1. http://php56.local/phpinfo.php 2. http://php70.local/phpinfo.php 3. http://php71.local/phpinfo.php 1和2都可以。只有 php 7.1.4 总是出现内部服务器错误。

为什么?

ron*_*run 5

我发现问题出在哪里了。

两个php版本都ok,没有php.ini,我没有处理。也许使用了一些默认值。

php版本无法工作,我将php.ini-development复制为php.ini,但没有更改extension_dir。

我设置extension_dir =“D:/webserver/php/php-7.1.4-Win32-VC14-x64/ext”后一切正常。