Linux-how can I load different extensions for php runtime in cli and fpm environments?

Source: Internet
Author: User
Tags egrep
Problem: Because the xdebug extension is enabled, the prompt "{code...}" appears when you use composer ...} so I want to stop loading the xdebug environment under cli: linux is installed for archlinuxphp through pacman, and version 7.0.1web service runs the configuration file distribution through php-fpm: {generation... problem:

When composer is used, the following message is displayed:

You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug

So I want to stop loading xdebug under cli.

Environment:
  • Archlinux

  • Php is installed through pacman, version 7.0.1

  • Web services run through php-fpm

Configuration file distribution:

/etc/php├── conf.d│   └── xdebug.ini├── fpm.d├── pear.conf├── php-fpm.conf├── php-fpm.d│   └── www.conf├── php.ini└── php.ini.pacnew

Compare the distribution of php configuration files installed with apt in ubuntu:

/etc/php5/├── cli│   ├── conf.d│   └── php.ini├── fpm│   ├── conf.d│   │   ├── 20-xdebug.ini -> ../../mods-available/xdebug.ini│   ├── php-fpm.conf│   ├── php.ini│   └── pool.d│       └── www.conf└── mods-available    └── xdebug.ini

--- Update ---

  • Https://launchpadlibrarian.net/92790964/buildlog_ubuntu-hardy-amd64.php5_5.2.4-2ubuntu5.23_BUILDING.txt.gz

  • Https://projects.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD? H = packages/php

InDo not compile and install the configuration manually, and re-specify the config parameters.In this case, you have to manually specify php. ini to run.

Reply content: Question:

When composer is used, the following message is displayed:

You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug

So I want to stop loading xdebug under cli.

Environment:
  • Archlinux

  • Php is installed through pacman, version 7.0.1

  • Web services run through php-fpm

Configuration file distribution:

/etc/php├── conf.d│   └── xdebug.ini├── fpm.d├── pear.conf├── php-fpm.conf├── php-fpm.d│   └── www.conf├── php.ini└── php.ini.pacnew

Compare the distribution of php configuration files installed with apt in ubuntu:

/etc/php5/├── cli│   ├── conf.d│   └── php.ini├── fpm│   ├── conf.d│   │   ├── 20-xdebug.ini -> ../../mods-available/xdebug.ini│   ├── php-fpm.conf│   ├── php.ini│   └── pool.d│       └── www.conf└── mods-available    └── xdebug.ini

--- Update ---

  • Https://launchpadlibrarian.net/92790964/buildlog_ubuntu-hardy-amd64.php5_5.2.4-2ubuntu5.23_BUILDING.txt.gz

  • Https://projects.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD? H = packages/php

InDo not compile and install the configuration manually, and re-specify the config parameters.In this case, you have to manually specify php. ini to run.

Use two different php. the ini configuration file configures different running parameters (including extended parameters). When cli or fpm is enabled, use the-c parameter to specify the php. ini.

Both PHP and PHP-FPM can use the-c parameter to specify the php. ini configuration file.

Run the following command:

strace -f -o strace.log \/png/php/5.4.45/bin/php -v && \cat strace.log|egrep 'open|read'|grep 'ini'3080  open("/png/php/5.4.45/bin/php-cli.ini", O_RDONLY) = -1 ENOENT (No such file or directory)3080  open("/png/php/5.4.45/lib/php-cli.ini", O_RDONLY) = -1 ENOENT (No such file or directory)3080  open("/png/php/5.4.45/bin/php.ini", O_RDONLY) = -1 ENOENT (No such file or directory)3080  open("/png/php/5.4.45/lib/php.ini", O_RDONLY) = 3

PHP will first read the php-cli.ini under the directory where the php program is located, access to it will not read other INI files.
The PHP-FPM is as follows:

strace -f -o strace.log \/png/php/5.4.45/sbin/php-fpm -v && \cat strace.log|egrep 'open|read'|grep 'ini'3537  open("/png/php/5.4.45/lib/php-fpm-fcgi.ini", O_RDONLY) = -1 ENOENT (No such file or directory)3537  open("/png/php/5.4.45/lib/php.ini", O_RDONLY) = 3

The PHP-CGI is as follows:

strace -f -o strace.log \/png/php/5.4.45/bin/php-cgi -v && \cat strace.log|egrep 'open|read'|grep 'ini'3568  open("./php-cgi-fcgi.ini", O_RDONLY) = -1 ENOENT (No such file or directory)3568  open("/png/php/5.4.45/bin/php-cgi-fcgi.ini", O_RDONLY) = -1 ENOENT (No such file or directory)3568  open("/png/php/5.4.45/lib/php-cgi-fcgi.ini", O_RDONLY) = -1 ENOENT (No such file or directory)3568  open("./php.ini", O_RDONLY)       = -1 ENOENT (No such file or directory)3568  open("/png/php/5.4.45/bin/php.ini", O_RDONLY) = -1 ENOENT (No such file or directory)3568  open("/png/php/5.4.45/lib/php.ini", O_RDONLY) = 3

You can disable the 20-xdebug.ini of conf. d In the cli directory.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.