“php artisan serve”在Mac OS中读取配置在哪里? [重复]



此问题已经存在 这里有一个答案:</ p>





  • 老兄,我的php.ini在哪里?



    13 answers

    </ span> \ n </ li>

    </ ul>

    </ div>

    我正在使用 php artisan serve </ code>运行我的laravel项目,但是我得到了 卡住因为我需要将一些重文件上传到服务器。 </ p>

    我一直在阅读 php.ini </ code>文件在Mac中的位置,我意识到mac有一个默认的php配置,如果不会被读取 从 php.ini </ code>至少你从 / etc </ code>复制 php.default.ini </ code>并在 / etc中创建一个文件</ 代码>名为 php.ini </ code>。 </ p>

    我已经在Linux上遇到过这种情况,事实证明,因为我正在运行 php artisan serve </ code>,所以配置来自 / etc / php / cli </ code>(老实说,我不记得确切的路径,但重点是它不是从 php.ini </ code>标准文件中获取的)但在Mac中 文件夹不存在,即使我复制 php.default.ini </ code>并将其保存在 / etc </ code>中,我的项目似乎忽略了该配置。 (这是有道理的,因为它必须从另一条路径读取它,就像在linux中一样)。 </ p>

    有人知道吗? 之前有人为此而苦苦挣扎吗?</ p>
    </ div>

展开原文

原文

This question already has an answer here:

I'm running my laravel project using php artisan serve, however I got stuck because I need to upload some heavy file to the server.

I've been reading on where php.ini file is in Mac, and i realized that mac has a default php configuration and if won't be read from php.ini at least you copy the php.default.ini from /etc and make a file in /etc called php.ini.

I already struggled with this on Linux, it turns out that since I'm running php artisan serve, the configuration was being taken from /etc/php/cli (Honestly i don't remember well the exact path, but the point is that it wasn't being taken from the php.ini standard file) but in Mac this folder doesn't exists, and even if I make a copy of php.default.ini and save it in /etc, my project seems to be ignoring that configuration. (which makes sense because it must be reading it from another path, just like in linux).

Does anyone know something about it? Has someone struggled with this before?

</div>

douya2007
douya2007 终端>php--ini
一年多之前 回复

2个回答

Write a <?php phpinfo();?> in anywhere and its output will show you the path of the loaded php.ini file.

douzen1880
douzen1880 如果您正在使用Artisan,则需要在终端中执行php -i。 Web服务器可能正在使用不同的php.ini(甚至完全不同的PHP版本)。
一年多之前 回复



我建议使用 phpinfo()</ code>获取 php.ini </ code>位置 然后在终端上运行它以检查是否使用了其他ini指令:</ p>

 #假设您的php.ini位于/etc/php/7.2/cli/  php.ini根据phpinfo()

grep -rEn post_max_size etc / php / 7.2 / cli
</ code> </ pre>
</ div>

展开原文

原文

I would suggest getting the php.ini location by using phpinfo() and then running this on your terminal to check if there are other ini directives used:

# assuming your php.ini is located on `/etc/php/7.2/cli/php.ini` according to `phpinfo()`:

grep -rEn post_max_size etc/php/7.2/cli

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