Location of php.ini? - memory-management

I have to increase my memory limit, but there is no php.ini anywhere on my server.
When I query php_info(), it says it's in a folder called web/conf, but there is no such folder on my server. I looked in every folder.

Run the script:
<? phpinfo() ?>
And you'll see the path under the "Loaded Configuration File" value/row.

Try to do a
find / -name "php.ini"
to locate your php.ini. If you have php installed, it will be there. If not, reinstall php.

If you don't have access to your php.ini file you can always set a configuration option at runtime with ini_set()

You can (re)install PHP by downloading this package and you can see a full tutorial over
here. Goodluck!

C:\xampp\php\php.ini
I found this here:PHP.ini location

Related

Unable to guess the MIME type as no guessers are available. How do I install php_fileinfo extension in cPanel?

I'm trying to upload an image with validation:
'image|mimes:jpeg,png,jpg,gif,svg|max:2048'
Works fine on local. But fails on cPanel.
The cPanel version is 90.0.6
I've tried a couple things inside cPanel. But I couldn't figure out how do I enable the fileinfo extension.
Please help.
Sorry, couldn't comment due to profile limitations that's why posting it in the answer section.
You can contact your hosting provider and ask them to enable the extension for you. There is no way to enable it by yourself in shared hosting.
Make sure your host provider added the extension file in their PHP config.
You can enable fileinfo extension from Cpanel,
Kindly Go to Software => Select PHP Version =>
enable the check box fileinfo to use fileinfo extension.
You should enable the following line in your php.ini and then restart your apache
extension=php_fileinfo.dll
Enabling mean just uncomment the line in your php.ini file
i.e: From this ;extension=php_fileinfo.dll to extension=php_fileinfo.dll
just remove (;) and save it then restart your apache.

Could not find driver Laravel

