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
Related
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 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.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.
I want to edit my php.ini file to allow file uploads. Running phpinfo() tells me that it is located at /usr/local/lib/php.ini. However, I am paying for hosting and can only make these changes via DirectAdmin.
How can I make the change I need to make to my PHP config using DirectAdmin?
Alternatively if the php.ini file is located on a shared host and the administrator is not willing to make changes (which often is the case) you can create a ".user.ini" file with the following settings to allow uploading of files. Just adjust the values to your requirements.
max_execution_time = value
max_input_time = value
post_max_size = value
upload_max_filesize = value
memory_limit = value
If you are using ubuntu server, php.ini file is found in apache2 dir
Open php ini file
sudo nano /etc/php5/apache2/php.ini
And change upload_max_filesize and post_max_size in order to increase uploaded file size limit.
Next restart apache server
sudo service apache2 restart
or
sudo /etc/init.d/apache2 restart
Now check phpinfo()
I want to upload 20 MB file in php, but file is not uploading.
i have changed the php.ini file but still file is not uploading.
Changes of php.ini file is below.
max_execution_time = 300
upload_max_filesize = 64M
post_max_size = 64M
any help will be appreciated Thanks
You have made the necessary changes in the php.ini file, however after doing the changes in your php.ini file you need to restart your HTTP server to use new configuration.
You need a restart Apache web server after changed in configuration of Apache file.
Restart Apache web server, enter:
# /etc/init.d/apache2 restart
If you are using Ubuntu use sudo:
$ sudo /etc/init.d/apache2 restart