Welcome to WebmasterWorld Guest from 18.232.171.18

Forum Moderators: phranque

php configuration mystery on localhost

changes in loaded config. file not registering

     
1:48 pm on Aug 6, 2019 (gmt 0)

New User

joined:Aug 20, 2018
posts: 22
votes: 0


I've set up a local development environment on a Windows 10 machine using the Windows Linux Subsystem. Everything's working fine, including PHP 7.2 FPM. Problem is, when I make changes in my loaded php.ini configuration file, they're not registering when I restart PHP or NGINX.

For example, I'm trying to increase my upload_max_filesize from the default 2M to 80M. I've edited /etc/php/7.2/fpm/php.ini, which is my loaded config. file, and I've also edited /etc/php/7.2/cli/php.ini (I changed post_max_size) as well.

But when I restart PHP and/or NGINX and check my phpinfo page, it still has the default 2M value for upload_max_filesize.

What is going on here? This is only happening on my local server, I can make this change no problem on servers I set up AWS.

What am I missing? Thanks.
2:40 pm on Aug 6, 2019 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12555
votes: 3


When you view your phpinfo page, search for this value to see where it is loading from:
Loaded Configuration File
Make sure it is loading from the expected configuration file.

If that is correct, then search in the same phpinfo page for your directive, upload_max_filesize. There are two columns, Local Value and Master Value. Master value is what is set during compile time or set in your main php.ini. Local will be from .htaccess or from an ini_set function.
4:00 pm on Aug 6, 2019 (gmt 0)

New User

joined:Aug 20, 2018
posts: 22
votes: 0


Thanks for your quick reply.

I checked phpinfo and I'm definitely using the loaded config. file.

Both columns have the default 2M value for upload_max_filesize. But the config file specifies 80M. Why isn't it picking up this value?
5:49 pm on Aug 6, 2019 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:Nov 13, 2016
posts:1193
votes: 280


- which value shows from the PHP cli ?

- if you try to change "another" option, does it work ?
6:09 pm on Aug 6, 2019 (gmt 0)

New User

joined:Aug 20, 2018
posts: 22
votes: 0


Here's what I got from command line:

doctor@ED-Workstation:/usr/share/nginx/html/peruvianlink.com/phpserver$ php --ini
Configuration File (php.ini) Path: /etc/php/7.2/cli
Loaded Configuration File: /etc/php/7.2/cli/php.ini
Scan for additional .ini files in: /etc/php/7.2/cli/conf.d
Additional .ini files parsed: /etc/php/7.2/cli/conf.d/10-mysqlnd.ini,
/etc/php/7.2/cli/conf.d/10-opcache.ini,
/etc/php/7.2/cli/conf.d/10-pdo.ini,
/etc/php/7.2/cli/conf.d/15-xml.ini,
/etc/php/7.2/cli/conf.d/20-bcmath.ini,
/etc/php/7.2/cli/conf.d/20-calendar.ini,
/etc/php/7.2/cli/conf.d/20-ctype.ini,
/etc/php/7.2/cli/conf.d/20-curl.ini,
/etc/php/7.2/cli/conf.d/20-dom.ini,
/etc/php/7.2/cli/conf.d/20-exif.ini,
/etc/php/7.2/cli/conf.d/20-fileinfo.ini,
/etc/php/7.2/cli/conf.d/20-ftp.ini,
/etc/php/7.2/cli/conf.d/20-gd.ini,
/etc/php/7.2/cli/conf.d/20-gettext.ini,
/etc/php/7.2/cli/conf.d/20-iconv.ini,
/etc/php/7.2/cli/conf.d/20-intl.ini,
/etc/php/7.2/cli/conf.d/20-json.ini,
/etc/php/7.2/cli/conf.d/20-mbstring.ini,
/etc/php/7.2/cli/conf.d/20-mysqli.ini,
/etc/php/7.2/cli/conf.d/20-pdo_mysql.ini,
/etc/php/7.2/cli/conf.d/20-phar.ini,
/etc/php/7.2/cli/conf.d/20-posix.ini,
/etc/php/7.2/cli/conf.d/20-readline.ini,
/etc/php/7.2/cli/conf.d/20-shmop.ini,
/etc/php/7.2/cli/conf.d/20-simplexml.ini,
/etc/php/7.2/cli/conf.d/20-soap.ini,
/etc/php/7.2/cli/conf.d/20-sockets.ini,
/etc/php/7.2/cli/conf.d/20-sysvmsg.ini,
/etc/php/7.2/cli/conf.d/20-sysvsem.ini,
/etc/php/7.2/cli/conf.d/20-sysvshm.ini,
/etc/php/7.2/cli/conf.d/20-tokenizer.ini,
/etc/php/7.2/cli/conf.d/20-wddx.ini,
/etc/php/7.2/cli/conf.d/20-xmlreader.ini,
/etc/php/7.2/cli/conf.d/20-xmlwriter.ini,
/etc/php/7.2/cli/conf.d/20-xsl.ini,
/etc/php/7.2/cli/conf.d/20-zip.ini

