cancel
Showing results for 
Search instead for 
Did you mean: 

how to find php.ini

how to find php.ini

I am trying to install an extension and ran into memory problem. 

The error message: mmap() failed: [12] cannot allocate memory php fatal error: out of memory

I read some instructions on Magento website and reckon i need to set the memory size in php.ini to 2GB. However, I am not able to find php.ini file. 

My website is on a shared server. I ran php --ini command and got below information 

php --ini
Configuration File (php.ini) Path: /usr/local/php70/lib
Loaded Configuration File: /usr/local/php70/lib/php.ini
Scan for additional .ini files in: /usr/local/php70/etc
Additional .ini files parsed: /usr/local/php70/etc/extensions.ini, /usr/local/php70/etc/limits.ini

But I can't figure out where /usr is......

7 REPLIES 7

Re: how to find php.ini

I contacted my web host and found that I only can have max 768Mb for memory_limit in php.ini because it is a shared server. Is there a way to get around this?

Re: how to find php.ini

Hi @WZ_OZES

 

Are you installing this extension using SSH terminal by running command ?

if issue solved,Click Kudos & Accept as Solution

Re: how to find php.ini


@Manthan Davewrote:

Hi @WZ_OZES

 

Are you installing this extension using SSH terminal by running command ?


Hi ManthanDave, yes I am using SSH terminal to run the commands.

Re: how to find php.ini

Hello,
You can pass run time memory limit

php -d memory_limit=4G your command

Hope it will help you.

Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: how to find php.ini

You can find your php.ini file from different OS based on below link,

where is my php.ini

 

Or you can run a command like pass memory limit in all command,

php -dmemory_limit=5G bin/magento setup:upgrade
php -dmemory_limit=5G bin/magento setup:static-content:deploy -f
php -dmemory_limit=5G bin/magento setup:di:compile
php -dmemory_limit=5G bin/magento indexer:reindex
php -dmemory_limit=5G bin/magento cache:flush

 

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: how to find php.ini

Thanks guys. But unfortunately php -d memory command doesn't work for me. I got error message after typing this command. I think my web server provider blocked this kind of operation because i use shared server.

however, I figured out a way to get around with this issue. I basically downloaded the extension to my magento folder and put it at the exact directory the developer specified. Then I did composer update. Then it worked and installed the extension for me.

This is the extension I tried to install https://marketplace.magento.com/sy-slider.html

 

On the other note, I saw there is someone talking about creating a swap file to overcome insufficient memory issue but I am unable to understand because that needs to know what operation system my server uses. Anyone can share some info on this?

Re: how to find php.ini

Check if this can help?

 

php -d memory_limit=-1 bin/magento [your_command]

-1 parameter is for unlimited memory.

---

Also please tell which is your memory allowed size in php.ini

 

Run this:

php -i | grep "memory"
Did you find it helpful? Please give "Kudos" or "Accept as Solution".
Meet 70+ extensions and templates for M1 & M2 in one place