I made a PHP extension for PHP Apache Module.
I compiled it using gcc-4.9.2.
So I distribute my PHP extension with libstdc++.so.6(libstdc++.so.6.0.10) in same directory.
And I compiled the extension with 'RPATH=$ORIGIN'.
Most linux system is OK to run.
But, some system(my customer system), extension try to load /usr/lib64/libstdc++.so.6, and fail to load the extension.
'ldd command' result is fine, it correctly find libstdc++.so.6.0.10(not /usr/lib64/libstdc++.so.6)
'$LD_LIBRARY_PATH' is empty.
I have had search so many thing using google, but I don't know why, and I don't know how fix it.
Anybody knows, What is the problem?
"6.0.10" is rather old. Perhaps the customer system's libstdc++ has the same soname but a later version.
Normally you would make a shared library extension using a different soname to avoid naming conflicts.
Related
I am using a shared host. PHP is compiled with --disable-sysvshm. I get the following error while running a script:
Fatal error: Call to undefined function shm_attach() in ...
Is there any way to enable it without re-compiling php?
There is, but as a regular user, you can't do it. You'll need admin access.
If you have root access, then your package manager should have the extension available if it doesn't come built into PHP. For SuSE, it's looking like a php-sysvshm package would do it. If there's no package, you'll still need to rebuild, but it's doable.
If you don't have the access you'd need to build PHP or install packages, you won't be able to build or install, let alone load, extensions (which are pretty much the only way you can add functionality without replacing your existing PHP). In that case, you'll need to talk to your web host and see if they will install it for you. If they won't, then that's pretty much it.
I have an inconsistency, and I could not align their versions properly, so I just wanted to remove the library version. Can I do this? Is the header version for PHP while the library is from my distro? Can I upgrade PHP's library version? If so, how? I am using PHP 5.4.4
For example,
Is the header version for PHP while the library is from my distro?
It means it was compiled against the 1.0.1 headers, but is now dynamically linking against 0.9.8. So you are using an older version than what was used when PHP was compiled.
Many libraries store the version in the header files. So when a program uses the library, it can do something like int HEADER_FOO_VERSION = LIBRARY_VERSION, which embeds that version number into the program (e.g., php). Now when that program runs, it links dynamically against the library, which may be a different one than was on the host system.
That library may have a function call, say int get_library_version(). So the program (PHP) can check if HEADER_FOO_VERSION == get_library_version(). If it's different, then there could be a compatibility issue. (Of course, it doesn't have to be assign to a local variable... I'm just trying to drive home the point that the header version number can be compiled into php, and remains constant no matter which version of the library is being used at run time.)
Whether or not it is a problem depends on if the two versions are compatible.
Usually if the library is > than the header, you are okay. It's definitely more likely to be a problem if the library is older than the version it was linked against. Of course, this is because it's impossible to know what changes future versions may have.
So in your case, I would try to update your system's SSL libraries via apt-get, yum, etc, to match the version PHP is expecting.
To check which version php is using on Linux:
$ ldd `which php` | grep ssl
libssl.so.1.0.0 => /lib/i386-linux-gnu/libssl.so.1.0.0
Note that which php is just a short-cut to find the full path. You can hard code any executable you'd like to check: ldd /usr/sbin/httpd.
I dont know the answer myself, but when searched on google some nice resources explaining the same.....
What's the difference between a header file and a library?
The version of the files are the one mentioned in the phpinfo used to create a library.
Hope it helps, there are lot of resource available if searched on google.
Still will like to hear from someone in great details about the question
The header version is the functionality version, whereas the library version is the code version.
The header defines the interface - it tells you what functions are within the library. If a header gets updated, then you need to check to make sure all the functions are the same, and see if any are added or subtracted.
But if a library gets updated, and not the header, it means all the function calls are the same, but some of the code may be changed (eg, bug fixes).
In your example, PHP is seeing functionality for OpenSSL 1.0.1, but the actual version of the source code that OpenSSL is loading is 0.9.8o
This is commonly seen on updated versions of openssl. What happens is the newer versions for the libraries are stored in different folder. The original folder located at /usr/bin/openssl would need a symbolic link to the new folder /usr/local/bin/openssl. That would get both to be the same version or just show OpenSSL Version _(Whatever)
Normally there is no concern for this, since it still works the way it is intended. This is seen a lot on shared servers.
EDIT:
The information in this post is generic and can be different if you are running
CentOS, RedHat, Ubuntu, or another Linux/BSD version. Check documentation or man
pages for the best information
If you do update your OpenSSL, some versions of *nix Require for you to rebuild PHP and Apache for it to update
If you are rebuilding PHP from source, I have found another possible reason for a mismatch. It's so simple yet if you are not familiar with building from source on Linux, not knowing it can cost you a lot of time.
The answer is here: https://serverfault.com/a/567705/305059 - unfortunately I cannot up-vote it over the not-so-useful answer, so if you have the reputation there, please do.
You need to run "make clean" before "make" in order for it to rebuild all binaries. Strangely, without this step I was getting an updated library version, but the old header version - so I think it must have rebuilt something, but not everything. My rebuild involved linking to a version of curl in another location (built with ssl), which might be the reason behind it.
Anyway, I hope this helps someone. Thank you to #velcrow on serverfault.
Is there a pure PHP implementation of SQLite that will run on PHP 5.1.6? I am working on an application that would benefit from being able to store data in a relational database, but the server that it has to run on is stuck with PHP 5.1.6 and has been configured "'--without-sqlite"
I have no control over this server; cannot recompile, upgrade or otherwise modify PHP aside from using .htaccess files. Hosting externally is also not an option, unfortunately. MySQL may be possible but would be a nightmare trying to get their IT to create a database for me. (It took them 6 weeks to get .htaccess files enabled because of red tape and other things)
Am I out of luck? My fall back is to write everything to flat files but I really would rather not do that.
EDIT: Fixed typo. PHP does not have the SQLite extension and was configured "'--without-sqlite" according to the output of phpinfo()
Actually, you could easily download and install sqlite in your userspace, whether on windows or on a linux remote shell doesn t usually matter unless your host is unusually restrictive, if that is the case you should change service provider.
Once sqlite is installed, you can one of the available pear extensions or pecl extension to allow easy access through php.
Tutorial and code examples for the pear solution here.
I have a Windows Vista PC with IIS7, I have managed to manually install PHP on it.
And managed to load one of my custom extension for PHP, as well as mbstring extension.
But my mysql extension does not load when I check through phpinfo, I checked all the path variable, uncommented requied lines in php.ini file, also verified that the file exists.
My question is, does it require mysql server to be working on the local host for the mysql extension to load? or what could be wrong?
No, but you do need the appropriate MySQL client libraries to be available.
No, php_mysql.dll simply adds the various mysql functions into PHP. How could the .dll know where your server is? Or how you connect to it? Or what if you've got multiple seperate servers?
Until you actually try to connect to the server, the .dll will happily stay idle and not do anything.
If you're not stuck with using IIS, you could investigate installing WAMP - that'll give you MySQL, PHP, and Apache with a nice unified installer, without forcing you to mess around with .dll installation/customization.
I am using a Windows XP Home Edition. I need to install a few extensions to PHP -- memcache, APC, .etc. And I would very much like to use PECL to make this happen. The problem is PECL takes it for granted that I will have certain programs on my computer. On another post, I read, for instance, that you need to have Microsoft Visual Studio C++ installed on your machine. However, the new version of Visual Studio, which I downloaded, does not have msdev.exe and instead uses vcbuild.exe, which has a completely different api and fails to compile the .dsp files that come with these modules.
So I tried to find a script that would upgrade the dsp to work with vcbuild.exe...and it turns out vcbuild.exe can do that, but of course that didn't pan out.
Another thing I tried was to find a make script for Windows (nmake2make). But there was no make file in the module's root folder.
I tried also downloading Cygwin and MinGW in hopes of finding a build script that would work as simply as in *nix operating systems, but to no avail.
How else do I use install PHP extensions on a Windows machine? Can anyone help me out of this predicament?
For all peoples coming here to download the dll extension files.
This is the link to the PHP extension download link http://windows.php.net/download/
And this is a list of PHP extensions to download: http://pecl.php.net/package-search.php
For core extensions, or if you cant find any on pecl.php.net, download PHP from a zip http://windows.php.net/download/ and look inside of /ext and copy them to your local php /ext folder.
The only way I can think of is: manually. Yeah, I know, but this is pretty easy comparatively.
If you have the compiler, then you can at least compile an extension if you have the source. Otherwise you're stuck with trying to locate a binary distribution (like me).
Here's what you do, from what I understand:
Put the extension library folder under PHP's install path. On my computer this is C:\xampp\php\ext. Search in your PHP.ini for "extension_dir" to find what yours is.
Edit php.ini to load the extension.
Find ; Dynamic Extensions ;.
Add line extension=my_lib.dll
This should do it. Otherwise you should probably search for an in-depth guide on manual installation.
For memcache you will need the memcache server located here -> http://code.jellycan.com/memcached/ and download the win32 binary
Never used APC :P I use eAccelerator0953_5.2.6 to cache the code