douyouchou1085 2012-11-28 09:50
浏览 47

php.ini上的分隔符包括路径

I am currently installing a subversion protocol within a business, some of the users develop in Windows on local Wamp servers, and others use local Lamp servers. The main site runs on a linux server.

The issue I have is setting up the include paths within the php.ini file. As some of the files change this setting on the fly, this is becoming a pain.

The windows machines require a semicolon (;) delimiter in the include paths, and the linux machines require a colon (:).

Is there any way to change the configuration of the windows machines to use a colon as the include path delimiters?

  • 写回答

1条回答 默认 最新

  • dongyunshan4066 2015-11-29 19:30
    关注

    All is possible, but the solution could be more painful than the problem in this case.

    The path separator is hardcoded inside PHP binary executable. The most viable option would be to download PHP source code for Windows from here: (Important: download exactly the same version that your LAMP system uses).

    http://windows.php.net/download/

    Once downloaded and unzipped, open the file:

    /Zend/zend.h
    

    Look around line 41 the dynamic precompiler directives:

    #ifdef ZEND_WIN32
    # include "zend_config.w32.h"
    # define ZEND_PATHS_SEPARATOR       ';'
    #elif defined(NETWARE)
    # include <zend_config.h>
    # define ZEND_PATHS_SEPARATOR       ';'
    #elif defined(__riscos__)
    # include <zend_config.h>
    # define ZEND_PATHS_SEPARATOR       ';'
    #else
    # include <zend_config.h>
    # define ZEND_PATHS_SEPARATOR       ':'
    #endif
    

    There you can change the windows separator.

    Now compile PHP pack. It's possible with Visual Studio, following these steps:

    https://wiki.php.net/internals/windows/stepbystepbuild

    In theory you will be able to run PHP over WAMP with same separator character than in Linux machines.

    But there is another question... do this configuration gives any problem? You will have to find the answer by yourself.

    ALTERNATIVE:

    If you don't want to change the precompiler directive affecting the whole system, you can try to make it "dirty" and change only "main/php_ini.c" on line 413 (aprox).

    static const char paths_separator[] = { ZEND_PATHS_SEPARATOR, 0 };
    

    Change constant name by ';' character, and compile like is described above.

    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大