ORDER BY clause is not in SELECT list

Just like problems with a old passwords you also might encounter the following SQL error when updating your MySQL version:

ERROR 3065 (HY000): Expression #1 of ORDER BY clause is not in SELECT list, references column 'piwigo.piwigo_images.file' which is not in SELECT list; this is incompatible with DISTINCT

The main reasons is: „As of MySQL 5.7.5, the default SQL mode includes ONLY_FULL_GROUP_BY. (Before 5.7.5, MySQL does not detect functional dependency and ONLY_FULL_GROUP_BY is not enabled by default. For a description of pre-5.7.5 behavior, see the MySQL 5.6 Reference Manual.)“ Source: MySQL docs

You have two options to solve this message: start your mysql server with –sql-mode=““ or set sql-mode=““ in /etc/my.cnf

November 24th, 2018

Fatal error: Uncaught PDOException: PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]

If you happen to update your MySQL it might happen that afterwards you get the following error message:

Fatal error: Uncaught PDOException: PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]

One (of a couple) possible solution could be to start your mysql server with the option „default-authentication-plugin“ and the „mysql_native_password“ value:

mysql.server start --default-authentication-plugin=mysql_native_password

It might also be necessary to alter your password as following:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password';

(But don’t forget to flush your privileges with FLUSH PRIVILEGES tho)

November 24th, 2018

Monitor changes on cli live

If you want to watch or monitor a certain process on the cli (to check if changes happen) you can use the „watch“ command. For example if you want to check if a ffmpeg process is going to start or quit use the following command:

watch -n 3 „ps afx | grep ffmpeg“

In this example the command „ps afx | grep ffmpeg“ will be refreshed every 3 seconds on the cli.

Juli 6th, 2018

Javascript: onclick and onblur priority issues

Imagine you have search input field which also opens a suggest container as soon as you begin to type. Also imagine you want the suggest container to vanish as soon as you leave the search input field. You put an onblur() event on your search input field. Now you also want to click on a value of the suggest container to execute a search. The problem now is, if you use an onclick() event for triggering the search via suggest container, the onclick() event will never be triggered. The onblur() of the search input is executed before the onclick() of the suggest container. To solve this issue just swap your onclick() with a onmousedown() event.  That solution let’s the browser automatically re-order the priorities of these event handlers.

Juni 15th, 2018

Query elasticsearch with uri and get parameters

If you want to query elastic search directly via uri you can use the source parameter. This parameter helps you to fire requests like this:

curl -XGET "http://localhost:9200/employee/_search?search_type=count&pretty" -d '{
  "aggregations": {
    "profile": {
      "terms": {
        "field": "_type"
      "aggs": {
        "hits": {
          "top_hits": {
            "size": 1


directly via URL/GET:

curl -XGET 'http://localhost:9200/employee/_search?search_type=count&pretty&source={"aggregations":{"profile":{"terms":{"field":"_type"},"aggs":{"hits":{"top_hits":{"size":1}}}}}}'


Source: stackoverflow

Juni 14th, 2018

How to replace master branch in git from another branch

If you happen to come into the situation that your master branch is screwed (e.g. by falsely merging and reverting other/old branches into the master) you might need to replace your master with another branch (like your develop branch). That is actually pretty easy, all you need to do is executing the following git commands:

git checkout develop
git merge -s ours master
git checkout master
git merge develop


After you executed the commands your master branch is completely up-to-date with your develop branch.

Source: stackoverflow

April 7th, 2018

„insert ignore on duplicate entries“ in Doctrine / Symfony

As it’s not possible to do insert or update ignore in doctrine, those who still want to ignore entities when they are already in the database might find this snippet useful:

$doctrine = $this->getContainer()->get('doctrine');
  foreach ($entities as $entity) {
    try {
      $em = $doctrine->getManager();
    } catch (UniqueConstraintViolationException $e) {


Calling $doctrine->resetManager(); is necessary as the entity manager will be closed otherwise and you will not be able to use it anymore.

Please be aware that the disadvantage of that solution is a huge performance decrease as we are flushing the entity manager every round.

Februar 16th, 2018

MacBook Camera(s) not working

If the build-in camera in your MacBook suddenly stopped working and/or it doesn’t recognize any external camera devices, hit the following bash command:
sudo killall VDCAssistant

Februar 1st, 2018

Composer: Not enough memory for installing Symphony Bundle

In case you’re getting the annoying memory message „PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 20480 bytes) …
Try this one: php -d memory_limit=-1 /usr/local/bin/composer require component

Januar 5th, 2018

Symfony Sonata Admin Bundle: Not saving foreign ID in a OneToMany relationship

If you’re setting up a one-to-many relationship between two entities, don’t forget to set the parent for your child entity as well. Otherwise you’ll end up saving the data without the foreign (parent) id in your database.

In your parent entity class:

public function setChildren($children)
  if (count($children) > 0) {
    foreach ($children as $child) {

  return $this;

public function addChild(Child $child)


The „$child->setParent($this);“ part is something that can be easily overseen …

For finally setting the children in the parent entity, you’ll have to add/modify your parent entity listener:

public function prePersist($parent)

public function preUpdate($parent)


Source: stackoverflow

Dezember 24th, 2017