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

Phalcon is a loaded module for comand line PHP but not the fpm process?

I can see phalcon loaded if I run "php -m" from the command line, but if I try to load it from the browser it doesn't work (not found) and if I look at phpinfo() then phalcon isn't there.

I'm running php 7.2 on CentOs 7, does anyone know how to enable phalcon specifcally for the cgi-fpm?

Thanks



10.1k

Did you restart php-fpm after installing? Besides that php-fpm can have his own php.ini. Make sure it's added there as well.

Check where is you php.ini file in cli:

php -i | grep php.ini

Probably you have different configuration files for cli and fpm.

CentOS7 only offers php-5.4.16, which means you're using an external repository, and each maintainer may have done things his own way.

As mentioned above, check the files used through both the CLI and phpinfo for those two settings:

  • "Loaded Configuration File"
  • "Scan this dir for additional .ini files"

Note that with Phalcon4 you'll need to have PSR installed and loaded before Phalcon. To avoid any issue related to that, I opt to create two files in the directory specified in "Scan this dir for additional .ini files":

echo 'extension=psr.so' > /ADDITIONAL_INI_DIRECTORY/40-psr.ini
echo 'extension=phalcon.so' > /ADDITIONAL_INI_DIRECTORY/50-phalcon.ini

(40 will be loaded before 50)

It may also be useful to describe how you obtained the Phalcon binary (and eventually PSR), because if you built them yourself you may not have targeted the correct PHP version (you may have mutiple php-config and phpize installed).

I wrote a quick guide for this kind of shenanigans on a specific repository, maybe you could adapt it to your situation:



3.4k

Check where is you php.ini file in cli:

php -i | grep php.ini

Probably you have different configuration files for cli and fpm.

Thank you for the suggestion. The result is:

[[email protected] ~]# php -i | grep php.ini

PHP Warning: PHP Startup: Unable to load dynamic library 'solr.so' (tried: /usr/lib64/php/modules/solr.so (/usr/lib64/php/modules/solr.so: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/solr.so.so (/usr/lib64/php/modules/solr.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library 'phalcon' (tried: /usr/lib64/php/modules/phalcon (/usr/lib64/php/modules/phalcon: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/phalcon.so (/usr/lib64/php/modules/phalcon.so: undefined symbol: php_json_decode_ex)) in Unknown on line 0

Configuration File (php.ini) Path => /etc

Loaded Configuration File => /etc/php.ini

am I right in thinking that I need solr to run phalcon? I've gotten as far as trying to install solr. It's not something I've ever needed (directly) so I know very little about it.