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

Unable to load Phalcon module in PHP 7

Hi Phalconites,

I have been trying to install phalcon under PHP 7 without success.

The install runs fine, however when i try to start php-fpm i receive the following error:

> undefined symbol: zend_std_call_user_call in Unknown on line 0

I am very new to Phalcon and would appreciate any assistance available.

Thanks



11.0k

give us more detail about your system envirovment

How did you install it ? You need to use latests zephir and phalcon 2.1.x repository. You sure you have php7 dev package ?



1.5k

Thanks for the response.

So the installation steps are below:

  • Installed NGINX
  • Installed php-fpm 5.6
  • Installed php-fpm 7.1
  • git clone phalcon and run ./install
  • copied generated phalcon.so files to both php 5.6 and 7.1 directories
  • started both php-fpm 5.6 and 7.1
  • upon starting php-fpm 5.6, i got the notice message "undefined symbol: php_pdo_get_dbh_ce in Unknown on line 0", but when looking through phpinfo, the module was loaded
  • when starting php-fpm 7.1 i get the message "undefined symbol: zend_std_call_user_call in Unknown on line 0"
  • ran command 'yum install re2c php-json php-dev libpcre3-dev'. libpcre3-dev was not found but the below steps still processed successfully (could be an issue)
  • i then git cloned zephir, ran install successfully
  • then went to the cphalcon directory and ran the command 'git checkout 2.1.x'
  • then ran command 'zephir build --zendEngine=3'

I think the steps I am missing are:

  • after running 'zephir build --zendEngine=3' and the process is completed, I am not sure where the newly generated library files are.
  • I installed php-dev which used version 5.6. Seeing that both php 5.6 and 7.1 is installed, is there a way to create the library files for each version?
  • I have since installed php71-php-devel. How can I build the phalcon library using this version?

A quick background on why i have done the install this way, is that i am trying to test the difference in performance between php 5.6 and 7.1 using Phalcon.

Based on this I can put a case forward for using Phalcon for our future/existing projects and also explore upgrading to PHP 7.

Any help would be appreciated.

Thanks



145.0k
Accepted
answer
edited Jun '16

You need to build phalcon seperate for php 5.6 and php 7.1, the same extension can't work for both versions, first try to write php -v and check on which version you currently are. If you are on php 7 then you just need use zephir for building it and phalcon 2.1.x

Zephir build will automatically install extnesion to php lib folder.

upon starting php-fpm 5.6, i got the notice message "undefined symbol: phppdogetdbhce in Unknown on line 0", but when looking through phpinfo, the module was loaded

You need to load pdo BEFORE phalcon in this case.

when starting php-fpm 7.1 i get the message "undefined symbol: zendstdcallusercall in Unknown on line 0"

Here you have error beacause you copied phalcon from php 5.6 to php 7.1

If you want have both php versions at once then i would recommend just using phpbrew https://github.com/phpbrew/phpbrew



1.5k

Ok, so I got this working.

Thanks a lot Wojciech, PHPBrew is exactly what i needed.

This is what i did:

  • removed all versions of php
  • re-installed php 5.6
  • installed phpbrew
  • install php 5.6 and 7.0 using phpbrew
  • switched to the php 5.6 instance within phpbrew using 'phpbrew switch php-5.6.22'
  • went to the cphalcon folder and ran the command './install'. This created the phalcon.so file and copied it to the folder for the 5.6 instance
  • then switched to the php 7.0 instance within phpbrew using 'phpbrew switch php-7.0.7'
  • in the cphalcon directory ran 'git checkout 2.1.x'
  • then i ran command 'zephir fullclean' and then 'zephir install'
  • This created the phalcon.so file and copied it to the folder for the 7.0 instance
  • for both 5.6 and 7.0, I added 'extension=phalcon.so' to the php.ini file
  • restarted php-fpm for both 5.6 and 7.0
  • and voila

i installed phalcon-devtools after and created a project called 'myphalcon1', but when i browsed to the site in my browser got the error 'Mod-rewrite not enabled'. I used the below in the nginx file to fix:

location @phalcon {
    rewrite ^/myphalcon1/public(.+)$ /myphalcon1/public/index.php?_url=$1 last;
}

location /myphalcon1/ {
    index index.php;
    if ($uri !~ ^/myphalcon1/public) {
        rewrite ^/myphalcon1(.*)$ /myphalcon1/public$1;
    }
    try_files $uri $uri/ @phalcon;
}

maybe some light can be shed on the NGINX part by the pros here

Thanks all for the help