Torra
Torra

Reputation: 1282

Phalcon devtools not working

I'm attempting to install Phalcon Dev Tools on OSX. I have Phalcon installed and it works fine.

I've followed the instructions from here: http://docs.phalconphp.com/en/latest/reference/mactools.html

When I run the command phalcon in the terminal I get the following output:

Phalcon Developer Tools Installer
Make sure phalcon.sh is in the same dir as phalcon.php and that you are     running this with sudo or as root.
Installing Devtools...
Working dir is: /Users/me/phalcon-tools
Done. Devtools installed!

Now how do I use the devtools? When I enter phalcon commands the output is exactly the same as above, and continues to tell me that it's installed.

Am I missing something here?

I noticed in the phalcon.sh script, at the end it had:

if check_install; then
    php "$PTOOLSPATH/phalcon.php" $*
fi

So, if check_install passes, run phalcon.php. I've tried to run this script manually and nothing happens at the terminal.

$PTOOLSPATH is defined. I confirmed this using echo $PTOOLSPATH.

My /usr/bin/env php is correct and points to MAMP's PHP. I have Phalcon installed using MAMP at the moment. My PHP is correct:

which php
/Applications/MAMP/bin/php/php5.5.23/bin/php

Inspecting the phalcon.php script, and using xdebug, I detected the issue to be lying here:

if (!extension_loaded('phalcon')) {
    throw new Exception(
        sprintf(
            "Phalcon extension isn't installed, follow these instructions to install it: %s",
            Script::DOC_INSTALL_URL
        )
    );
}

So the Phalcon extension isn't loaded. Not sure why it's not printing the output of the exception in the terminal. But, PHP's error log is showing:

[21-May-2015 22:37:48 Europe/Berlin] PHP Fatal error:  Class 'Phalcon\Script' not found in /Users/me/phalcon-tools/phalcon.php on line 41

Now I'm stumped.

Edit:

Running php -m showed me Phalcon isn't installed. Which is odd, because I am using Phalcon in my web application, and it works fine. As you can see, I've loaded the extension in the php.ini.

enter image description here

The PHP version I'm using is:

PHP 5.5.23 (cli) (built: Apr  9 2015 19:29:27)

As you can see, Phalcon is in the correct directory:

ls /Applications/MAMP/bin/php/php5.5.23/lib/php/extensions/no-debug-non-zts-20121212
apcu.so
imagick.so
phalcon.so
...

And as you can see from phpinfo() it's installed ...

enter image description here

The following commands both give different results too:

Shows Phalcon as installed:

echo "<?php phpinfo(); ?>" | php > phpinfo.txt && cat phpinfo.txt | grep phalcon

Shows Phalcon not installed:

php -m

Any ideas?

Upvotes: 7

Views: 5718

Answers (3)

Hardik Satasiya
Hardik Satasiya

Reputation: 9693

May be in command line ini file phalcon is not installed so it is throwing error.

just type this command in terminal .

php --ini

then check the output the interesting line is

Loaded Configuration File:         /etc/php5/cli/php.ini

now try to check that

phalcon.so

is loaded there as well or not.

as for web and cli there are different phalcon.so file is provided so we need to inlcude "phalcon.so" in both files.

so phalcon.so is included in your web php.ini so its running smooth there and not it command line i guess.

Upvotes: 0

After trying a lot, I found out that the code shown in the reference is wrong:

ln -s ~/phalcon-tools/phalcon.sh ~/phalcon-tools/phalcon
chmod +x ~/phalcon-tools/phalcon

The proper way can be found in the github repo:

ln -s ~/phalcon-devtools/phalcon.php /usr/bin/phalcon
chmod ugo+x /usr/bin/phalcon

Basically, the link shouldn't be the script but the php file. Fixing that, I could run the dev tool properly.

Upvotes: 2

LCB
LCB

Reputation: 1050

I have the same problem with you. and I solved it as long as I add this two line into my ~/.bash_profile file.

export PATH=$PATH:/Users/scott/phalcon-tools
export PTOOLSPATH=/Users/scott/phalcon-tools

At first, I only add the first line into .bash_profile, and I got the same information with you.

Upvotes: 0

Related Questions