We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Ubuntu: How to enable phalcon for PHP Cli

Hello,

I tried running this command and it fails.

Command

sudo /usr/bin/php /usr/share/nginx/myapp/cli/app.php main

Error Message

PHP Fatal error:  Class 'Phalcon\Config' not found in  ...

I am thinking i need to enable phalcon for php cli. How do i do that in ubuntu?

edited May '16

Just edit /etc/phpX/cli/php.ini and add extension=phalcon.so at end of it



27.7k

Hi! thanks for the fast reply. i added it and restart php-fpm.

Got this error below

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20131226/phalcon.so' - /usr/lib/php5/20131226/phalcon.so: undefined symbol: php_pdo_get_dbh_ce in Unknown on line 0
edited May '16

You need to load pdo too before loading phalcon.



27.7k
edited May '16

You need to load pdo too before loading phalcon.

Hi i have set the priority, but it doesnt seems to be working as well. any ideas?

/assets/img/m5gfwjp.png

I have both PDO and Phalcon at priority 20.

It's working fine with:

20-phalcon.ini

Post your actual phalcon.ini contents, and check this:

file /usr/lib/php5/20131226/phalcon.so



145.0k
Accepted
answer
edited May '16

But you just posted conf.d content from FPM, post result from CLI maybe ? Im guessing you don't even load pdo in cli.



27.7k

But you jsut posted conf.d content from FPM, post result from CLI maybe ? Im guessing you don't even load pdo in cli.

Thanks for the help! Stamster too!

I managed to resolve it last night, but it's too late, so didn't post back. Wojciech was right!

So, what i simply did is to create another symbolic link into cli and it works.

Thanks much guys. This community is awesome. :D

That's the reason why you should always keep your extensions in /etc/php/5.x/mods-available/ And then symlink from both /etc/php/5.x/fpm/ and /etc/php/5.x/cli/



27.7k

That's the reason why you should always keep your extensions in /etc/php/5.x/mods-available/ And then symlink from both /etc/php/5.x/fpm/ and /etc/php/5.x/cli/

thanks!!