PHP Command Line php.ini path error

前端 未结 2 1156
萌比男神i
萌比男神i 2020-12-19 11:44

I am trying to run some PHP pages on the command line but am running into a few problems with mysql and other PHP extensions.

Running php --ini produce

相关标签:
2条回答
  • 2020-12-19 12:17

    First update your sloacate database by using the command updatedb

    Then try to locate php.ini file by using the command php --ini

    I hope it'll update the slocate database and it will display the ini files loaded path.

    [root@tamilan src]# php --ini
    Configuration File (php.ini) Path: /etc
    Loaded Configuration File:         /etc/php.ini
    Scan for additional .ini files in: /etc/php.d
    Additional .ini files parsed:      /etc/php.d/apc.ini,
    

    To run php with customized or other php.ini file use the below method

    php -c /etc/php.ini your-php-script-file.php
    
    0 讨论(0)
  • 2020-12-19 12:33

    Using the -c option, you can specify which php.ini file should be used :

    php -c /etc/php.ini your-php-script.php
    


    As a reference, see the output of php --help :

    $ php --help
    Usage: php [options] [-f] <file> [--] [args...]
           php [options] -r <code> [--] [args...]
           php [options] [-B <begin_code>] -R <code> [-E <end_code>] [--] [args...]
           php [options] [-B <begin_code>] -F <file> [-E <end_code>] [--] [args...]
           php [options] -- [args...]
           php [options] -a
    
      -a               Run as interactive shell
      -c <path>|<file> Look for php.ini file in this directory
      -n               No php.ini file will be used
      -d foo[=bar]     Define INI entry foo with value 'bar'
      ...
    
    0 讨论(0)
提交回复
热议问题