php 7 --with-config-file-scan-dir not working - php

OS: Debian 8.6 amd64, PHP 7.0.13 source(tar.gz) download from php.net, checked the md5 and sha256.
Try --with-config-file-scan-dir set to /etc/php7/cli/conf.d or /etc/php7/cli/conf.d/ still not working.
root#debian:/usr/src/php-7.0.13#./configure \
--prefix=/usr/local/php7 \
--with-config-file-path=/etc/php7/cli \
--with-config-file-scan-dir=/etc/php7/cli/conf.d/ \
--disable-all \
--enable-json=shared
root#debian:/usr/src/php-7.0.13# /usr/local/php7/bin/php --ini
Configuration File (php.ini) Path: /etc/php7/cli
Loaded Configuration File: /etc/php7/cli/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
In /usr/src/php-7.0.13/main/build-defs.h file last but one line, the PHP_CONFIG_FILE_SCAN_DIR constant was defined, but still not working.
#define PHP_CONFIG_FILE_SCAN_DIR "/etc/php7/cli/conf.d/"
If export the PHP_INI_SCAN_DIR environment variable, it's working.
root#debian:/usr/src/php-7.0.13# export PHP_INI_SCAN_DIR=/etc/php7/cli/conf.d/
root#debian:/usr/src/php-7.0.13# /usr/local/php7/bin/php --ini
Configuration File (php.ini) Path: /etc/php7/cli
Loaded Configuration File: /etc/php7/cli/php.ini
Scan for additional .ini files in: /etc/php7/cli/conf.d/
Additional .ini files parsed: /etc/php7/cli/conf.d/json.ini
Update
When 1st building, I forget setting --with-config-file-path and --with-config-file-scan-dir, so I used export PHP_INI_SCAN_DIR=/etc/php7/cli/conf.d/ and it's working.
So I remove it and building again, But I used export PHP_INI_SCAN_DIR= NOT unset. So in the 2nd building, the PHP_INI_SCAN_DIR env variable is still working and it's empty.
The correct way
unset PHP_INI_SCAN_DIR

You need to make sure that PHP_INI_SCAN_DIR is non-null in the environment, if it's going to be used:
krakjoe#fiji:/usr/src/php-src$ export PHP_INI_SCAN_DIR=
krakjoe#fiji:/usr/src/php-src$ php --ini
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /etc/php-cli.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
krakjoe#fiji:/usr/src/php-src$ export PHP_INI_SCAN_DIR=/etc/php.d
krakjoe#fiji:/usr/src/php-src$ php --ini
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /etc/php-cli.ini
Scan for additional .ini files in: /etc/php.d
Notice that the first execution exhibits the same symptoms you see.

Related

PHP.ini memory_limit not updating

I have installed PHP through Homebrew and I'm using Laravel Valet to serve my projects locally. I would like to update the memory_limit in PHP.ini but for some reason it looks like it's not updating.
If I run php --ini I get:
Configuration File (php.ini) Path: /usr/local/etc/php/7.4
Loaded Configuration File: /usr/local/etc/php/7.4/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.4/conf.d
Additional .ini files parsed: /usr/local/etc/php/7.4/conf.d/ext-opcache.ini,
/usr/local/etc/php/7.4/conf.d/php-memory-limits.ini
I've updated memory_limit in both /usr/local/etc/php/7.4/php.ini and /usr/local/etc/php/7.4/conf.d/php-memory-limits.ini.
Then I run:
brew services restart php#7.4
and
valet restart
If I then display phpinfo() in my project it still says memory_limit = 128M.
Here is how I solved this problem on mac:
I run: php --ini
It output:
Configuration File (php.ini) Path: /usr/local/etc/php/7.4
Loaded Configuration File: /usr/local/etc/php/7.4/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.4/conf.d
Additional .ini files parsed: /usr/local/etc/php/7.4/conf.d/error_log.ini,
/usr/local/etc/php/7.4/conf.d/ext-opcache.ini,
/usr/local/etc/php/7.4/conf.d/php-memory-limits.ini
I edited /usr/local/etc/php/7.4/php.ini
Restart php.
Still same issue.
Then I edited /usr/local/etc/php/7.4/conf.d/php-memory-limits.ini,
restart.
It worked.

