0
Software: MacOS
Phalcon: 5.0.0RC4
Phalcon/Devtools: 4.2.0

I have newly created phalcon 5.0 repository. I successfully ran

composer install
composer require phalcon/devtools

however when I try to run a phalcon command I get

zsh: command not found: phalcon

I checked if it had installed successfully and tried reinstalling as well.
php -m returns that phalcon is installed too:

php -m | grep phalcon
phalcon

and the extension is there in the php.ini file

extension="phalcon.so"

Am I missing anything?

2 Answers 2

0

The phalcon/devtools package links the phalcon.php executable to your composer bin-dir.

Get it as follows:

composer config bin-dir

It defaults to ./vendor/bin. The installed symlink is ./vendor/bin/phalcon.php.

You can run the command as follows:

./vendor/bin/phalcon.php [..]

To ease access you can automatically add ./vendor/bin to your PATH (i.e. with direnv)

# .envrc
PATH_add ./vendor/bin

or you can create a ./bin dir in your project directory and symlink phalcon.php as phalcon into it.

mkdir ./bin
ln -sfn ./vendor/bin/phalcon.php ./bin/phalcon

Now you can add ./bin to your PATH:

export PATH="${PWD}/bin:${PATH}"

And invoke the phalcon CLI with:

phalcon [..]
1
  • Thanks! quick not that for me the path was ./vendor/bin/phalcon without the php. Also there was still an issue of compatibility between phalcon 5 and devtools 4.2, so the command still did not run. Aug 17, 2022 at 1:36
0

Adding to Nicolai's answer, it is also possible to just call phalcon like so:

vendor/bin/phalcon commands

In my case, I didn't want to be able to call phalcon globally so I copied the file into the project directory and named it phalcon4
Then I edited the paths inside the file like so

$addpath = '/vendor/phalcon';
$GLOBALS['_composer_bin_dir'] = __DIR__ .$addpath;
$GLOBALS['_composer_autoload_path'] = __DIR__ .$addpath. '/..'.'/autoload.php';

// the rest of the code

include __DIR__ .$addpath. '/..'.'/phalcon/devtools/phalcon';

Now I can run the command like this:

php phalcon4 commands

Still, devtools 4.2 cannot run with phalcon 5 so the command just threw an error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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