Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

where is php.ini on ubuntu [duplicate]

Tags:

I want change the limit of PHP upload file's size

And this is some information of the output my phpinfo:

Configuration File (php.ini) Path    /etc/php5/apache2
Loaded Configuration File    /etc/php5/apache2/php.ini

And this is the content of my php.ini file:

upload_max_filesize = 50M
post_max_size = 50M
memory_limit = 128M

Then I restart Apache 2, but the phpinfo shown is still:

upload_max_filesize    2M
like image 300
tinybai Avatar asked Jul 26 '12 04:07

tinybai


People also ask

Where is my PHP ini file in Ubuntu?

The default location for the php. ini file is: Ubuntu 16.04: /etc/php/7.0/apache2.

Where is my PHP PHP ini configuration file located?

user. ini file is the default configuration file for running applications that require PHP. It is used to control variables such as upload sizes, file timeouts, and resource limits. This file is located on your server in the /public_html folder.

How do I find PHP ini on Linux?

If you can access one of your PHP files, open it in a editor (Notepad) and insert phpinfo(); after <? php on a new line. This will tell you the php. ini location.

How do I know which PHP ini is being used?

Check php. ini in CLI (Command Line Interface): To know about php. ini, simply run on CLI. It look for Loaded Configuration File in output for the location of php.


3 Answers

I have solved my question.

There is a syntax error in php.ini in line 109, so the next all syntax does not execute.

like image 120
tinybai Avatar answered Oct 05 '22 03:10

tinybai


There is a good chance you didn't have permissions to modify the php.ini file. If you just browse to it via a normal folder window and click it Gedit (or whatever your default text editor is) won't be able to open it with write permissions.

You should be able to get away by sudo nano /etc/php5/apache2/php.ini (then your password at the prompt) and then changing the variables. Then be sure to write out (Ctrl + O) or make sure you confirm the save on exit.

like image 31
Fluffeh Avatar answered Oct 05 '22 03:10

Fluffeh


For anyone wondering why the php.ini modification is not applied even after all directives are fine and restarting the apache on ubuntu, try restarting apache with sudo

sudo service apache2 restart
like image 33
Rystian Avatar answered Oct 05 '22 05:10

Rystian