Sorry for bad english.
I've been trying to fix this error in Laravel "could not find driver".
error
I'm using wampserver. Please help me
configuration .env
I created a file with the code
<?php phpinfo(); ?>
PDO drivers exist.
PDO drivers
In my php.ini file i have this extension
extension=pdo_mysql
It's the first time i use Laravel :/
I couldn't find the solution
I think this problem is when you haven't installed php-mysql extension with your wamp installation of PHP. Take a look at your php configuration and enable it.
Create a file containing the following code
<?php phpinfo(); ?>
check it in your browser (for example: http://localhost/test.php)
then serach PDO drivers in this page (CTRL + F and type PDO).
1- If you don't see PDO drivers, You should add it , in your php.ini
"extension=pdo_mysql.dll"
2- Restart your Apache

Where does MAMP keep its php.ini?

I have recently got a mac an am not used to developing on a mac at all.
I have MAMP Pro 1.9.6.1. I did a locate on php.ini and got this:
$ locate php.ini
/Applications/MAMP/conf/php5.2/php.ini
/Applications/MAMP/conf/php5.3/php.ini
/Library/Application Support/appsolute/MAMP PRO/conf/php.ini
/private/etc/php.ini.default
I changed the name of all of them. Restarted MAMP. It loaded without a hitch (I know odd right?). I am using PHP version 5.2.
All of these files are now different names (done one by one for process of elimination).
So I figure restart the mac. Same, MAMP loaded no problems, even though all of the php.ini files had been move. On Lamp this that wouldn't even load. But either there is another php.ini file I'm missing (quite possible I don't know how to updatedb), MAMP is really intelligent and just pulls in all of them (less likely) or it doesn't use one.
Note: If this doesn't help, check below for Ricardo Martins' answer.
Create a PHP script with <?php phpinfo() ?> in it, run that from your browser, and look for the value Loaded Configuration File. This tells you which php.ini file PHP is using in the context of the web server.
I'm not sure if in MAMP (non-PRO) is the same, but MAMP overrides the modified php.ini everytime it starts.
In my case, I needed to use the MAMP menu to change my php.ini file (File -> Edit Template -> PHP -> PHP 5.xx -> php.ini).
To be clearer (as i read this thread but didn't SEE the solution, also if it was here!), I have the same problem and found the cause: I were modifying the wrong php.ini!
Yes, there are 2 php.ini files in MAMP:
Applications/MAMP/conf/php5.5.10/php.ini
Applications/MAMP/bin/php/php5.5.10/conf/php.ini
The right php.ini file is the second: Applications/MAMP/bin/php/php5.5.10/conf/php.ini
To prove this, create a .php file (call it as you like, for example "info.php") and put into it a simple phpinfo()
<?php
echo phpinfo();
Open it in your browser and search for "Loaded Configuration File": mine is "/Applications/MAMP/bin/php/php5.5.10/conf/php.ini"
The error was here; i edited Applications/MAMP/conf/php5.5.10/php.ini but this is the wrong file to modify! Infact, the right php.ini file is the one in the bin directory.
Take care of this so small difference that caused me literally 1 and a half hours of headaches!
The file you have to edit is in MAMP Pro and uses the php.ini file everytime it starts up.
Start MAMP PRO
Edit File > Edit Templates > PHP 5.3.2 php.ini
Restart MAMP Pro
Your changes should stick.
I don't know if you ever found an answer to this but I DIDN'T need MAMP PRO to do this. Simply goto the correct path by following what others have said. It's something like...
MAMP-> bin-> php-> php(your php version)-> conf-> php.ini
The key here is where you're editing the file. I was making the mistake of editing the commented part of the ini file. You actually have to scroll down to LINE #472 where it says "display_errors = Off and change it to On. Hope this helps any
Just run the following command from your terminal, it will show you your Loaded Configuration File easiest way I have ever found.
php --ini
Change /Applications/MAMP/conf/php5.2/php.ini if you are using 5.2 version of php. If you are using the 5.3 php version, edit the /Applications/MAMP/conf/php5.3/php.ini.
If you are using OSX Lion or OSX Mountain Lion, I recommend you using the default installation of apache and php.
Greets!
After running the MAMP server, you have php info link in toolbar
Once click, You will get all information about php
Probably the fastest way to access the PHP.ini for the currently loaded version of PHP in MAMP PRO (v.4.2.1):
Open MAMP Pro
Click on "PHP" under the "Languages" section on the sidebar
Tap on the arrow button right next to the drop-down that lets you select the "Default Version" of PHP.
It depends on which version of PHP your MAMP is using. You can find it out on: /Applications/MAMP/conf/apache/httpd.conf looking for the configured php5_module.
After that, as someone said before, you have to go to the bin folder. There you'll find a conf folder with a php.ini inside.
example: /Applications/MAMP/bin/php/php5.4.10/conf
Leo
After going through all the solutions here, the easiest way to find the loaded php.ini file is to go into phpinfo on the loaded MAMP webpage, which will show you the loaded php.ini file.
This will also confirm if the parameters you change, like max_file_size, have updated correctly.
On my Mac, running MAMP I have a few locations that would be 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
I only have the non-pro version of MAMP but just because it loads it doesn't mean the PHP file is being found/without errors.
I renamed my php.ini files and MAMP still started but Apache returned several errors.
What are you trying to change in your php.ini file?
I have checked all answers and of course I have used phpinfo() to check the exact location of php.ini. I don't see a File option in the menu bar on my mac. I changed both php.ini and php.ini.temp files in that folder. No vail.
Until I realized that I forgot to uncomment the modified always_populate_raw_post_data line.
I was struggling with this too. My changes weren't being reflected in phpInfo. It wasn't until I stopped my servers and then restarted them again that my changes actually took effect.

How to get Apache2.2 load the SQLite3 Class from PHP?

I am currently trying to get a working PHP environment on Windows, but for some reason Apache isn't able to execute e.g. print_r(SQLite3::version());, but says Fatal error: Class 'SQLite3' not found in C:\Program Files (x86)\Apache2.2\htdocs\index.php on line 8, while php.exe prints perfectly correct output.
In php.ini I only load extension=php_sqlite3.dll, nothing else. In httpd.conf I got PHPIniDir "C:/Program Files (x86)/PHP/" which enables Apache to handle normal php commands like echo phpinfo();.
Does anybody know what I have to do so SQLite3 works through Apache, too?
Thanks in advance!
EDIT:
Nevremind, solved it myself: The default line extension_dir = "ext" for Windows installations had to be changed to the absolute path, in my case extension_dir = "c:\Program Files (x86)\PHP\ext". This made it all work!
Run your phpinfo() and check if extension is loaded, if not, check Configuration File (php.ini) Path and Loaded Configuration File to see where it is looking for php.ini and which file is loaded. If it is correct, set display_startup_errors in your ini to on and look into apache error log to see if there are problems with loading some extension. I would guess that prior to loading sqlite you will need to load php_mbstring.dll

include_path is not updated as specified in php.ini

I set up include_path in php.ini.
Then I call phpinfo()
And include_path differs from that I specified in php.ini.
What can cause this?
I modified the same php.ini as specified in "Loaded Configuration File" in phpinfo() call.
php is called via apache module, I restarted apache - this also does not help.
I use Windows Vista, Apache/2.2.14 (Win32) PHP/5.3.1
I calls set_include_path("...") in the beginning of my php file, but this is good for temporary workaround only.
One possibility is that there's a .htaccess file somewhere that is getting in your way. You can override php.ini settings in .htaccess files. E.g, in your .htaccess:
php_value include_path <path>
Paste your include_path= entry from your php.ini. I know php.ini entries have to be on one line and you need to have your directories separated by colons, but otherwise theres no trick to it.
you need to make sure that your include_path starts with ".:" .

Resources