Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Bugs & Fixes 2 years ago
Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
I have installed LAMP in my ubuntu environment (16.04) which has apache, php (7.0.9), mysql...
Although the php functionality is there, when i type 'php -v' in the terminal, i get the message
The program 'php' can be found in the following packages * php7.0-cli * hhvm
which as i understand means that ubuntu does not recognise the php installation from LAMP .
Is there a way to tell ubuntu that there is a php installation in opt/lamp... in order to recognise it?
The message you see is triggered by a shell function called command_not_found_handle defined in your system wide bashrc (/etc/bash.bashrc). This function is called by the bash when you enter the name of a binary which is not found in the current PATH. On Ubuntu, this uses a tool called command-not-found to search your input against a package database and suggest a package that might contain the command you entered.
command_not_found_handle
/etc/bash.bashrc
Depending on how you installed your LAMP stack - by using apt-get a lot or unblobbing a big tar file - there are two answers to your question.
In case you did apt-get all the stack applications you just did not install the php-cli package. In that case you can do sudo apt-get install php7.0-cli and you are fine.
sudo apt-get install php7.0-cli
In your question you mention /opt/lamp which suggests that you did the unblob-a-tar thing. This means that you should have a php cli binary somewhere in a bin directory under your /opt/lamp. What you can do is
/opt/lamp
bin
/opt/lamp/bin/php -v
ln -s /opt/lamp/bin/php /usr/bin/php
bin/php is just an example here - your actual binary might be in a different directory under a different name. Replace it with the correct path once you found it.
bin/php
If you install a full binary package in /opt it might be a good idea to check if it and if so how it uses libraries that exist in your core system. You can do this by issuing ldd /opt/lamp/bin/php and check the paths of the libs that are printed. Sometimes you get into trouble when those binaries still use your system libs but expect different versions.
/opt
ldd /opt/lamp/bin/php
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 10 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 9 Answers
General Tech 2 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.