Problems setting the php.ini path during Centos7 php installation

First of all, please forgive me for my poor English skills.
After installing the compilation of Apache, php5.3 on CenOs 7,
we have a problem with the path to set up php.ini
First of all, look at the setting value here.
Shell
PHP -r "phpinfo();"
Configuration File (php.ini) Path: /usr/local/php53/etc/php.ini
Loaded Configuration File: (none)
Scan for additional .ini files in: /usr/local/php53/etc/php.d
Additional .ini files parsed: (none)
Web
<? phpinfo(); ?>
Configuration File (php.ini) Path
/usr/local/php53/lib
Loaded Configuration File
(none)
Scan this dir for additional .ini files
/usr/local/php53/etc/php.d
Additional .ini files parsed
(none)
Found the php ini-production file in the source file.
Changed the asp_tag value in the php.ini file to On.
By changing the name to php ini.
Move to
/usr/local/php53/lib/php.ini
path
I started the Apache again, but the settings haven't changed.
I want to know how to change php.ini
Please reply.
Thank you for reading.

How to use the default php.ini file?

I installed php 5.6.6 as an apache 2.4 module.
When loading a page with < ? phpinfo(); ?>, it said :
Configuration File (php.ini) Path C:\Windows
Loaded Configuration File (none)
So, as the doc suggests, I edited httpd.conf to point php.ini configfile (in C:\php56).
I also added C:\php56 to PATH and PHPRC environnment variable.
As I don't have any php.ini file in this folder, I copied and renamed the "php.ini-production" one, and edited path to extensions.
When I display the page again, it stays blank ...
here is the "php --ini" command result :
Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File: C:\php56\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
Which step am I missing ?
Is it possible that the phpinfo function is disabled in your php.ini configuration (disable_functions option)?
If that is not the case try swapping to the development .ini file which by default reports more errors.

PHP CLI don't call good php.ini

I try to install a project via composer on my ubuntu.
When I run composer install I have the error :
[RuntimeException]
You must enable the openssl extension to download files via https
My apache is installed under /etc/apache2 and php in /etc/php5
I have installed openssl and when I check install with phpinfo(), I see openssl is correctly enabled.
I know composer invoke php command line.
So if I do this command :
php --ini
output
Configuration File (php.ini) Path: /usr/local/lib
Loaded Configuration File: (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
But there's no php.ini in /usr/local/lib
I don't know why php in command line take this configuration ?
thx
I removed my php binary under /usr/local/bin and php --ini command now return php5 configuration :
Configuration File (php.ini) Path: /etc/php5/cli
Loaded Configuration File: /etc/php5/cli/php.ini
Scan for additional .ini files in: /etc/php5/cli/conf.d
Additional .ini files parsed: /etc/php5/cli/conf.d/10-pdo.ini,
/etc/php5/cli/conf.d/20-curl.ini,
/etc/php5/cli/conf.d/20-gd.ini,
/etc/php5/cli/conf.d/20-mysql.ini,
/etc/php5/cli/conf.d/20-mysqli.ini,
/etc/php5/cli/conf.d/20-pdo_mysql.ini

mysqli.dll and mysql.dll not mentioned in phpinfo

I have read this post
and it didn't really help.
My php.ini file (http://www.edisk.cz/stahni/09234/php.ini_69.47KB.html) contains the correct path of ext directory.
While my ext directory contains a php_mysql.dll and php_mysqli.dll libraries, there's not a word of that in my phpinfo.
Is there a way to make it right?
http://prntscr.com/3707m
This is my error produced by php.exe.
You most likely have two separate php.ini files - one for your web server, one for the command line interface.
Make sure you're editing the correct file; Run:
php.exe --ini
which will give you output similar to the one below:
C:\>php --ini
Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File: C:\Path\To\Your\php\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
Now, edit the php.ini file and make sure that not only the following lines are un-commented:
extension=php_mysql.dll
extension=php_mysqli.dll
but also this one (which, according to the file you've posted, you have commented out at the moment):
; extension_dir = "ext"
The above one should be configured to point to your ext directory, where the php_mysql.dll file is stored. Like this (remember about double quotes):
extension_dir="C:\Path\To\Your\php\ext"
Hope this helps.

Categories