<p>I'm only 80% confident in this answer, but I'm pretty sure that runtime PHP <a href="https://secure.php.net/manual/en/function.ini-set.php" rel="nofollow"><code>ini_set</code></a> calls won't work with nginx running with FastCGI (which is what Craft uses to change the <a href="https://secure.php.net/manual/en/function.error-log.php" rel="nofollow">error_log</a> path.</p>

<p>Try setting that path directly in your <code>/etc/php5/fpm/php.ini</code> file.</p>

CC BY-SA 3.0
2016-08-11T14:43:36.077Z
After much fussing, figured this out.
Tim Kelty
CC BY-SA 3.0
2016-08-11T14:49:34.707Z
↑ Seemingly, any value for `error_log` (or maybe anything?) in `/etc/php/7.0/fpm/php-fpm.conf` will override even what is set in your pool conf. (e.g. `/etc/php/7.0/fpm/pool.d/mysite.conf`), `.user.ini`, and of course runtime `ini_set`. What I did was comment out the `error_log` line in `/etc/php/7.0/fpm/php-fpm.conf` and added php_value[error_log] = ... to Craft's storage path in my pool config.

Seems backward...what is especially confusing is looking at phpinfo, the values appear to be overriding, but wont actually work!
Tim Kelty
CC BY-SA 3.0
2016-08-11T16:54:38.897Z
Computers... AMIRITE?!
Brad Bell
CC BY-SA 3.0
2016-08-12T02:27:45.727Z
They're the worst. (╯°□°）╯︵ ┻━┻
Tim Kelty
CC BY-SA 3.0
2016-08-10T19:14:17.003Z
2016-08-10T19:14:17.003Z
Brad Bell
<p>Under Nginx/PHP-FPM, I can't get PHP errors logged to <code>craft/storage/runtime/logs/phperrors.log</code> as they should be.</p>

<p>Initially, errors weren't logging <em>anywhere</em>, but I discovered I needed:
<code>catch_workers_output = yes</code> in our PHP-FPM config.</p>

<p>Errors are now logging to <code>/var/log/php7.0-fpm.log</code>, but not to Craft's custom location.</p>

<nginx><logging><logs>
Getting PHP errors to log in Nginx/PHP-FPM
# Getting PHP errors to log in Nginx/PHP-FPM

(Asked by: username_0 on 2016-08-10)

Under Nginx/PHP-FPM, I can't get PHP errors logged to `craft/storage/runtime/logs/phperrors.log` as they should be.

Initially, errors weren't logging *anywhere*, but I discovered I needed:
`catch_workers_output = yes` in our PHP-FPM config.

Errors are now logging to `/var/log/php7.0-fpm.log`, but not to Craft's custom location.

**Tags:** nginx, logging, logs


---

## 1 answers

### Answer by username_1 on 2016-08-10. Score: 1 | Accepted answer

I'm only 80% confident in this answer, but I'm pretty sure that runtime PHP [`ini_set`](https://secure.php.net/manual/en/function.ini-set.php) calls won't work with nginx running with FastCGI (which is what Craft uses to change the [error\_log](https://secure.php.net/manual/en/function.error-log.php) path.

Try setting that path directly in your `/etc/php5/fpm/php.ini` file.

> **Comments:**
> **username_0**: After much fussing, figured this out.  
> **username_0**: ↑ Seemingly, any value for `error_log` (or maybe anything?) in `/etc/php/7.0/fpm/php-fpm.conf` will override even what is set in your pool conf. (e.g. `/etc/php/7.0/fpm/pool.d/mysite.conf`), `.user.ini`, and of course runtime `ini_set`. What I did was comment out the `error_log` line in `/etc/php/7.0/fpm/php-fpm.conf` and added php_value[error_log] = ... to Craft's storage path in my pool config.  Seems backward...what is especially confusing is looking at phpinfo, the values appear to be overriding, but wont actually work!  
> **username_1**: Computers... AMIRITE?!  
> **username_0**: They're the worst. (╯°□°）╯︵ ┻━┻  

---

