2

So, I have that question. I've installed xampp on my ubuntu, and I run my web system from there ( /opt/lampp/htdocs ). I can open my php web systems from navigator with no troubles. So now I want to run a php script from linux console, like this:

php -f file.php

but ubuntu tells me to install php7.0-cli or hhvm packages to run a php script on console. The real question is, that I've installed lampp running php there. Is there any chance to run a php script on console with the lampp's php service? or I have to install those packages for ubuntu anyway?

leirbag
  • 73
  • 1
  • 3
  • 8

2 Answers2

1

When you run:

php -f file.php

from the linux terminal you are excecuting the system php enviroment (in ubuntu you install it using apt-get install), if you need run the script with the LAMPP php environment you must run:

/opt/lampp/bin/php -f file.php

Cesar
  • 707
  • 3
  • 13
1

If you run this command repeatedly, you can set alias by appending the following command in the "~/.bash-aliases" file or by directly running the command in the terminal:

alias php='/opt/lampp/bin/php'