php - phpinfo() is not changed after changing php.ini - php

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

Related

php ini setting upload_max_filesize not working

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

Settings of php.ini seem to be overwritten using xampp

I want to load some extensions, but my changes in the php.ini file do not have any effect. I have xampp installed on Windows and set extension_dir in php.ini to "C:\xampp\php\ext", which is where xampp installed my extensions. But when I call phpinfo(), extension_dir is shown as C:\php\ext which is not correct.
Already verified that it's the correct php.ini and did some stop and start of apache.
Also, I checked the loaded modules with get_loaded_extensions(), but my desired extension -mbstring etc- aren't displayed.
Any help is appreciated.
Finally, it was an unexpected sign & somewhere else in the php.ini file. Found it by typing prompt php.

Debian php.ini not updating

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.

How to set default php.ini to be used, OSX Yosemite

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

Opcache does not get enabled

I've installed Apache 2.4.x webserver on Ubuntu and also PHP5.5.x from sources. I go to php installation folder and do find . -name "opcache.so". Then, to php.ini (same as in phpinfo()), I add zend_extension=/php5/lib/php/extensions/no-debug-zts-x/opcache.so, and opcache.enable=On (or 1) and restart Apache with apachectl restart. Then I check phpinfo() but opcache does not get enabled! Please help.
I think a wrong php.ini file might be used, but in phpinfo() it shows the path to file which I do edit. When I change maximum upload filesize from 2M to 4M in the php.ini, and restart Apache, it does not get changed in phpinfo()
Turns out, after compilation PHP would look for the ini file in /usr/local/lib rather than where I installed it despite
--with-config-file-path=PATH
Set the path in which to look for php.ini [PREFIX/lib]
To check it, you can run php --ini to see if the file has been read fine.
But now I'm seeing white screen when trying to load php files :)
Hope it helps.

Categories