I changed error reporting to error_reporting E_ALL
Not showing in phpinfo.

I did a search for php.ini and got this:

doctor@ED-Workstation:/usr/lib/php/7.2$ locate php.ini
/etc/php/7.2/cli/php.ini
/etc/php/7.2/fpm/php.ini
/mnt/c/Program Files/PHP/v7.2/php.ini
/mnt/c/Program Files/PHP/v7.2/php.ini-development
/mnt/c/Program Files/PHP/v7.2/php.ini-production
/mnt/c/Program Files/PHP/v7.2/php.ini.wincache.bak
/mnt/c/Program Files (x86)/PHP/v5.3/php.ini
/mnt/c/Program Files (x86)/PHP/v5.3/php.ini-development
/mnt/c/Program Files (x86)/PHP/v5.3/php.ini-production
/usr/lib/php/7.2/php.ini-development
/usr/lib/php/7.2/php.ini-production
/usr/lib/php/7.2/php.ini-production.cli
8:57 am on Aug 7, 2019 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:Nov 13, 2016
posts:1193
votes: 280


it looks like your your PHP loads tons of .ini files. (may be it's common, I don't know, because I build my own PHP)

You can search for files containing "post_max_size", may be it's defined "also" in one of these .ini files.

edit: it might not be related to your case , but the "post_max_size" entry can be set in php.ini, .htaccess, httpd.conf or .user.ini (but it sounds like it concerns Apache configuration only, not nginx)
2:50 pm on Aug 7, 2019 (gmt 0)

New User

joined:Aug 20, 2018
posts: 22
votes: 0


I started checking those additional .ini files but none had the upload_max_filesize--basically they all just activate the various modules.

I also tried temporarily renaming that conf.d directory so none of those .ini files would load.

Still struggling to understand why my loaded configuration file doesn't seem to affect that setting...is something wrong with my php installation maybe? Should I try uninstalling and reinstalling?

What's weird is that this only is happening on my localhost environment...everywhere else I can configure php just fine.
2:56 pm on Aug 7, 2019 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:Nov 13, 2016
posts:1193
votes: 280


Sorry, but really, I have no idea what can be wrong.

I guess it's the same distribution that you re using on your local machine and your AWS one ?
4:06 pm on Aug 8, 2019 (gmt 0)

New User

joined:Aug 20, 2018
posts: 22
votes: 0


Yes, I believe it's the same.

I saw this in my nginx error log. Been Googling around but having trouble grasping what's going on other than fastcgi is being slow and nginx gets tired of waiting. Could this be pointing to a php configuration problem?. Can you make sense of it?

2019/08/08 11:53:36 [error] 1499#1499: *55 upstream timed out (110: Connection timed out) while reading upstream, client: 127.0.0.1, server: local.sunnypower.org, request: "GET /wp-admin/load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils,zxcvbn-async,moxiejs,plupload&ver=5.2.2 HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.2-fpm.sock:", host: "local.sunnypower.org", referrer: "https://local.sunnypower.org/wp-admin/profile.php?wp_http_referer=%2Fwp-admin%2Fusers.php"
5:58 pm on Aug 8, 2019 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:Nov 13, 2016
posts:1193
votes: 280


Sorry for the slyness of the question, but are you sure that your nginx is configured to access your local linux php, and not your remote server?
8:09 pm on Aug 8, 2019 (gmt 0)

New User

joined:Aug 20, 2018
posts: 22
votes: 0


Didn't even know that was possible...

Here's the relevant block of my nginx config:

 location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
root /usr/share/nginx/html;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members