0

I tried installing Blackfire. And it's working. However, I'm getting this warning, whenever I run a PHP-command:

PHP Warning: Module 'blackfire' already loaded in Unknown on line 0

Just like explained here: PHP Warning: Module already loaded in Unknown on line 0.

The solution there is, that the module is loaded more than once, which sounds like the problem I have as well.

The thing is, that I have two services handling PHP:

  • nginx
  • php7.4-fpm

How do I know which of them should load this Blackfire-library?


Further details

If I do this: `grep -R "blackfire" /etc/php/7.4/

then I get this:

./fpm/conf.d/99-blackfire.ini:[blackfire]
./fpm/conf.d/99-blackfire.ini:extension=blackfire.so
./fpm/conf.d/99-blackfire.ini:blackfire.log_level=1
./fpm/conf.d/90-blackfire.ini:[blackfire]
./fpm/conf.d/90-blackfire.ini:extension=blackfire.so
./fpm/conf.d/90-blackfire.ini:blackfire.agent_socket = unix:///var/run/blackfire/agent.sock
./fpm/conf.d/90-blackfire.ini:;blackfire.server_id =
./fpm/conf.d/90-blackfire.ini:;blackfire.server_token =
./fpm/conf.d/90-blackfire.ini:;blackfire.apm_enabled = 1
./fpm/conf.d/90-blackfire.ini:;blackfire.log_level = 3
./fpm/conf.d/90-blackfire.ini:;blackfire.log_file = /tmp/blackfire.log
./cli/conf.d/99-blackfire.ini:[blackfire]
./cli/conf.d/99-blackfire.ini:extension=blackfire.so
./cli/conf.d/99-blackfire.ini:blackfire.log_level=1
./cli/conf.d/90-blackfire.ini:[blackfire]
./cli/conf.d/90-blackfire.ini:extension=blackfire.so
./cli/conf.d/90-blackfire.ini:blackfire.agent_socket = unix:///var/run/blackfire/agent.sock
./cli/conf.d/90-blackfire.ini:;blackfire.server_id =
./cli/conf.d/90-blackfire.ini:;blackfire.server_token =
./cli/conf.d/90-blackfire.ini:;blackfire.apm_enabled = 1
./cli/conf.d/90-blackfire.ini:;blackfire.log_level = 3
./cli/conf.d/90-blackfire.ini:;blackfire.log_file = /tmp/blackfire.log
./mods-available/blackfire.ini:[blackfire]
./mods-available/blackfire.ini:extension=blackfire.so
./mods-available/blackfire.ini:blackfire.agent_socket = unix:///var/run/blackfire/agent.sock
./mods-available/blackfire.ini:;blackfire.server_id =
./mods-available/blackfire.ini:;blackfire.server_token =
./mods-available/blackfire.ini:;blackfire.apm_enabled = 1
./mods-available/blackfire.ini:;blackfire.log_level = 3
./mods-available/blackfire.ini:;blackfire.log_file = /tmp/blackfire.log

I can see that there is a fpm-folder and a cli-folder. And that there are two blackfire-ini-files: 90-blackfire.ini and 99-blackfire.ini.

How do I know which files is being used?

Nico Haase
  • 11,420
  • 35
  • 43
  • 69
Zeth
  • 2,273
  • 4
  • 43
  • 91
  • 1
    **Why** are there two files with the same content? Feel free to compare them, and remove one of them. `phpinfo()` lists which ini files are read – Nico Haase Feb 23 '22 at 09:30
  • You could also check whether the two duplicated files are symlinks of any other file – Nico Haase Feb 23 '22 at 09:31
  • The two configurations are normal. One is the fpm, the other CLI. You use one with your server, the other, well command line interface. What is off is including the same module twice in the same file. – ficuscr Feb 23 '22 at 09:36
  • Sorry my eyes didn't catch the 99 and 90 suffixes. So you actually have 4 files! Get that down to two. One for each the fpm and cli directories. As stated, can assume which you are using, and `phpinfo` can verify that. – ficuscr Feb 23 '22 at 09:54
  • Should I just delete the ones prefixed with `99-` ? Or do I need to do it some other way? – Zeth Feb 23 '22 at 09:55
  • Maybe leave the one with more rows of configuration. Delete the other. Read what the module [uses for settings](https://blackfire.io/docs/php/configuration) and you should be good. Tweak, add or comment out as desired. – ficuscr Feb 23 '22 at 09:56

0 Answers0