Category Archives: php

Historical Euro Rates via PHP

Just a promo post for a newly published Github repo https://github.com/mikaelz/HistoricalEuroRates

Posted in php | Tagged | Leave a comment

Phinx migrate in PHP without CLI

I wanted to run Phinx‘s migrate from PHP without CLI and thanks to https://github.com/robmorgan/phinx/issues/137#issuecomment-26220408 I got it working: The result:

Posted in php | Tagged , | Leave a comment

Composer memory limit errors

According to docs https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors I ended up aliasing composer command: alias composer=”php -d memory_limit=-1 $(which composer)”

Posted in cli, php | Tagged | Leave a comment

Fixing MailChimp error “Data did not match any of the schemas described in anyOf.”

While PUTing subscribers into MailChimp I got a bunch of “Data did not match any of the schemas described in anyOf.” error responses from the API server. Tried googling, but with no luck. Second try was to look at the … Continue reading

Posted in php, Uncategorized | Tagged , | Leave a comment

Fixing “Automatically populating $HTTP_RAW_POST_DATA is deprecated”

To reproduce try: curl -X POST -H “Content-Type: application/json” -d “{foo: bar}” http://example.com Great explanation can be found at https://www.bram.us/2014/10/26/php-5-6-automatically-populating-http_raw_post_data-is-deprecated-and-will-be-removed-in-a-future-version/ For me the solution on the shared hosting was adding the following line in .htaccess: php_value always_populate_raw_post_data -1 Thanks to https://www.drupal.org/node/2485847#comment-10068266

Posted in php, Uncategorized | Tagged , | Leave a comment

Custom PHP errors with int value

I needed custom PHP errors set via .htaccess <IfModule mod_php5.c> php_value error_reporting 674 </IfModule> According to docs about errors predefined constants I had to add the values of errors I wanted to see. Inspiration for the number came from comment. So … Continue reading

Posted in php, Uncategorized | Tagged , | Leave a comment

Solving No matching global declaration available for the validation root.

Had to create a custom XML for Pohoda accounting software, but hit some errors so I decided to make a PHPUnit test for validating it against its XML schema definition (XSD) with PHPs DOMDocument::schemaValidate /** @test */ public function validateStockXml() { $this->pohoda->createStockXml(); $xml = new … Continue reading

Posted in php, Uncategorized | Tagged , , , , | Leave a comment