Apache: Changes to php.ini not picked up - php

I know that this question is asked a thousand times, but none has given me the correct answer.
I'm trying to get mailhog working and therefor I need to change the sendmail_path. I haven't installed sendmail by the way. So I changed my php.ini file, but the changes aren't picked up.
When I run phpinfo() it tells me that the loaded configuration file is:
/etc/php/7.1/fpm/php.ini
I edited this php.ini file, restarted apache, but no success. I also restarted php7.1-fpm, no succes either. Restarting the whole server also does not change a thing.
When running from CLI, it uses a different php.ini file > /etc/php/7.1/cli/php.ini. I updated this .ini file, restarted apache and from CLI it works fine.
So the issue is that I can't get this working for php-fpm. What else can I do?

I got it fixed on in a different way.
I added a my.ini file in the /etc/php/7.1/fpm/conf.d/ directory. Added my own modifications to the file and restarted apache and fpm.
Now it picks up te changes and all is working. So the file is added to the Scan this dir for additional .ini files.

Related

Windows Apache 2.4 - PHP cuRL not loading even though extension is set in php.ini

I am trying to activate curl on my Apache Server. So far it does not load.
I edited the php.ini file to allow the extension:
And I made sure using phpinfo() that I was editing the proper configuration file.
I restarted the server twice and made sure in php.ini that the extension folder (C:\php7\ext) was loaded correctly but curl still does not show on my phpinfo() page.
Why is this?

Editing php.ini with MAMP 3.5 where is the right ini file?

I'm trying to edit my php.ini file to turn off short tags. Pretty standard.
phpinfo() tells me I am running PHP Version 5.6.10
I have edited 2 php.ini files so far, and neither has taken effect (yes, I restarted MAMP)
MAMP/conf/php5.6.10/php.ini
MAMP/bin/php/php5.6.10/conf/php.ini
Neither file changes the status of short tags
Can anyone direct me where/how to change my php.ini settings?
I really freaking miss WAMP. Whose bright idea was it to buy a Mac?!?
When you run phpinfo() you need to look for the value Loaded Configuration File. This tells you which php.ini file PHP is using in the context of the web server.
Aaannnnnnnnddddd I was being a dufus
I had been commenting the line out instead of changing to "Off"
as you version is 5.6.10, and supposed your apache2 server runing on ubuntu.
php.ini dir is
/etc/php5/apache2/php.ini
On my Mac, running MAMP I have a few locations that would contain the likely php.ini
So I edited the memory_limit to different values in the 2 suspected files,
to test which one effected the actual MAMP PHP INFO page details.
By doing that I was able to determine that this was the correct php.ini:
/Applications/MAMP/bin/php/php7.2.10/conf/php.ini

webserver: php.ini changes not taking effect

According to phpinfo() the following php.ini files are loaded:
Configuration File (php.ini) Path /etc/php5/cgi
Loaded Configuration File /var/www/vhosts/mywebsite.com/etc/php.ini
Scan this dir for additional .ini files /etc/php5/cgi/conf.d
I've made changes to php.ini found in /etc/php5/cgi - restarted server - NO Effect.
This file: /var/www/vhosts/mywebsite.com/etc/php.ini has the note:
DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY, SO ALL
YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.
The server has these php.ini files
/etc/php5/cli/php.ini
/etc/php5/cgi/php.ini
/etc/php5/apache2/php.ini
/opt/psa/admin/conf/php.ini
/var/www/vhosts/mywebsite.com/etc/php.ini
Could you please tell me which php.ini file should I look for?
If you want to add something to php.ini (as xdebug properties, for example), then you should use /etc/php5/cgi/conf.d folder (create or edit one of that files).
As for php.ini located in cgi - seems right that you've done. However, there still exists a possibility, that you can edit these files, but they are overwritten by general configuration by your provider. I would advice to check it locally, if the same configuration would work.
EDIT: /opt/psa/admin/conf/php.ini looks like a possibility of this variant.
Also I would advice to edit apache's php.ini, but it looks more like a magic path.
I had a syntax error at 1. line!
It was :[php] instead of [php].
PHP ignored my config file because it couldn't see a php section
For me that fixed everything; Run php -c 'path-to-php.ini'. It will show you more information.

I have configured curl but it does not work

I am using windows server and have ran the following code to find my php.ini.
<?php
infophp();
?>
Then uncommented the extension=php_curl.dll and set the extension path on my php.ini.
At last downloaded and installed curl and restarted my server but there is still no information about the curl in my info.php
I have php_curl.dll in my ext folder (extension folder), libeay32.dll and ssleay32.dll are also in root of my php folder.
I had this problem a few times and most of them web server was picking up wrong php.ini.
Make sure the one you are editing is being used. Try disabling php in it totally and running your script to find out. Just change
engine = On
to
engine = Off
and try it out. If you still see php info page, that means web server uses wrong php.ini.
If you use Apache, you can specify in httpd.conf which php.ini to use with
PHPIniDir "C:/path/to/your/php/dir"

Custom php.ini file not working in VPS hosting

I've tried going through Network Solutions tech support but didn't get it resolved ("You need to talk to Signature Support, which is $50").
I'm running some sites off of a Net Sol VPS account and need to change the upload_max_filesize setting (which is apparently set to a paltry 2MB by default) for the php server. I've added:
upload_max_filesize = 20M
post_max_size = 20M
max_execution_time = 6000
to the /httpdocs/cgi-bin/php.ini file (per NS's instructions), and then restarted apache, but when I run a phpinfo on that domain, the settings are not applied. It still says "2M" for the upload max.
I also tried adding this to the server root at /cgi-bin/php.ini as well, to no effect.
There is no /cgi-bin/.php/php.coalesced.ini file that I can see.
Any ideas? I'm losing my mind with this.
First thought is to check your phpinfo() output for the value listed in the "Loaded Configuration File" setting and make sure that it matches the file you've been editing.
You can't just litter PHP.ini files around and expect PHP to load them. If it's not been told to look for one in that cgi-bin directory, the file will just get ignored.
Check the phpinfo() output - the first section will tell you exactly what .ini files were located/parsed, and their location. e.g. on my home server:
Configuration File (php.ini) Path /etc/php5/apache2
Loaded Configuration File /etc/php5/apache2/php.ini
Scan this dir for additional .ini files /etc/php5/apache2/conf.d
Additional .ini files parsed /etc/php5/apache2/conf.d/curl.ini, /etc/php5/apache2/conf.d/gmp.ini, /etc/php5/apache2/conf.d/mysql.ini, /etc/php5/apache2/conf.d/mysqli.ini, /etc/php5/apache2/conf.d/pdo.ini, /etc/php5/apache2/conf.d/pdo_mysql.ini
if your cgi-bin .ini file isn't listed, then PHP is NOT looking in that directory.
I know this is old but figured I'd share my experience. I tried adding a php.ini file to the /cgi-bin folder as I read was suggested, that didn't appear to work. My solution was to SSH onto the server and make a change to the real php.ini file and then restarting the server.

Categories