code-8
code-8

Reputation: 58632

How to find the right php.ini that your Apache is using?

I'm a bit confuse on my PHP versions on my local Mac OS X.

When I ran

⚡️  ~  which php                                                                                                 
/usr/local/php5/bin/php                                                                                         
⚡️  ~  php --version                                                                                             
PHP 7.3.8 (cli) (built: Aug 11 2019 20:50:16) ( NTS )                                                           
Copyright (c) 1997-2018 The PHP Group                                                                           
Zend Engine v3.3.8, Copyright (c) 1998-2018 Zend Technologies                                                   
    with Zend OPcache v7.3.8, Copyright (c) 1999-2018, by Zend Technologies                                     
    with Xdebug v2.7.2, Copyright (c) 2002-2019, by Derick Rethans                                              
⚡️  ~ 

so this means my CLI version is 5 or 7.3 ?? 😵 !


When I run

php -r "echo ini_get('memory_limit').PHP_EOL;"

I got

256M

the result of that matched with my Apache PHP

See picture below

enter image description here

phpinfo()

enter image description here

I really need to update the meory_limit. How do I find php.ini of my Apache use?


Updated

I tried to modify /usr/local/php5/lib/php.ini

and set memory_limit = 40096M ~40GB

enter image description here

I never see that settings take place.

Upvotes: 0

Views: 51

Answers (1)

PKeidel
PKeidel

Reputation: 2589

Maybe you should just rename /usr/local/php5 to /usr/local/php and the confusion is gone ;)

On your phpinfo() page is a section called "Loaded Configuration File" and "Additional .ini files parsed". These are the files to edit.

I am not sure if there is an upper limit for memory_limit. Maybe just try to set it to -1 to disable it.

Some php installations use different .ini files for running in a cli and running in a browser, to check what .ini files are used on command line use php --ini.

Upvotes: 1

Related Questions