7

I have xubuntu installation and xampp installed on my pc, and everything works great, but lately i am experimenting a little bit with laravel framework and a lot of tutorials and people just use php command in terminal, but for me to work i have to load a full path like

/opt/lampp/bin/php

and the file in bin/php links to proper php version.

That works but i would like to speed up a proccess a bit and to use just php as everyone else use and it's much simpler than to use full path.

So my question is how to set a path so i can use just php in my terminal.

I have read a couple tutorials and there are suggests of setting a path in ~/.bashrc

Or to use export

But none of them works for me.

Any suggestions?

18

Have you tried symlinking the php binary from /usr/bin?

Assume your XAMPP installation is in default location /opt/lampp

This is the command to achieve that (in your case):

sudo ln -s /opt/lampp/bin/php /usr/bin/php
2
  • I am getting this: ln: failed to create symbolic link '/usr/bin/php': File exists – Attila Naghi Feb 10 '18 at 18:41
  • 1
    @Chester remove the file and link again : sudo rm /usr/bin/php then ln -s /opt/lampp/bin/php /usr/bin/php again – Goba Mar 16 '18 at 10:01
0

Try sym-linking the PHP library from file and refer to this php file path /usr/bin/php wherever required.

sudo ln -s /opt/lampp/bin/php /usr/bin/php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.