what happens if php.ini is missing? - php

What happens if php.ini is missing? Does PHP load with a default configuration? In phpinfo(), it says the configuration file path is /etc, however it also says Loaded Configuration File (none). I went into /etc, and noticed there is no php.ini, only php.ini.default. PHP is working though, so I'm guessing it must load with default settings. Can anybody confirm this for me?

PHP has what amounts to a php.ini compiled into it. The php.ini file on the system is there merely to override those pre-compiled defaults. If there's no php.ini, the compile-time values are in charge.

It does load default settings, yes.

if php.ini is missing , u can choose one of this files and rename it to php.ini => this will give u the same results
php.ini-development
php.ini-production
I wish this can help ;)

Related

How to override the php.ini file settings in laragon?

When i upgrade my php version from 7.1 to 7.2 there is new folder include in
c:\laragon\bin\php
which is right. But when i edit the php.ini file and enable openssl and other extension, save it and restart than it will override by the previous php.ini. It happens to two three times. I think there is a global php.ini file. If it has then how can we override this php.ini files with other versions php.ini?
If anyone knows please describe it or give me suggestion. Thanks
I think you just installed php incorrectly in laragon, check the folder "C:\laragon\bin\php\php-7.3.21\ext" and if this folder is empty then that would mean there is no extension, even after activation it will not change the "php.ini" file. I had the same problem.
Looks like the response
I think there is a global php.ini file
..is wrong. Please change anything (extension) in the specific php directory that you will use. This is the php directory of laragon on my local, if I will use php version 8, then I change the php.ini file in "php-8.0.8-nts-Win32-vs16-x64".
Like 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.

php.ini unable to change upload_max_filesize

I am developing php applications on Ubuntu 13.04 and when i am trying to change the upload_max_filesize setting:
$ sudo gedit /etc/php5/apache2/php.ini
and restart apache the values do not change in my phpinfo() they stay at the default values
This is the path mentioned in the phpinfo:
Loaded Configuration File /etc/php5/apache2/php.ini
Those values can be read from more than one location. You only show one location (and yes there is a phpinfo showing only one location but there are other elements in phpinfo hinting additional ini locations and to tell you the truth: the phpinfo does not show all inis).
So actually this depends on your configuration (which can greatly differ as you've got an open system) and the only thing we can say for sure is that you
a) edited the wrong file -or -
b) made a mistake while editing the right file.
To fix your issue, edit the right file.
To find the right file, learn about your systems PHP configuration.
To learn about your systems PHP configuration, start removing the ini and see what happens.
To learn about how it works in general - not specific to your system - you can easily consult the PHP manual:
Runtime Configuration Docs
Try to check if there is any syntax error in your php.ini, if there is any, it will not take the changes.
also make sure that your php.ini is writable
Or if you are on Linux (same will apply for windows, just different path), check the error log file with the command like this:
$ tail -n 100 /var/log/apache2/error.log
after restarting apache server
This will show you the line of the error and its cause in case of the syntax error in php.ini.
Check also "Scan this dir for additional .ini files" and "Additional .ini files parsed"

Php.ini production vs development

I'm using XAMPP to develop on my localhost. I would like to remove the PHP notices and keep only the warnings. I know this is done through the php.ini file, however I'm having trouble locating it. I followed the path in phpinfo() and it led me to /xampp/php. Inside this folder are two php.ini files: one for production and one for development. I have set them both to the error reporting level I'd like, however I still receive notices which makes me believe that neither of these actually control error reporting. I'm using the latest version of XAMPP. So I guess my question is where is the true php.ini and what are these two other versions?
As of PHP 7 the regular php.ini file was removed and added with php.ini-production and php.ini-devlopment. In PHP's installation text file they state, "We advise you to use php.ini-production, because we optimized the default settings in this file for performance, and security."
So in short use the php.ini-production
First, make sure you're editing php.ini, not php-development.ini or php-production.ini or anything BUT php.ini. After that, ensure you restart your Apache server or your changes won't take effect.
Also, check out ini_set for setting ini values at runtime.
I had this confusion, in my computer, the php.ini file didn't appear with the .ini extension name visible - it was just php , and in the type column, it has the value 'configuration settings'
I downloaded php-8.1.0 from official website. php.ini or configuration settings file is not present in it. Instead it has been replaced by two files i.e. php.ini-development and php.ini-production.
My requirement was to edit the php.ini file in order to enable pgsql extension. Alas! there were not one but two .ini files. Being new to php, I made changes to both the files but it didn't worked.
After doing some research, I came to know that in the recent versions of php (not sure from which), user is provided with two .ini files. As name suggests, php.ini-development contains settings suitable for development environment and php.ini-production contains settings suitable for production environment. As per your requirement, you need take backup of anyone of the file and rename that file to php.ini. In this file you will need make required changes for your php environment.
If you compare the two files using tools such as diff-merge, you will get more in-depth understanding.
php.ini.development and php.ini.production are entirely different from php.ini.
the problem is that in the php folder the required php.ini is not marked along with its extension ( .php). Only php is written.Check the properties of the file 'php' of "*configuration settings*" type.it must be .ini,This is the exact file which manages error reporting.
In XAMPP version 1.8.1 php.ini file located at \xampp\php\php.ini modify line 922 upload_max_filesize = 2M
Note: 2M means 2MB, so change to 10M for 10MB file upload. Also note that php.ini-development and php.ini-production are different files from php.ini.
My issue is that I was editing the php.ini-production and overlooked the standard php.ini file.
I edited the php.ini file by adding extension=php_odbc.dll and it fixed the error.
PHP 5.3.0 has significantly improved performance and parsing of INI files, and adds several new syntax features.
The standard php.ini files have been re-organized and renamed. php.ini-development contains settings recommended for use in development environments. php.ini-production contains settings recommended for use in production environments
The PHP.ini file is still there, only it doesn't include the extension .ini, the extension has been removed. You will notice two file name php, one is application file another is configuration setting when you open configuration setting in notepad you will notice that it has ini extension. so the php configuration file is ini file.

Categories