加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php5 – 在Redhat上是否有相当于Debian的cli / php.ini?

发布时间:2020-12-13 13:47:53 所属栏目:PHP教程 来源:网络整理
导读:如何配置 PHP的命令行版本以在Redhat系统上进行不同的设置? 在基于Debian的系统上,php有一个单独的命令行版本配置文件:/ etc / php5 / cli. 在Redhat上,在/etc/php.d/中有/etc/php.ini和各种其他ini文件,但命令行版本没有单独的配置文件,即使安装了php-cli
如何配置 PHP的命令行版本以在Redhat系统上进行不同的设置?

在基于Debian的系统上,php有一个单独的命令行版本配置文件:/ etc / php5 / cli.

在Redhat上,在/etc/php.d/中有/etc/php.ini和各种其他ini文件,但命令行版本没有单独的配置文件,即使安装了php-cli软件包.

你有两个选择:

>使用-c参数指示ini文件位置
>在/ etc /上创建一个php-cli.ini文件

从official PHP manual:

The configuration file (php.ini) is read when PHP starts up. For the
server module versions of PHP,this happens only once when the web
server is started. For the CGI and CLI versions,it happens on every
invocation.

php.ini is searched for in these locations (in order):

  • SAPI module specific location (PHPIniDir directive in Apache 2,-c command line option in CGI and CLI,php_ini parameter in NSAPI,
    PHP_INI_PATH environment variable in THTTPD)
  • The PHPRC environment variable. Before PHP 5.2.0,this was checked after the registry key mentioned below.
  • As of PHP 5.2.0,the location of the php.ini file can be set for different versions of PHP. The following registry keys are examined in
    order: [HKEY_LOCAL_MACHINESOFTWAREPHPx.y.z],
    [HKEY_LOCAL_MACHINESOFTWAREPHPx.y] and
    [HKEY_LOCAL_MACHINESOFTWAREPHPx],where x,y and z mean the PHP
    major,minor and release versions. If there is a value for IniFilePath
    in any of these keys,the first one found will be used as the location
    of the php.ini (Windows only).
  • [HKEY_LOCAL_MACHINESOFTWAREPHP],value of IniFilePath (Windows only).
  • Current working directory (except CLI).
  • The web server’s directory (for SAPI modules),or directory of PHP (otherwise in Windows).
  • Windows directory (C:windows or C:winnt) (for Windows),or –with-config-file-path compile time option.

If php-SAPI.ini exists (where SAPI is the SAPI in use,so,for
example,php-cli.ini
or php-apache.ini),it is used instead of php.ini. The SAPI name can be determined with php_sapi_name().

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读