Reputation: 507
I have a PHP app deployed on Heroku, but I can't seem to locate the apache error log. Using the command $heroku logs
I seem to get only the apache access logs. So a bunch of GET 200 OK etc, but no error information that is put into the error log locally, such as 'PHP Fatal error: blah blah'
Where do I access these error logs on Heroku, or how do I tell the app to write to Heroku's log like it does the local error log?
I feel like I'm overlooking something obvious but I can't seem to find a solution.
Upvotes: 20
Views: 9039
Reputation: 140
I my laravel project I achieve see the errors by issue
heroku config:set APP_DEBUG=true
Acess app again and the errors will showed in browser
Upvotes: 0
Reputation: 198
We had to add this to our buildpack in the bin/compile file:
cat >>boot.sh <<EOF
for var in \`env|cut -f1 -d=\`; do
echo "PassEnv \$var" >> /app/apache/conf/httpd.conf;
done
touch /app/apache/logs/error_log
touch /app/apache/logs/access_log
touch /app/apache/logs/php_error.log
tail -F /app/apache/logs/error_log &
tail -F /app/apache/logs/access_log &
tail -F /app/apache/logs/php_error.log &
echo "Launching apache"
exec /app/apache/bin/httpd -DNO_DETACH
EOF
We left the php.ini and https.conf settings mostly as-is.
Upvotes: 1
Reputation: 181
Try adding:
error_reporting(E_ALL);
ini_set("display_errors", 1);
To the very top of your PHP page/app
Upvotes: 3
Reputation: 1831
That is not related to Heroku way of deploying, but to your PHP configuration. The error_log
directive manages that.
The error_log
directive defines the name of the file where script errors should be logged. The file should be writable by the web server's user.
Upvotes: 0
Reputation: 695
After a lot of experimentation, it looks like you need to comment out error_log
in php.ini
and make sure log_errors = on
.. this should output your errors to stderr where the heroku logplex can pick up the stream, then monitor with heroku logs --tail
.. I launched a heroku facebook app and looked at their phpinfo() and copied the setup.
Upvotes: 6