Building PECL extension on windows - php

I want to build an old version of APC on windows. They say (check the link)
A DLL for this PECL extension is currently unavailable. See also the building on Windows section.
but the guides referred are not available. Can you recommend a How-to?

Well, I tried this last night and I also needed to download the PHP sourcefiles, Zlib source, and OpenSSL source, and build Zlib and openSSl static libraries to get all the references. But then once I had all the references squared aware the darn thing still errored on the build because something was redefined.
And I know what you mean, this process is not documented at all. Personally I don't think there is a windwows DLL to download because they couldn't get it to build either.

Related

bison.exe not found compiling PHP7 in VS15

Attempting to compile PHP in Windows with Visual Studio 15 (community edition) results in
Checking for bison.exe ... <not found>
All I'm after is a version of php_pdo_sqlite.dll that includes the soundex() function. See this for the PHP 5 method I used.
I do know that VS Code is insufficient, and that installing VS 15 community does not add the path to cl.exe. Because I only need to go through this exercise to get the dll I am grossly unfamiliar with Visual Studio. Where is bison.exe? [And yes, I know that soundex() is in pdo_sqlite in *nix.]
It's possible that bison.exe (or the related files) is not on your system. In that case #Dmitry (and others') suggestion is correct.
However, another fix is to launch the Developer Command Prompt in VS15 and be sure to run {rootdir}\bin\phpsdk_setvars.bat before you run configure. This solved my issue.
Are you looking for this fellow? It's a parser generator (in case you didn't know) built for windows platform. You'll have to install the binary somewhere in your PATH, so that VS could find it.

Why does PHPinfo have a header version and library version? What are the differences?

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.

Where to find php_printer.dll?

I have a class that makes use of the php_printer extension but I can't find it anywhere and at php.net it says it's currently unavailable. I googled it, but all I downloaded from other sites was not efficient. It seemed to me it was outdated. I copied the .dll file in the extensions folder and set the configuration in php.ini but I still couldn't use its built-in functions.I have PHP 5.3.1 installed.
Then you did not google very well. There still are repositories of precompiled binaries elsewhere:
https://github.com/maryo/php-5.5-windows-extensions
http://windows.php.net/downloads/pecl/snaps/printer/0.1.0-dev/
http://downloads.php.net/pierre/
Just saying it does not work is insufficient. I understand that compiling from source is effortful on Windows (pecl install printer given a proper compiler setup), but at the very least run the PHP interpreter on the commandline after editing the php.ini. It would give you a useful error message in case of linking errors, or none in case you edited the wrong config file. (Too few details to answer.)
See also: PHP 5.4.7 Compiling ext php_printer
download and unzip the extenssions file
http://museum.php.net/php5/pecl-5.2.6-nts-Win32.zip
http://downloads.php.net/pierre/ appears to have one that dates to 2010.
I'd consider looking for some other solution though, it doesn't look like a very widely supported extension and it's not been updated for at least a year.

PECL extension for Windows

I found a few related posts here but didn't get my answer. So posting again.
How would I install a PECL extension on windows? Say I want the PECL oAuth extension on Windows XP.
I know 2 methods, but none of them is working for me.
The site http://pecl4win.php.net/ is down for months. So I cant download the DLL. Is there any place we can download the DLLs from ?
running the command
pecl install oauth-0.99.9.tgz is throwing the error
The DSP oauth.dsp does not exist.
I tried with few other extensions also and getting the same error.
What am I missing here?
Releases can now be found here:
http://windows.php.net/downloads/pecl/releases/
If you need an extension not available there you might ask on the pecl-dev at lists.php.net mailing list.
I got what I am looking for in http://windows.php.net/downloads/pecl/releases/
Currently PECL for windows is in an odd reformation state. The reason being that I believe they are trying to provide VS2008 source versions. I would actually suggest using Zend Server for now until the windows half of the php group gets everything fixed up. Zend Server includes almost all of the extensions that you can find in PECL, and everything else, if you are lucky, you could find an compile yourself.
The PECL installer downloads the source code of the extension and tries to compile it with your local C compiler. The problem is that the whole process is designed for Unix systems, where a C compiler is available or can be easily installed. Setting an environment to compile C code under Windows is pretty complicate.
The ideal solution is getting a DLL file that someone already compiled. That's what the pcle4win site was for. However, there's currently no official repository to download PECL DLLs so you only have two alternatives:
Find an unofficial DLL somewhere in Google
Compile it yourself (another link) with Microsoft Visual Studio
It'd be cool that there was a DLL repository out there but I'm unaware of any.
The php source ships with a set of configuration scripts for windows (using windows script host) that mimics the autoconf tools as far as php is concerned. If you place the code for the extension in a directory under the /ext directory (where all the other extensions like bcmath, bzip, ... are located) you can let the buildconf-script create a makefile that includes the build rules for that (new) extension.
There's a step-by-step walk-through at http://wiki.php.net/internals/windows/stepbystepbuild which seems to be brief but feasible.
compiled oauth: http://windows.php.net/downloads/pecl/releases/oauth/
another pecl extension: http://windows.php.net/downloads/pecl/releases/

PHP Inclued for Windows?

Is there a .dll version of the inclued extension for PHP?
The manual's link for Inclued on PECL4WIN doesn't help. I don't have a compiler to build my own DLL.
NOTE: The spelling "inclued" is correct!
Edit: I don't have a compiler, but do know someone with one... that's really a last resort though.
As best as I can tell, the Windows version doesn't exist anymore. Maybe whoever was maintaining it before had to stop for some reason.
I wonder what it takes to compile a PECL extension under Windows.
Edit
Here's some info on compiling a different PECL extension on Windows. You may be able to extrapolate to the inclued extension.
Edit
WAMP Server comes with PECL & PEAR. I can actually run the command pecl install inclued-alpha from the Windows command-line and it goes out and tries to grab the inclued extension from the PECL site.
Unfortunately it dies when it unpacks the .tgz file and tries to compile it
ERROR: The DSP inclued.dsp does not exist.
Which version of PHP are you running? I know someone that can compile you a version.
update
Alright, got this compiled - I've tested on my 5.2.6 build and it seems to work fine.
I've been told there may be problems using it in a threaded environment (e.g. Windows) but that's only a maybe. Also:
[13:10] <g0pz> the inclued dumpfiles will collide, because it uses PID # + increments
[13:11] <g0pz> but command line should work ok
[13:12] <g0pz> is the threaded apache version which'll have the same PID and well, a "possible" collision
So good luck with it :)
download
Poke me if you have any issues with inclued.
I'm just on the verge of putting out a release, I'll do a mkstemp() in windows instead of picking the PID + count.
Hopefully also with a gensvg.php which'll render the di-graph in-browser with pear::Image::GraphViz.
Isn't this their DLL download site? http://pecl4win.php.net/list_dlls.php
Unless I'm off on my browsing of the site?
Is this the page you are looking for?
http://pecl4win.php.net/list_dlls.php
..edit: (man, we are fast. I swear these two duplicate answers were posted simultaniously)
The official PHP for Windows site says:
PECL For Windows
PECL extensions for Windows is being worked on. The interface on the
pecl website will most likely be updated to offer Windows DLL download
right from that website. In the meantime, some extensions can be found
here.
That "here" link leads to http://downloads.php.net/pierre/, where you will find, among the multitude of other extensions, builds of inclued for PHP 5.2 and 5.3, VC6 and VC9, thread-safe and non-thread-safe. The one matching my version of PHP seems to be working.

Categories