https://serverfault.com/questions/968402/load-specific-php-module-for-directory-apache-2-4-centos-7
You can't load two different PHP modules at the same time. Full stop. This is why you must use php-fpm to run different PHP versions.
https://medium.com/@pushpendrachauhan/how-migrating-apache-mpm-from-prefork-to-event-based-using-php-fpm-saved-our-day-8a6e371d94fd
=> note more
https://forums.aws.amazon.com/thread.jspa?threadID=283215
https://stackoverflow.com/questions/30446904/how-to-allow-custom-built-scan-this-dir-for-additional-ini-files-php-ini-file
https://www.php.net/manual/en/configuration.file.php
The configuration file ¶
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):
https://github.com/brefphp/bref/issues/355
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Globals:
Function:
Environment:
Variables:
APP_ENV: prod
APP_SECRET: 'foobar'
PHP_INI_SCAN_DIR: /var/task/custom-php-folder-in-project-dir
Resources:
Website:
Type: AWS::Serverless::Function
Code: ..
Properties:
FunctionName: 'my app'
# ...
Bryan,
The CLI/(Fast)CGI versions do load the .ini files each time they are fired up; however, the apache module loads them once into memory when the server is started. You can test this behavior by changing a value in any of the .ini files and running the CLI binary. Notice that you need a server restart before you can see the changes in the server module version.
Does this tell the PHP binary to do a file system scan every time the PHP module is loaded to respond to a request?
No. When you compile --with-config-file-scan-dir=/path/to/dir all you're doing is telling PHP combine all files in this directory into its configuration. This is a method often used in system configuration where package management systems need to be able to add/remove package specific configuration from an application without potentially destroying a end-user modified config file. An example here would be, on a Debian based system, when you apt-get install php-pgsql, it will create a /etc/php/conf.d/pgsql.ini which will contain the extension=pgsql.so line, as well as any module-specific options.
Does enabling the configuration option with-config-file-scan-dir when compiling PHP lead to performance issues?
Not really. In practice, it is simply a concatenation of all the .ini files in that particular directory.
I can tell you that Debian, CentOS, and Zend Server all use this option by default.
Also, just off the top of my head, *nix RC files, Apache2, Courier, Emacs, and Cron all use (or can use) similar approaches to loading configurations.
After install php56 and httpd24 in default Amazon AMI Linux 2018.03 (community image since AMI 1 now not available on Amazon).
It show default config dir (ini) same with PHP CLI and web:
Only php 5.6.40 available, not 5.6.37 and it seem no ZTS (Zend Thread Safe) version available.
(Huge .git folder => after clone you can remove this folder).
And we only care about config, core folders so extension folder can be removed (about 200MB).
grep -rn "with-config-file" .
./configure.ac:879: [AS_HELP_STRING([--with-config-file-path=PATH],
./configure.ac:897: [AS_HELP_STRING([--with-config-file-scan-dir=PATH],
./azure/macos/job.yml:69: --with-config-file-path=/etc \
./azure/macos/job.yml:70: --with-config-file-scan-dir=/etc/php.d
./azure/configure.yml:70: --with-config-file-path=/etc \
./azure/configure.yml:71: --with-config-file-scan-dir=/etc/php.d
./azure/i386/job.yml:70: --with-config-file-path=/etc \
./azure/i386/job.yml:71: --with-config-file-scan-dir=/etc/php.d
./azure/msan_job.yml:54: --with-config-file-path=/etc \
./azure/msan_job.yml:55: --with-config-file-scan-dir=/etc/php.d
=> Default is empty (or DEFAULT).
Or may be it get from $libdir or something deep in core of PHP.
With azure we can clearly see default value is '/etc/php.d'
Hello,
I have a Centos 5.7 x86_64 which at the moment run apache prefork but this mode uses a lot of memory per processes and I want to switch to worker.
So I installed via yum php-zts and all works great when I start the worker instead of the prefork, except the fact that eAccelerator doesn't load.
I know that I have to have the zts version of eaccelerator, but because I have installed zts via yum my php-config and phpize are for the normal non-zts php(I think) so I can't compile the zts version, so now the worker consumes less memory but is much slower then the prefork because it's not cached by eA.
Is there a way to get a hold of a eAccelerator zts enabled module for centos?
xCache will be goood too.
apache, php are all the latest repo versions.
sudo ./php-zts-installer.sh
content of php-zts-install.sh
#!/bin/bash
mkdir -p /etc/php7
mkdir -p /etc/php7/cli
git clone https://github.com/php/php-src.git -b PHP-7.0.17 --depth=1
cd php-src/ext
git clone https://github.com/krakjoe/pthreads -b master pthreads
cd ..
./buildconf --force
./configure --prefix=/etc/php7 --with-bz2 --with-zlib --enable-zip --disable-cgi \
--enable-soap --enable-intl --with-mcrypt --with-openssl --with-readline --with-curl \
--enable-ftp --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
--enable-sockets --enable-pcntl --with-pspell --with-enchant --with-gettext \
--with-gd --enable-exif --with-jpeg-dir --with-png-dir --with-freetype-dir --with-xsl \
--enable-bcmath --enable-mbstring --enable-calendar --enable-simplexml --enable-json \
--enable-hash --enable-session --enable-xml --enable-wddx --enable-opcache \
--with-pcre-regex --with-config-file-path=/etc/php7/cli \
--with-config-file-scan-dir=/etc/php7/etc --enable-cli --enable-maintainer-zts \
--with-tsrm-pthreads --enable-debug --enable-fpm \
--with-fpm-user=www-data --with-fpm-group=www-data
make && make install
chmod o+x /etc/php7/bin/phpize
chmod o+x /etc/php7/bin/php-config
cd ext/pthreads*
/etc/php7/bin/phpize
./configure --prefix=/etc/php7 --with-libdir=/lib/x86_64-linux-gnu --enable-pthreads=shared --with-php-config=/etc/php7/bin/php-config
make && make install
cd ../../
cp -r php.ini-development /etc/php7/cli/php.ini
cp php.ini-development /etc/php7/cli/php-cli.ini
echo "extension=pthreads.so" > /etc/php7/cli/php-cli.ini
echo "zend_extension=opcache.so" >> /etc/php7/cli/php.ini
ln --symbolic /etc/php7/bin/php /usr/bin/php
export USE_ZEND_ALLOC=0
ReplyDeleteAs a leading Top Mobile App Development Company in India, Appsinvo company is well known to design and build customized web and mobile app solutions for the clients. Complete integration of the mobile app and the website gives the businesses a boost not only in their growth but also in the revenue.
Top Mobile App Development Company in Qatar