I can't seem to get my max_upload_filesize to change despite updating the the php.ini file. Here is a screenshot of the loaded config file, upload_max_filesize in the phpinfo() and the php.ini open along side it:
https://drive.google.com/file/d/0B3b3kShpACJHcFV6YU9XMkdyR0E/view?usp=sharing
after updating the file I've tried:
sudo /etc/init.d/apache2 restart
and I've also tried to stop/start it:
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 start
the phpinfo() says the config loaded is:
/etc/php5/apache2/php.ini
but when I run:
php -i | grep "php.ini"
it returns the following:
Configuration File (php.ini) Path => /etc/php5/cli
Loaded Configuration File => /etc/php5/cli/php.ini
So I've updated this config file also to 100M and restarted apache, stop and started it again but yet my phpinfo() is still showing 2M max upload.
What could the problem be?
UPDATE! I have deleted both the php.ini files on my system in etc/php5/cli and etc/php5/apache2 and restarted but it still says its loading the config from etc/php5/apache2 hos is this possible when I've completely removed the file?
Your cli command php and your Webserver use different php.ini files. That why you have to change both of them.
And you have to change post_max_size in your php.ini, too. Otherwise you can't send enough data to your webserver.
Related
I am trying to update memory_limit in php.ini, but I don't see the value updated in phpinfo(). Here is the ini file path info from phpinfo():
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /etc/php.ini
Updated /etc/php.ini and then ran:
systemctl restart httpd
I tried updating other values in ini file to see if anything gets updated, but nothing does.
I am on an AWS EC2 linux instance with wordpress.
Many modern PHP installations run PHP-FPM by default, instead of as an Apache module mod_php. PHP-FPM is itself a separate service that needs to be restarted via your operating system's preferred method. e.g.
$ sudo systemctl restart php-fpm
You mentioned you already knew which php.ini to modify from the phpinfo() output. For future readers, the PHP-FPM service may use a different php.ini. Consult the output from phpinfo() when loaded via the web to find out which php.ini to modify.
I need to change upload limit to 2GB on php 7.2 Ubuntu 16.04.
As a first step, when I check /etc/php/7.2 folder I can see cli and
fpm folders.
So to make sure the ini location I have print the php info using
echo phpinfo()
And I got the output
Server API : FPM/FastCGI
Virtual Directory Support : disabled
Configuration File (php.ini) Path : /etc/php/7.2/fpm
Loaded Configuration File : /etc/php/7.2/fpm/php.ini
And I have edited /etc/php/7.2/fpm/php.ini with
upload_max_filesize = 2048M
And restarted the apache but using phpinfo() still it print
upload_max_filesize 2M
So I have tried with command php -i | grep -i "loaded configuration file" but it print different configuration file,
Loaded Configuration File => /etc/php/7.2/cli/php.ini
On this file also I have changed upload_max_filesize to 2048 and restarted the Apache and still the result is same.
What could be the problem, any help will appreciated.
I got the problem resolved by the answer here Changes to upload_max_filesize in Ubuntu php.ini will not take effect.
Instead of restarting the apache I have to restart the php using
sudo service php7.2-fpm restart
You should also change in php.ini:
post_max_size=2Gb
first at all you should remove all older php version on your ubuntu.
what is your cli php version?
are you sure that you find correctly php.ini location?
please run this command " locate php.ini "
Sometimes due to error in php.ini files the configuration files are not loaded after that specific error line. In that case you have to thoroughly check the php.ini file and fix the errors.
Alternatively you can download fresh php.ini files for your php version and replace your existing file with the new one.
After making changes in the new file restart your server using service apache2 restart .
If changing /etc/php/7.2/fpm/php.ini and /etc/php/7.2/cli/php.ini still does not work out, try changing /etc/php/7.2/apache2/php.ini. Please note that you might have to restart the apache2 server using sudo service apache2 restart. (This solution is tested on server with Ubuntu installed. )
I'm on Mac OS X Mojave
Step 1
I ran
php -i | grep php.ini
I got
Configuration File (php.ini) Path => /usr/local/php5/lib
Loaded Configuration File => /usr/local/php5/lib/php.ini
Step 2
I open up the ini file
vi /usr/local/php5/lib/php.ini ,
and update memory_limit to -1
Step 3
I ran
php -i | grep memory_limit
I got
memory_limit => 256M => 256M
Step 4
I restart my
sudo apachectl -k restart
and type in my password
and tried
php -i | grep memory_limit
again, I still got
memory_limit => 256M => 256M
Seems like my chages never take any effect ...
Do I need to start any service on a Mac? If so, what command to do that?
phpinfo
Edit:
Create an empty php file with:
<?php phpinfo(); ?>
Load it with your web browser (localhost/yourfile.php).
Check that:
"Loaded Configuration File" match the configuration file you changed.
"memory_limit" has the value it is supposed to have.
I usually install a "clean" php using Brew. So here a few questions to be sure:
Do you use php as cli or with Apache/Nginx? (It might be 2 config files)
If you're using Apache, did you restart it? (sudo apachectl -k restart)
Did you try with a more conventional value (like 2048M)? I'm not sure -1 is always supported.
The answer is simple.
The PHP INI file which you have edited and the INI file that is loaded in Apache server is different..
You have to update the PHP loader in the apache httpd.conf file.
After that restart the apache server with sudo apachectl restart.
Finally, now you can test the PHP ini file loaded in apache2 with phpinfo();
Though It is old question still many people struggle. So thought to answer it.
Installed php.ini is located at /usr/local/php5/lib/php.ini (or it
can be at /usr/local/etc/php/7.3/php.ini )
php.ini used by Apache
are different, which is /etc/php.ini.
vi /usr/local/php5/lib/php.ini
so above changes to php.ini does not reflect in Apache. Solution is to point to correct PHP in your apache config file.
sudo vi /etc/apache2/httpd.conf
Search for pattern "LoadModule php" and comment the existing line with libexec and add below line to your installation.
#LoadModule php7_module libexec/apache2/libphp7.so
LoadModule php7_module /usr/local/opt/php#7.3/lib/httpd/modules/libphp7.so
Restart your apache
sudo apachectl restart
Check log file
tail -f /var/log/apache2/error_log
When i change content of "php.ini" file that placed in "Configuration File (php.ini) Path" in phpinfo() ,file had been changed but phpinfo() shows unchanged settings.
I'm using Elastix on centOS. This is caused after I install phpmyadmin and after that seseeions did not saved and I wanted to change session.savepath.
don't forget to restart your service
for example for Apache
/etc/init.d/apache2 restart
I set up a new environment using OSX Yosemite.
I'm using the built-in PHP.
I'd like to change some config in php.ini such as date.timezone but none of the modifications are working despite restarting the apache server (sudo apachectl restart).
phpinfo() is giving a different path than php --ini command.
phpinfo():
Configuration File (php.ini) Path /usr/local/php5/lib
Loaded Configuration File /usr/local/php5/lib/php.ini
Via commands :
which php
/usr/bin/php
php --ini
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /etc/php.ini
Scan for additional .ini files in: /Library/Server/Web/Config/php
Additional .ini files parsed: (none)
So I guess I have to tell somewhere where I should set the default php.ini to be used.
Any ideas, hints?
move the configuration file to the right spot and update the timezone.
$ sudo cp /etc/php.ini.default /etc/php.ini
Open the config file /etc/php.ini, find the line that sets your timezone and update it correspondingly.
date.timezone = Europe/Berlin
Do not forget to remove the ; at the beginning.
Restart the Apache server to have PHP load the new .ini file.
sudo apachectl restart
SAPI module specific location (PHPIniDir directive in Apache 2, -c command line option in CGI and CLI, php_ini parameter in NSAPI, PHP_INI_PATH environment variable in THTTPD)
http://php.net/manual/en/configuration.file.php
Try changing PHPIniDir in httpd.conf.
On mac sierra with php7.1, edit /usr/local/etc/php/7.1/php.ini won't work, you can edit like this:
1) cp /etc/php.ini.default php.ini
2) edit php.ini to add
date.timezone = Europe/Berlin
then restart your apache,
Short answer: If you're on mac and you have the file /usr/local/php5/php.d/99-liip-developer.ini then edit timezone there and it will effect php-cgi (web-browser)
Long answer:
n mac system for few settings like timezone php.ini file (showing loaded in phpinfo) don't work. Because sometimes we unknowingly install php packaged by Liip. That's why apache picks up few settings from liip-developer.ini config file which is usually located at /usr/local/php5/php.d/99-liip-developer.ini