Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phalcon devtools not working

Tags:

php

phalcon

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?

like image 679
Torra Avatar asked May 21 '15 20:05

Torra


1 Answers

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.

like image 146
Gustavo Gomes Mendonca Avatar answered Sep 28 '22 12:09

Gustavo Gomes Mendonca