当本地 php 的路径位于 windows 上的路径环境变量中时,Dokuwiki 会崩溃

Dokuwiki on a stick breaks when path to local php is in the path environment variable on windows

我已经在 Windows 机器上从我的 USB 驱动器 运行ning DokuWikiStick 几个星期了,直到今天才出现任何问题。

今天我安装了 XAMMP,除此之外,它还安装了 PHP 并将 PHP 目录的路径添加到 windows 路径环境变量(c:\xampp\php 在我的例子中)。

现在,当我启动 DokuWikiStick (microapache) 时,我在日志中收到以下错误(并且 wiki 应用程序未在浏览器中加载)

[Fri Oct 16 14:08:54.069762 2015] [mpm_winnt:notice] [pid 5540:tid 188] AH00418: Parent: Created child process 8920
PHP Warning:  PHP Startup: bz2: Unable to initialize module\nModule compiled with module API=20100525\nPHP    compiled with module API=20131226\nThese options need to match\n in Unknown on line 0
PHP Warning:  PHP Startup: gd: Unable to initialize module\nModule compiled with module API=20100525\nPHP    compiled with module API=20131226\nThese options need to match\n in Unknown on line 0
PHP Warning:  PHP Startup: mbstring: Unable to initialize module\nModule compiled with module API=20100525\nPHP    compiled with module API=20131226\nThese options need to match\n in Unknown on line 0
PHP Warning:  PHP Startup: openssl: Unable to initialize module\nModule compiled with module API=20100525\nPHP    compiled with module API=20131226\nThese options need to match\n in Unknown on line 0
PHP Warning:  PHP Startup: pdo_sqlite: Unable to initialize module\nModule compiled with module API=20100525\nPHP    compiled with module API=20131226\nThese options need to match\n in Unknown on line 0

如果我从路径环境变量中删除 PHP 的路径,那么 DokuWikiStick 应用 运行 就没问题了。

我如何 运行 DokuWikiStick(又名 microapache)使用它自己的 PHP 文件并仍然保持本地机器 PHP 设置不变?

以下是 DokuWikiStick 的当前设置:

httpd.conf

 absolute minimum configuration for DokuWiki on a Stick
# change the Listen directive if you want to use a different port

Listen 6608
ServerName microapache
ServerRoot .
DocumentRoot ./../dokuwiki
ServerAdmin a.jacob.g@gmail.com

# load libraries for PHP
Loadfile ./php/ssleay32.dll
Loadfile ./php/libeay32.dll
#Loadfile icuuc51.dll
#Loadfile php/icuin51.dll

# load apache modules
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule dir_module modules/mod_dir.so
LoadModule mime_module modules/mod_mime.so
LoadModule rewrite_module modules/mod_rewrite.so

# Load PHP module and add handler
LoadModule php5_module ./php/php5apache2_4.dll
AddHandler application/x-httpd-php .php

# Configure the path to php.ini
PHPIniDir ./php

AcceptPathInfo off
KeepAlive on
KeepAliveTimeout 15
TimeOut 30
DirectoryIndex index.html index.php

php.ini

; minimal php.ini file, keeps most settings at default
[PHP]

date.timezone = Eastern/Detroit

max_execution_time = 120
max_input_time = 90
memory_limit = 128M
error_reporting  =  E_ALL & ~E_NOTICE & ~E_STRICT
display_errors = On
display_startup_errors = On
post_max_size = 32M
file_uploads = On
upload_max_filesize = 15M


extension_dir= ./php/ext
extension=php_bz2.dll
extension=php_gd2.dll
extension=php_mbstring.dll
extension=php_openssl.dll
extension=php_pdo_sqlite.dll

run.cmd(启动 microapache 服务器)

@echo off
goto begin

:usage
echo Usage: %~n0
echo.
echo Starts DokuWiki on a Stick (http://www.dokuwiki.org/dokuwiki_on_a_stick)
echo and waits for user to press a key to stop.
goto end

:begin
if not "%1"=="" goto usage
cd server
start "Apache server" /B mapache.exe
echo DokuWiki on a Stick started...
echo.

:runbrowser
echo Your web browser will now open http://127.0.0.1:6608
echo.
if exist ../dokuwiki\conf\local.php (
    start http://127.0.0.1:6608/
) else (
    start http://127.0.0.1:6608/install.php
)

:wait
echo To stop DokuWiki on a Stick
pause

:stop
ApacheKill.exe
echo ... DokuWiki on a Stick stopped.
echo You can close this window now.

:end

U盘中DokuWikiStick的目录结构如下:

FOLDER  E:\DokuWikiStick\   ------- 2   2   136,795 136,795
FILE    out.txt
FILE    run.cmd
FOLDER  E:\DokuWikiStick\dokuwiki\  ------- 6   8   64,093  64,093
FILE    .htaccess.dist
FILE    COPYING
FILE    doku.php
FILE    feed.php
FILE    index.php
FILE    install.php.old
FILE    README
FILE    VERSION
FOLDER  E:\DokuWikiStick\dokuwiki\bin\  ------- 0   7   30,717  30,717
FILE    .htaccess
FILE    dwpage.php
FILE    gittool.php
FILE    indexer.php
FILE    render.php
FILE    striplangs.php
FILE    wantedpages.php
FOLDER  E:\DokuWikiStick\dokuwiki\conf\ ------- 0   22  39,628  39,628
FILE    .htaccess
FILE    acl.auth.php
FILE    acl.auth.php.dist
FILE    acronyms.conf
FILE    dokuwiki.php
FILE    entities.conf
FILE    interwiki.conf
FILE    license.php
FILE    local.php
FILE    local.php.bak
FILE    local.php.dist
FILE    mediameta.php
FILE    mime.conf
FILE    mysql.conf.php.example
FILE    plugins.local.php
FILE    plugins.php
FILE    plugins.required.php
FILE    scheme.conf
FILE    smileys.conf
FILE    users.auth.php
FILE    users.auth.php.dist
FILE    wordblock.conf
FOLDER  E:\DokuWikiStick\dokuwiki\data\ ------- 10  5   39,508  39,508
FILE    .htaccess
FILE    deleted.files
FILE    security.png
FILE    security.xcf
FILE    _dummy
FOLDER  E:\DokuWikiStick\server\conf\   ------- 0   2   2,366   2,366
FILE    httpd.conf
FILE    mime.types
FOLDER  E:\DokuWikiStick\server\logs\   ------- 0   3   87,124  87,124
FILE    error.log
FILE    httpd.pid
FILE    _dummy
FOLDER  E:\DokuWikiStick\server\modules\    ------- 0   8   103,936 103,936
FILE    mod_access_compat.so
FILE    mod_authz_core.so
FILE    mod_dir.so
FILE    mod_env.so
FILE    mod_log_config.so
FILE    mod_mime.so
FILE    mod_rewrite.so
FILE    mod_setenvif.so
FOLDER  E:\DokuWikiStick\server\php\    ------- 1   6   4,123,333   4,123,333
FILE    libeay32.dll
FILE    php-license.txt
FILE    php.ini
FILE    php5apache2_4.dll
FILE    php5ts.dll
FILE    ssleay32.dll
FOLDER  E:\DokuWikiStick\server\php\ext\    ------- 0   5   1,560,576   1,560,576
FILE    php_bz2.dll
FILE    php_gd2.dll
FILE    php_mbstring.dll
FILE    php_openssl.dll
FILE    php_pdo_sqlite.dll

最简单的解决方案可能是在 run.cmd 脚本中取消设置 PATH?