Linux php.ini 更改但在 ubuntu 中无效
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11662295/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
php.ini changes but not effective in ubuntu
提问by tinybai
I want change the limit of php upload file's size
And this is some information of my phpinfo.
我想改变php上传文件大小的限制
这是我的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:
这是我的 php.ini 文件的内容:
upload_max_filesize = 50M
post_max_size = 50M
memory_limit = 128M
Then i restart apache2,but the phpinfo show is also:
然后我重新启动 apache2,但 phpinfo 显示也是:
upload_max_filesize 2M
采纳答案by tinybai
I have solved my question.
there is a syntax error in php.ini in line 109,so the next all syntax not excute
我已经解决了我的问题。
php.ini 的第 109 行有语法错误,所以接下来的所有语法都不能执行
回答by Fluffeh
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.
您很有可能没有修改 php.ini 文件的权限。如果您只是通过普通文件夹窗口浏览到它并单击它,Gedit(或任何您的默认文本编辑器)将无法使用写入权限打开它。
You should be able to get away by sudo nano /etc/php5/apache2/php.ini
(then your password at the prompt) then changing the variables. Then be sure to Write Out (CTRL O) or make sure you confirm the save on exit.
您应该能够通过sudo nano /etc/php5/apache2/php.ini
(然后在提示处输入密码)然后更改变量。然后确保写出(CTRL O)或确保在退出时确认保存。
回答by Rystian
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
对于任何想知道为什么即使在所有指令都很好并在 ubuntu 上重新启动 apache 之后 php.ini 修改仍未应用的人,请尝试使用 sudo 重新启动 apache
sudo service apache2 restart
回答by user23946
I have the same problem and this solve it I have foound php.ini inside folder /etc/php5/cli/php.ini I make changes to it
我有同样的问题,这解决了我在文件夹 /etc/php5/cli/php.ini 中找到了 php.ini 我对其进行了更改
and restart apache sudo apache2ctl restart
并重新启动 apache sudo apache2ctl restart
I have already change /etc/php5/apache2/php.ini and restart apache by using sudo service apache2 restart but symfony doesn't see changes
我已经更改 /etc/php5/apache2/php.ini 并使用 sudo service apache2 restart 重新启动 apache 但 symfony 没有看到更改
I write it , it may help anyone
我写的,它可以帮助任何人
回答by Doberon
I use over ubuntu 14.10 the command:
我在 ubuntu 14.10 上使用命令:
sudo /etc/init.d/apache2 restart
须藤 /etc/init.d/apache2 重启
回答by Debs
I too had the same problem but then found that root permission is needed to edit php.ini file so just opened the terminal and wrote the following
我也有同样的问题,但后来发现编辑 php.ini 文件需要 root 权限,所以只需打开终端并编写以下内容
gksudo gedit /etc/php5/apache2/php.ini
and it perfectly worked!!
它完美地工作!!
回答by Mazino S Ukah
here is how i solved this issue on ubuntu after about 3 hours of debuging (PHP 7)
这是我在调试大约 3 小时后在 ubuntu 上解决这个问题的方法(PHP 7)
steps
脚步
1) run phpinfo() function and observe where the loaded php configuration file (php.ini) is
1)运行phpinfo()函数,观察加载的php配置文件(php.ini)在哪里
2) cd into that directory and update it to the new values
2) cd 进入该目录并将其更新为新值
3) reboot your server
3)重启你的服务器
4) it works !!
4)它有效!!