I'm trying to get formatted output from mysql as it normally shows when executed from a shell. This is discussed here and here, but it's not working for me.
When I run this in my shell for instance:
mysql -e "select language_id, name, image from `language`;" my_database
I get the expected output:
+-------------+-----------+--------+
| language_id | name | image |
+-------------+-----------+--------+
| 1 | English | gb.png |
| 2 | Français | fr.png |
+-------------+-----------+--------+
But when I do the same thing from the php cli:
passthru('mysql -e "select language_id, name, image from `language`;" my_database');
It comes out with no formatting:
language_id name image
1 English gb.png
2 Français fr.png
I've tried passthru, system, exec, and shell_exec but all return the same unformatted output. Why is the output different when run from php?