-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Function registration failed - duplicate name #1
Comments
No. Perhaps there are two "extension = sodium.so" lines being included in the php.ini? grep all of the php.ini files for the sodium.so extension. Are you using php namespaces? If so, use \sodium\precomp_key instead of sodium\precomp_key. |
Perhaps you are compiling php-sodium extension statically in your php build and also loading the shared library. Take a look here [http://bytes.com/topic/php/answers/468411-php-command-line-issues-function-registration-failed-duplicate-name] |
Hello, I only added Weird. Never saw that before. |
Do you get the error when you run php -m, php -i ? |
extension = sodium.so is correct. |
Yep, same error with |
Try commenting-out all extensions except php-sodium and run php -i . The error message indicates the extension is being loaded more than once. Is the extension loaded in apache? |
I'm starting it from the command line. |
I reviewed the php -i output. It looks good. Try commenting-out the php-sodium extension and run php -i . Does the [sodium] block still indicate being loaded? Also, set:
and run php -i. Are any php processes running? Can you kill them? |
Strange error. Can you upgrade/downgrade php easily to try a different version? Are all of the Mac OSX patches installed for php? |
Check your apache error logs too. |
php is run in command line mode, not via Apache. I'm going to compile it from source and see if it makes a difference, but still... other extensions don't have this issue with the stock OSX PHP. What PHP version did you test with? |
PHP 5.3.10-1ubuntu3.8 with Suhosin-Patch (cli) (built: Sep 4 2013 20:05:42) |
I just compiled php-sodium on debian wheezy/stable against php 5.5.5: PHP 5.5.5-1 (cli) (built: Oct 19 2013 22:09:48)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies I did not have a problem. sodium
sodium support => enabled
sodium extension version => 1.0.3
sodium library version => 0.4.5
randombytes implementation name => sysrandom
endian => little endian |
I compiled 5.5.5 on OSX from source (using Homebrew, so a very common setup), and on another machine. Same issue. Even "make test", without changing anything to php.ini, spits out these errors.
|
Checkout this: [https://github.com/midgardproject/midgard-php5/issues/113] |
Sounds very similar indeed. |
Did you find what the issue was? |
The php-sodium extension is being loaded more than once. The homebrew/php environment is loading the extension. The error points to the php compilation/linking environment. I did not get an answer to "Try commenting-out the php-sodium extension and run php -i . Does the [sodium] block still indicate being loaded?" |
Nope, if I don't include the extension=sodium.so line (tried with the full path as well), php -i / phpinfo() doesn't mention it. |
And I have the same issue both with the php version that comes with OSX, and with php 5.5.5 installed by Homebrew. |
OK. FYI. Works fine on Windows Server 2003, Ubuntu, and two 5.3/5.5 on Debian. I wish I had an OSX machine to debug the build process. The error seems to point to php being compiled with a php-sodium extension statically linked along with a extension=sodium.so in the php.ini. It is a strange error. Could you check your command PATH. Perhaps the build process is using one version of php and the cli is another? Do you have more than one version of php installed? |
I had no problems making it work on a Debian machine either. So, there must be something specific to OSX. When I initially reported this issue, I only had one PHP version, installed by default with OSX. This is on a new machine, with a fresh OSX 10.9 install. I now have the Homebrew version in addition to it, but it seems to pick up the correct phpize script. Out of desperation, I wrote a simple PHP extension and it seems to work fine on OSX. But the code is very basic and doesn't use namespaces, nor define classes. |
Sounds good. The PHP_MINIT_FUNCTION macro becomes a function that registers the classes. If this were called twice, then the duplicate names might be a result. Is the configure process including the php-sodium sodium.c twice? I doubt it would compile. |
If you save the C code after the compiler macro expansion, we could search for the zend_register function to see if it is called twice. |
I uploaded a branch entitled null_test. Give it a try. I was missing some "nulls" in some structures. |
Tag 1.0.4 and master branch now contain null_test. |
Removed null_test branch. Try version 1.0.4. |
Good news! Version 1.0.4 fixes it! |
Thank you for your help. |
The extension doesn't seem to load on OSX / PHP 5.4.17:
Do you happen to know what can be causing this?
The text was updated successfully, but these errors were encountered: