Changes in PHP.INI for OpenLiteSpeed not working - php

In a OpenLiteSpeed server I used php_info() to find the path to php.ini
Loaded Configuration File /usr/local/lsws/lsphp73/etc/php/7.3/litespeed/php.ini
Then I edited max_input_vars and tried several ways to restart OpenLiteSpeed to apply the changes, but nothing is working.
php_info() shows the old value of max_input_vars

As told by #qtwrk pkill lsphp fixed the problem

Related

php.ini says it's being read, but any customizations don't appear

I'm running PHP7.4 on an EC2 instance running Ubuntu / Apache2. After doing some updates (just with apt-get update, upgrade, etc.) my php appears to be screwed up. Everything is currently set to the default configuration. Modules can be loaded but any customizations to php.ini will not take effect.
Just to be clear, I've run phpinfo() in my web browser and it says the php.ini file loaded is:
/etc/php/7.4/apache2/php.ini
In this file, I have memory_limit = 3048M. I've restarted and reloaded apache multiple times. No matter what, phpinfo() always says that my memory_limit is 128M. memory_limit isn't the only thing, max_input_vars, max_input_time, any variable inside of the "loaded" php.ini file is not being loaded.
What could the issue be?
Figured it out. Apache wasn't warning me of any errors in my php.ini file. I went to /var/log/apache2/error.log and found the syntax error in my php.ini file.

changes php.ini file are being ignored

I am having a hard time with this.
I am trying to increase
post_max_size = 90M
upload_max_filesize = 50M
but my info.php is still showing default values 20M
I have tried many solutions available but no success.
One of those were: /questions/14327409/changes-to-upload-max-filesize-in-ubuntu-php-ini-will-not-take-effect
First answer seem to work for people but it would not work for me.
I created 30-user.ini file with these values but no luck.
(I checked correct path for config directory I double checked)
I am using ubuntu 16 server and php7.0
I restarted apache2 but not sure how to restart php, if thats required too.
Maybe putting those values into .htaccess file would help? but not sure how syntax should look like.
it might not be ideal solution, but as I could not get changes in php.ini file to work,
I added .htaccess file
php_value upload_max_filesize 100M
php_value post_max_size 105M
and it appear to be working now.
I still don't know why it would not work directly in php.ini file.
Not sure if you are using php 7.0 or php 7.0-fpm...
Using php-fpm, it is not enough to restart apache, you have to restart php-fpm.
For example, on an Ubuntu 20.04 server and php 7.4 fpm, i had to
/etc/init.d/php7.4-fpm restart
in order for my php.ini to get obeyed.

I have changed every last PHP.ini, *.ini related or unrelated on my server for setting post_max_size to 8000M but its not working

I have changed every last PHP.ini, *.ini related or unrelated on my server for setting post_max_size to 8000M but its not working.But atleast 50M will do my work.I am stuck here.
restarted server after changing every php.ini
httpd - k restart
even stopped server and start again.
but i cant see a small change in PHP.info
tried various tricks like
1) php_ini
2) .htaccess
3) .user.ini
but not getting desired result .Please help
I have dedicated server.With WHM and root access but still nothing working
CentOS release 6.8 (Final)
All the suggested answers make change in HTACESS or php.ini while i already changed on it. more than any time.
First create a phpinfo.php file within your web directory (ideally in the same folder where the scripts you are testing are saved) containing:
<?php
phpinfo();
Then access this file using a browser.
Right close to the top there is a line saying:
Loaded Configuration File /etc/php/some/path/php.ini
Edit the loaded php.ini file as follows:
; Maximum allowed size for uploaded files.
upload_max_filesize = 50M
; Must be greater than or equal to upload_max_filesize
post_max_size = 50M
Your question mentions only post_max_size, but if your form accepts files you need to change upload_max_filesize too.
After that you need to restart the web sever (apache?). If you are using php-fpm then you need to restart that process. I don't know about centOS, but for ubuntu commands can be:
sudo service apache2 restart
sudo service php-fpm restart
Reload the phpinfo file in your browser and check if both values have been updated.

php upload_max_filesize not changing

in my phpinfo(); I see that my php.ini file is in /etc/php5/cgi, I've changed there upload_max_filesize to upload_max_filesize = 2000M, but in my phpinfo(); I see that the value stays 2M, and when I upload a file it tells my that I exceed the maximum upload_max_filesize limit, why is that? I've restarted apache but nothing changed, any clues?
ps: using php as fastcgi
/etc/php/cgi/php.ini configures only php running in cgi mode (like in lighttpd). you need to make changes on /etc/php/apache2/php.ini
For Fedora 20, you can find your environment php.ini files in
/usr/share/doc/php-common/php.ini-development
/usr/share/doc/php-common/php.ini-production
or just do
locate php.ini
Go on ahead and apply the above changes there.
You don't need to restart the server. Just do
sudo service httpd reload

Trouble changing `upload_max_filesize` on nginx

I've see a few other similar questions on here, but most of the answers are Apache specific (dealing with their .htaccess file) and I'm using nginx.
I'm having trouble making my change to the upload_max_filesize in php.ini stick. I'm using nginx, php5 and wordpress on Debian.
When I run phpinfo() I see the following output:
Loaded Configuration File /etc/php5/cgi/php.ini
I then go to the relevant .ini file, change a few values, and then restart nginx. When I fire up a phpinfo() plugin I got for wordpress, it reports the values as unchanged.
I'm at a loss because phpinfo() reports that it is loading config values from the file that I've changed, but it doesn't report the changes.
You might be using FAST CGI:
[webserver] <----> [fcgi daemon]
`- [php]
If you restart the webserver, PHP is not restarted, so still has the old ini values because it didn't reload the ini file.
Restarting the fcgi daemon solves that issue, PHP will be restarted, re-reading the ini.
Some fcgi daemons have a command that reloads the child processes more gracefully. Depends on what you use.
For me the problem was a syntax error in the custom php.ini file, which I found after checking the error logs.
This might help the ones that are using php -i from the terminal to check php.ini settings.
In my case, I increased the upload_max_filesize from 2M to 20 MB by editing /etc/php/7.3/apache2/php.ini and restarted the apache by apachectl restart command.
I used php -i command from the Debian terminal to see the changes are in effect but upload_max_filesize was still 2M.
Then I realized settings readings came from /etc/php/7.3/cli/php.ini because I was using php -i from the terminal instead of phpinfo() function in a web page.
$ sudo service php7.4-fpm restart
Resolved my problem. change the php version to the one you using.

Categories