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

PHP 5.3.3 and PHP 5.4.13 dual installation error

Hey I was able to get Phalcon running on 5.3.3 just fine, but for whatever reason, I can't get it running on my 5.4.13 installation. PHP 5.4.13 works, I just can't get it to load the extension for the life of me.

First 5.3.3 was on my system and it's running other production websites right now, so I just kinda wanted to leave it along and mess with Phalcon on 5.4.13 anyway. I had it working on 5.3.3 but I installed 5.4.13 and no dice on getting it to work. I keep getting the following error in my error_log when I restart apache

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/phalcon.so' - /usr/lib64/php/modules/phalcon.so: undefined symbol: output_globals in Unknown on line 0

BTW, I have to define the entire path to phalcon.so. If I just put extension=phalcon.so nothing happens and there is no error.

Thoughts?

I also re-installed Phalcon by going to cphalcon/build and running ./install

If you have dual PHP versions; are you sure you're compiling it, the second time, for PHP 5.4 ? or is rebuilding it via ./install still using PHP 5.3 ? ie; You may have to adjust you paths/env to build for 5.4.

How do I change the build path for 5.4 when building phalcon? Is it ./install --path=/path/to/php54? What file/directory does the path have to lead to?

Well after a couple hours of research I think I figured out how to create the build differently, but it still doesn't work. Here's what I ended up doing with the help of https://php.net/manual/en/install.pecl.phpize.php

Instead of cd cphalcon/build and then install, I did the following:

  • cd cphalcon/build/64bits/
  • /opt/rh/php5.4/usr/bin/phpize #(this is not the standard /usr/bin/phpize, this is the one that was specific for the php54 build)

After this was done the PHP API numbers matched correctly to the PHP5.4 version.

  • ./configure --with-php-config=/opt/rh/php5.4/usr/bin/php-config
  • make
  • make install

Everything seemed to work find. the phalcon.so plugin was created in the correct default extension directory. I changed the php.ini file to just extension=phalcon.so instead of the absolute path. Restarted apache and I found this:

PHP Warning: PHP Startup: Unable to load dynamic library '/opt/rh/php5.4/usr/lib64/php/modules/phalcon.so' - /opt/rh/php5.4/usr/lib64/php/modules/phalcon.so: undefined symbol: output_globals in Unknown on line 0

Same dang error :(

Any other thoughts?



98.9k

Try:

cd cphalcon/build/64bits
make clean
phpize --clean
/opt/rh/php5.4/usr/bin/phpize
./configure --with-php-config=/opt/rh/php5.4/usr/bin/php-config
make && sudo make install

Amazing! It worked! I hope this helps someone else in the future. Thanks for your help

One other final issue was that I installed phalcon on another server with a dual installation and for whatever reason I ran into another problem. Did all the above steps but my apache error_log kept have the following

PHP Warning: PHP Startup: Unable to load dynamic library '/opt/rh/php54/usr/lib64/php/modules/phalcon.so' - /opt/rh/php54/usr/lib64/php/modules/phalcon.so: undefined symbol: php_json_decode_ex in Unknown on line 0

and I fixed it by putting this right above extension=phalcon.so

extension=json.so

It worked for me too... I spent an entire day before I found this post Thx



1.4k

Installed remi repo https://blog.famillecollet.com/pages/Config-en and install php-5.4.2

undefined symbol: php_json_decode_ex in Unknown on line 0 and I fixed it by putting this right above extension=phalcon.so extension=json.so

worked for me too. but i get

[[email protected] phalcon]$ phalcon PHP Warning: Module 'json' already loaded in Unknown on line 0 PHP Warning: Module 'phalcon' already loaded in Unknown on line 0

Phalcon DevTools (1.2.4)

Available commands: commands (alias of: list, enumerate) controller (alias of: create-controller) model (alias of: create-model) all-models (alias of: create-all-models) project (alias of: create-project) scaffold migration webtools

any solution for warnings??



2.8k

My bet is that you have ini files in your /etc/php.d/ folder that is already calling these plugins; they are just calling them out of order. That's what I think since you installed from remi.



1.4k

You are right. Thanks. On a regular Apache install from CentOS repo get the same problem ( Solved )