PHP Warning: PHP Startup: Unable to load dynamic library 'phalcon.so' (PHP 7.3 ZTS)

Hi there,

I installed PHP 7.3 ZTS like this documentation says:

https://stackoverflow.com/questions/34969325/how-to-install-php7-zts-pthreads-on-ubuntu-14-04

After that, I installed phalcon like this:

git clone git://github.com/phalcon/cphalcon.git

cd cphalcon/build

sudo ./install

Then I manually copied the created "phalcon.so" file to my shared extension folder:

/etc/php7/lib/php/extensions/debug-zts-20170718/

I restartet the server. When I run "php --version" now, I get the following output:

PHP Warning: PHP Startup: Unable to load dynamic library 'phalcon.so' (tried: /etc/php7/lib/php/extensions/debug-zts-20170718/phalcon.so (/etc/php7/lib/php/extensions/debug-zts-20170718/phalcon.so: undefined symbol: compiler_globals), /etc/php7/lib/php/extensions/debug-zts-20170718/phalcon.so.so (/etc/php7/lib/php/extensions/debug-zts-20170718/phalcon.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

PHP 7.3.0-dev (cli) (built: Nov 24 2017 06:53:57) ( ZTS DEBUG )

Copyright (c) 1997-2017 The PHP Group

Zend Engine v3.3.0-dev, Copyright (c) 1998-2017 Zend Technologies

Do anybody know what I did wrong?

Thanks a lot!

Best

What is the output of this command?

php-config --version


2.1k
edited 23d ago

"php-config --version" Output:

7.0.22-0ubuntu0.16.04.1

Strange. Seems that is uses a different version?

Did you update php-dev package?

Your default php package is from the ubuntu repo (php7.0), which php will show that path instead of the manually compiled one.

You should add your new php7.3 binaries to your path (i dont know where you've compiled it, that path is just a guess):

set PATH="/opt/php7.3/bin:$PATH"

Now php-config should print 7.3. You should also copy phalcon.so to the manually compiled ext folder, not the distro one.



2.1k

"which php" gives this output:

/usr/bin/php

The documentation of the manually compiled one tells me to do a symbolic link:

ln --symbolic /etc/php7/bin/php /usr/bin/php

The path of installation is /etc/php7

So I executed the following line:

set PATH="/etc/php7/bin:$PATH"

I rerun "php-config --version", but still this output:

7.0.22-0ubuntu0.16.04.1

Did I do something wrong?

The single symbolic link for php binary wont be sufficient, because php dev tools (php-config for eg) will still reference the old version.

set PATH="/etc/php7/bin:$PATH"

This SHOULD work, I have no idea why it still prints 7.0...



2.1k

Instead of "set" I have to use "export" then it sets the path:

export PATH="/etc/php7/bin:$PATH"

php-config --version now prints the right version:

7.3.0-dev

But when I execute "php --version" it still shows the warning:

PHP Warning: PHP Startup: Unable to load dynamic library 'phalcon.so' (tried: /etc/php7/lib/php/extensions/debug-zts-20170718/phalcon.so (/etc/php7/lib/php/extensions/debug-zts-20170718/phalcon.so: undefined symbol: compiler_globals), /etc/php7/lib/php/extensions/debug-zts-20170718/phalcon.so.so (/etc/php7/lib/php/extensions/debug-zts-20170718/phalcon.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 PHP 7.3.0-dev (cli) (built: Nov 24 2017 06:53:57) ( ZTS DEBUG ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.3.0-dev, Copyright (c) 1998-2017 Zend Technologies

Any other ideas?

You need to recompile phalcon now.



2.1k

when I compile it now with "./install" there is the right version listed:

Configuring for:

PHP Api Version: 20170718

Zend Module Api No: 20170718

Zend Extension Api No: 320170718

But now the compilation failed with following error:

Makefile:194: recipe for target 'phalcon.lo' failed

make: *** [phalcon.lo] Error 1

Thanks for compiling Phalcon!

Build succeed: Please restart your web server to complete the installation

Any ideas?



2.1k

I used zephir to build phalcon witht the following command:

sudo ~/.composer/vendor/bin/zephir build --backend=ZendEngine3

Then I get this error:

Fatal error: Allowed memory size of 134217728 bytes exhausted at /root/php-src/Zend/zend_smart_str.c:41 (tried to allocate 36864 bytes) in /root/.composer/vendor/phalcon/zephir/Library/CompilerFile.php on line 184

Increased "memorylimit" in PHP.ini to 1024M. But doesn't have any effect.

Have you increased it in the correct php.ini? :]

It should be the new, compiled one: /etc/php7/etc/php.ini



2.1k

Yes. The command "php --ini" gives this output:

Configuration File (php.ini) Path: /etc/php7/cli

Loaded Configuration File: /etc/php7/cli/php-cli.ini

Scan for additional .ini files in: /etc/php7/etc

Additional .ini files parsed: (none)

And I edited it to:

memory_limit = 1024M

But it still shows this error:

Fatal error: Allowed memory size of 134217728 bytes exhausted at /root/php-src/Zend/zend_hash.c:127 (tried to allocate 320 bytes) in /root/cphalcon/.temp/0.10.6-f221e7d826/_root_cphalcon_phalcon_queue_beanstalk.zep.js.php on line 2

Even a "service php7-fpm start" doesn't take effect.

Is there something more that I have to change?

Why even use not stable php build anyway? It's something broken about your setup. Do you even have enough memory?

https://travis-ci.org/phalcon/cphalcon/jobs/306471116

As you can see phalcon correctly compiles on php 7.3 and all tests are passing.

edited 23d ago

Because he want's to run a thread safe version of it with pthreads... (methinks)



2.1k

Yes, I want to use the thread safe version with pthreads (ZTS).

Is there any way to install a thread safe version of PHP on another way than building it manually?



2.1k

Btw: Is phalcon compatbile with PHP 7.3? (or 7.2) ?

Check if your memory limit has actually been increased:

php -r 'echo ini_get('memory_limit');'

Maybe a stupid question, but do you actually have sufficient physical ram available? Bad shared hostings can produce strange errors.

free -h

Regarding zts packages: there is, but unfortunately its only php7.0: https://launchpad.net/~ondrej/+archive/ubuntu/php-zts

edited 23d ago

Yes, it is compatible. As @Jurigag said:

https://travis-ci.org/phalcon/cphalcon/jobs/306471116

As you can see phalcon correctly compiles on php 7.3 and all tests are passing.



2.1k

I just compiled it with PHP 7.0-ZTS and now it works perfect :)

edited 21d ago

Is there at least pre-nightly-alpha PHP 7.3? :) You sould not use 7.3 now. Currently there is not even an official release for PHP 7.2.

So there was no need to hassle with the bleeding edge at first place?

I just compiled it with PHP 7.0-ZTS and now it works perfect :)