upload_max_filesize doesn't show in phpinfo - php

I just changed my PHP configs in php.ini like this :
post_max_size = 100M
upload_max_filesize = 100M
but can't see changes in phpinfo(). This function still displays 2M as upload_max_filesize. I'm using Wamp server (Apache 2.2.11, PHP 5.2.9). How can I fix this ?

You may have multiple ini files in your system. Go to your phpinfo and check for the following entry:
Loaded Configuration File
The file indicated there is the one you have to edit for your changes to take effect. Then restart Apache/Nginx.
Also, be aware that ini settings can also be changed at an .htaccess level and even at httpd.conf. So these will take precedence over settings in your php.ini.

Use the wampmanager menus to make sure you amend the php.ini file that Apache uses
wampmanager -> PHP -> php.ini
Click that link and it will open the php.ini file in the default editor, it could not be easier.
Dont forget to restart Apache when you have saved the php.ini, again using the menus
wampmanager -> Apache -> Service -> Restart Service

Related

Can't update php.ini on MAMP v4.4.1

I am learning to use wordpress and I'm trying to adjust the php.ini file to adjust the configuration for the minimum server requirements of my template. I am running MAMP 4.4.1 and Wordpress 4.9.4 on MAC osx High Sierra.
I have a fresh install of both and would like to update the following:
memory_limit 96M
max_input_vars 3000
max_execution_time 120
post_max_size 32M
upload_max_filesize 32M
When I navigate to "http://localhost:8888/MAMP/index.php?language=English&page=phpinfo"
I see
Configuration File (php.ini) Path
/Applications/MAMP/bin/php/php7.2.1/conf
Loaded Configuration File
/Applications/MAMP/bin/php/php7.2.1/conf/php.ini
I run sudo nano /Applications/MAMP/bin/php/php7.2.1/conf/php.ini
and edit the attributes listed above and comment out opcache.
I then stop the server and start the server. When I view phpinfo again the values have not changed.
How can I change the php.ini?
Original answer: Where does MAMP keep its php.ini?
I'm not sure if in MAMP (non-PRO) is the same, but MAMP overrides the modified php.ini everytime it starts.
In my case, I needed to use the MAMP menu to change my php.ini file (File -> Edit Template -> PHP -> PHP 5.xx -> php.ini)

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.

Edit php.ini file using DirectAdmin

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()

ini_get does not return the original config from php.ini

I use ini_get('upload_max_filesize') to get the value of upload_max_filesize
but it returns just 10485760.
Even I edit the upload_max_filesize in php.ini and restart Xampp's Apache I do not see a change.
In php.ini I have upload_max_filesize=100M and even I increased it too 200M.
ini_get('upload_max_filesize') just returns same value.
I am using Xampp v3.2.2 on Windows.
add <?php phpinfo() ?> to phpinfo.php file and locate it to root directory of your web server.
type http://localhost on your browser. Check your php.ini file location. Just search on the browser page as "php.ini" you would see the exact path.
If this is not the file you edited, I hope editing this file and restarting your xampp server would solve the problem.
But if not and you are sure it is the file you edited, try to stop apache services, from the services list. Edit this file, Then start apache service again.

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

Categories