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

[SOLVED] Phalcon crashes phpinfo() but not PHP

Edit: I got Phalcon running, but I can't explain why.

I added extension=psr.so to the FPM-wide php.ini, and extension=phalcon.so to the domain specific php.ini. Now Phalcon doesn't have problems loading PSR.

_

Old message:

Good morning,

I decided to try out Phalcon 4.0.5 on PHP 7.4.4, running on Ubuntu 18.04. I installed it from the packagecloud. This is my whole installation process:

[email protected]:~# sudo apt-get install php7.4-phalcon
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libdumbnet1 python3-netifaces
Use 'sudo apt autoremove' to remove them.
Suggested packages:
  php7.4-mysql php7.4-sqlite3 php7.4-pgsql php7.4-memcached
The following NEW packages will be installed:
  php7.4-phalcon
0 upgraded, 1 newly installed, 0 to remove and 65 not upgraded.
Need to get 1,560 kB of archives.
After this operation, 6,615 kB of additional disk space will be used.
Get:1 https://packagecloud.io/phalcon/stable/ubuntu bionic/main amd64 php7.4-phalcon amd64 4.0.5-923+php7.4 [1,560 kB]
Fetched 1,560 kB in 1s (1,858 kB/s)
N: Ignoring file 'plesk.list.ai_back' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
Selecting previously unselected package php7.4-phalcon.
(Reading database ... 147909 files and directories currently installed.)
Preparing to unpack .../php7.4-phalcon_4.0.5-923+php7.4_amd64.deb ...
Unpacking php7.4-phalcon (4.0.5-923+php7.4) ...
Setting up php7.4-phalcon (4.0.5-923+php7.4) ...
Creating config file /etc/php/7.4/mods-available/phalcon.ini with new version
Processing triggers for php7.4-fpm (7.4.4-1+ubuntu18.04.1+deb.sury.org+1) ...
NOTICE: Not enabling PHP 7.4 FPM by default.
NOTICE: To enable PHP 7.4 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php7.4-fpm
NOTICE: You are seeing this message because you have apache2 package installed.
Processing triggers for php7.4-cli (7.4.4-1+ubuntu18.04.1+deb.sury.org+1) ...
N: Ignoring file 'plesk.list.ai_back' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
[email protected]:/# find . -name "phalcon.so"
./opt/plesk/php/7.2/lib/php/modules/phalcon.so
./opt/plesk/php/7.1/lib/php/modules/phalcon.so
./opt/plesk/php/7.0/lib/php/modules/phalcon.so
./usr/lib/php/20151012/phalcon.so
./usr/lib/php/20160303/phalcon.so
./usr/lib/php/20190902/phalcon.so
./usr/lib/php/20170718/phalcon.so
[email protected]:/# cp /usr/lib/php/20190902/phalcon.so /opt/plesk/php/7.4/lib/php/modules
[email protected]:/# cd /opt/plesk/php/7.4/lib/php/modules
[email protected]:/opt/plesk/php/7.4/lib/php/modules# dir
bcmath.so    gd.so                  ldap.so      pdo_mysql.so   phalcon.so  snmp.so     sysvshm.so    xsl.so
curl.so      imagick.so             mbstring.so  pdo_odbc.so    phar.so     soap.so     tidy.so       zip.so
dba.so       imap.so                mysqli.so    pdo_pgsql.so   posix.so    sodium.so   xdebug.so
dom.so       intl.so                mysqlnd.so   pdo.so         pspell.so   sqlite3.so  xmlreader.so
enchant.so   ioncube_loader_7.4.so  odbc.so      pdo_sqlite.so  psr.so      sysvmsg.so  xmlrpc.so
fileinfo.so  json.so                opcache.so   pgsql.so       redis.so    sysvsem.so  xmlwriter.so

Now, when I turn to a phpinfo()-page to check it, the page replies with a 503. From the error log:

[Thu Apr 16 12:17:50.052573 2020] [proxy_fcgi:error] [pid 114824:tid 139990726059776] [clientIP] AH01067: Failed to read FastCGI header
[Thu Apr 16 12:17:50.052601 2020] [proxy_fcgi:error] [pid 114824:tid 139990726059776] (104)Connection reset by peer: [clientIP] AH01075: Error dispatching request to : 

In /var/log/syslog:

Apr 16 13:02:50 localhost systemd[1]: Stopping The PHP 7.4 FastCGI Process Manager...
Apr 16 13:02:50 localhost systemd[1]: Stopped The PHP 7.4 FastCGI Process Manager.
Apr 16 13:02:50 localhost systemd[1]: Starting The PHP 7.4 FastCGI Process Manager...
Apr 16 13:02:50 localhost php-fpm7.4[128521]: [16-Apr-2020 13:02:50] NOTICE: PHP message: PHP Warning:  Cannot load module 'phalcon' because required module 'psr' is not loaded in Unknown on line 0
Apr 16 13:02:50 localhost systemd[1]: Started The PHP 7.4 FastCGI Process Manager.

PSR is installed and loaded before phalcon.so in the php.ini. If I delete the phalcon.so from the ini file, PSR shows up at phpinfo().

PHP itself runs normal on pages without Phalcon, just phpinfo() crashes. So far, I have no idea how to deal with that. I added phalcon.so to the ini, one time just extension=phalcon.so, one time with the absolute path.

Thank you!

I think it was something about your php-fpm configuration