New answers tagged paths
The idea is the compiler turns .c file into .o, so-called object file. Next one uses ar to create a library, .a file that is supposed to contain several, hm, compiled C functions that one might reuse. Finally ld performs linkage, creating .so or ELF from specified .o and .a files. Because of this needless complexity most compilers are also front-ends for ld ...
Have you tried symlinking the php binary from /usr/bin? This is the command to achieve that (in your case): sudo ln -s /opt/lamp/bin/php /usr/bin/php
For me, this is logical: the $PATH is searched from the beginning to the end and the first matching executable will be run. See the following Q&A's on the same topic: Order of files to be executed in linux and how to change it How to correctly add a path to PATH? How does unix search for executable files? So, first found, first used!
After discussing with the OP in chat the output of dpkg -L g++ | grep bin was: /usr/bin /usr/bin/g++ /usr/bin/x86_64-linux-gnu-g++ However, when OP did file /usr/bin/g++ he got a file not found error. I'm not sure which of the below fixed the issue, but something did: First I had him try sudo apt-get purge g++ sudo apt-get update sudo apt-get upgrade ...
Top 50 recent answers are included