Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Phalcon devtool error in ubuntu 15.04 when executing phalcon command in terminal

Hi guys,

I have installed phalcon php already and it is now loaded on my phpinfo but im getting a problem here about phalcon dev tool in my ubuntu 15.04 machine when running phalcon command on my terminal,

PHP Fatal error: Class 'Phalcon\Script' not found in /home/stvn/phpFrameWorks/phalcon-devtools/phalcon.php on line 40

I downloaded the source from git and followed every steps as mentioned from this URL

https://docs.phalconphp.com/en/latest/reference/linuxtools.html

Here is how i create a symlbolink link

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

Thanks in advance

Yo, try to use the absolute path instead of the prepended home path

@Lajos i havent tried it yet thnks

@Lajos I have tried $ sudo ln -s /home/stvn/phpFrameWorks/phalcon-devtools/phalcon.php /usr/bin/phalcon but doesnt work. Is this wrong?

Hmm... you may have stumbled upon a bug, the Script class is invoked before actually loading it. Anyhow, the phalcon.so is probably not loaded. Run php -i | grep phalcon, if it's empty you don't have Phalcon installed for CLI.

@Lajos here is what I got when running the command

PTOOLSPATH => /home/stvn/phpFrameWorks/phalcon-devtools/ PATH => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/stvn/phpFrameWorks/phalcon-devtools:/home/stvn/phpFrameWorks/phalcon-devtools:/home/stvn/phpFrameWorks/phalcon-devtools _SERVER["PTOOLSPATH"] => /home/stvn/phpFrameWorks/phalcon-devtools/ _SERVER["PATH"] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/stvn/phpFrameWorks/phalcon-devtools:/home/stvn/phpFrameWorks/phalcon-devtools:/home/stvn/phpFrameWorks/phalcon-devtools



38.6k
Accepted
answer
edited Aug '15

You don't have phalcon installed for PHP CLI, otherwise you'd get something like this:

/etc/php5/cli/conf.d/20-phalcon.ini,
phalcon
phalcon => enabled
phalcon.db.escape_identifiers => On => On
phalcon.db.force_casting => Off => Off
phalcon.orm.cast_on_hydrate => Off => Off
phalcon.orm.column_renaming => On => On
phalcon.orm.enable_implicit_joins => On => On
phalcon.orm.enable_literals => On => On
phalcon.orm.events => On => On
phalcon.orm.exception_on_failed_save => Off => Off
phalcon.orm.ignore_unknown_columns => Off => Off
phalcon.orm.late_state_binding => Off => Off
phalcon.orm.not_null_validations => On => On
phalcon.orm.virtual_foreign_keys => On => On
PTOOLSPATH => /opt/phalcon-devtools/
PATH => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/phalcon-devtools
PWD => /root/cphalcon/build
_SERVER["PTOOLSPATH"] => /opt/phalcon-devtools/
_SERVER["PATH"] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/phalcon-devtools
_SERVER["PWD"] => /root/cphalcon/build

To install:

git clone --depth=1 git://github.com/phalcon/cphalcon.git

or if you want the latest:

git clone -b 2.0.x --single-branch git://github.com/phalcon/cphalcon

then

cd cphalcon/build
sudo ./install

Official docs

Sometimes I small mess can create a bug which can bother you for quite a while.

I would advise you re-do the installation process by first uninstalling the extension and its dependencies.

Then make sure you have the right versions and be keen when you are typing config settings in the command line.

I guess it is easier this way and you may eventually track the bug easily.

@Lajos @Dominic thanks 4 ur advice, sure I will try those

What i did is I also add a file 30-phalcon.ini in folder /etc/php5/cli/conf.d and restart apache the phalcon command in now working on my terminal