Question

I am trying to create new yii application on Ubuntu by calling:

sudo yii-project/framework/yiic webapp yiidemo

from my htdocs dicectory(XAMPP). The message I get is:

/usr/bin/env: php: No such file or directory

PHP is installed though. 'php -v' yelds:

PHP 5.5.11 (cli) (built: Apr  9 2014 14:29:14) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

My PATH looks like that('echo $PATH'):

/home/alan/home/alan/netbeans-8.0/bin/netbeans/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/lampp/bin

'php' seems to be in /opt/lampp/bin so the last entry.

Any advice on how to make it work and get rid of the error would be greatly appreciated :).

Was it helpful?

Solution

Solution:

1) Sudo PATH and user PATH differ. That's why 'sudo php -v' doesn't work.

User's path:

echo $PATH
/home/alan/home/alan/netbeans-8.0/bin/netbeans/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/lampp/bin

A proper way to echo sudo's path:

sudo /usr/bin/printenv PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

2) I've installed PHP from repositories. I can now call 'sudo php'.

sudo apt-get install php5-cli

Thanks Matt and guys from Ubuntu forums(spjackson & SeijiSensei)!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top