Tag: PHP

Ansible/win_get_url downloading 1KB file?

I have recently been looking at using Ansible for managing some Windows-based web servers.  Fortunately, I was able to get the authentication configured properly, but as soon as I got to downloading PHP, the Ansible win_get_url module started behaving oddly.  It downloaded some other files as I would have expected, but it would download the PHP distributable as a 1KB file.

Read full post… “Ansible/win_get_url downloading 1KB file?”

cURL error 77: error setting certificate verify locations: CAfile

I recently started randomly seeing the following error in a development environment for a PHP application that I am maintaining.

cURL error 77: error setting certificate verify locations: CAfile: c:\<<Path removed>>\cacert.pem CApath: none (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

What was weird was that the CA file existed at the path that was shown in the error.  Restarting Apache seemed to fix the issue for a little bit, but then the issue would come back.

Read full post… “cURL error 77: error setting certificate verify locations: CAfile”

Fluentd configuration for PHP errors

Lately, I have been working on centralizing the logs from all of our servers and application layers.  I decided to use Fluentd instead of Logstash because it claims better reliability without jumping through hoops (e.g. adding a kafka layer).

Anyways, working on the configuration, I noticed that it doesn’t have any default configs for PHP errors.  My quick google search didn’t reveal anything either.  So, I decided to write the regex myself.  Here is what I ended up with.  This also accounts for multiline stack traces.

<source>
 @type tail
 tag SERVERNAME.php.errors

 # Example
 #[03-Sep-2017 22:51:06 UTC] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 65536 bytes) in Unknown on line 0

 format multiline
 format_firstline /^\[(?<time>[^\]]*)\] (?<level>.+?):/
 format1 /^\[(?<time>[^\]]*)\] (?<level>.+?):\s+(?<message>.*)/
 time_format %d-%b-%Y %H:%M:%S %Z

 read_from_head true # Read the file from the start.

 path C:\webroot\php_errors.txt
 pos_file C:\opt\td-agent\tmp\hd-dev01.php.errors.pos
</source>