I'm on Windows 10, and I really need to install this PHP extension in order to use advanced GeoPHP methods. I've already asked about this previously here. There is no available DLL for this extension, and the instructions for installation on GitHub are for Linux. What I've understood is that I need to recompile PHP with the extensions in the ext folder, so I'm planning on doing that using these instructions. However, I've previously installed PHP through XAMPP.
My question is, will these instructions work with this? If yes, where can I find the PHP source files? I'm not quite sure what they look like, and googling "PHP source files location" gives me stuff about actual PHP files, not the ones used for installation. I just want to make sure. Thanks.
No, you do not have to recompile PHP. The module you stated is not baked into PHP but dynamically included.
Just build the module and include it like
extension=geos.dll
The Github link you posted does have instructions...
Related
sorry if I seem like an absolute beginner at these things. I wanted to get the PHP extension for GEOS. I already have PHP (though XAMPP) and GEOS installed. Now, trying out the instructions on GitHub, I soon realize that these are instructions for Linux. I've been googling instructions for getting PHP extensions in Windows, but I've learned that it's not quite simple. Based on what I've found I would either need to
Use Visual Studio (which I would have to download first)
Find a dll (there is none)
Recompile PHP with the extension (not sure if I said it right)
So I have two questions: firstly, which of these options are most suitable for getting just one extension? And secondly, regarding the recompiling option, would I have compile things from a different source, since I got PHP from XAMPP and it doesn't seem to have the option to install the components separately.
EDIT: I believe that my question is not the same as this one because the user here actually found relevant DLLs, and did not have to compile anything or use Visual Studio.
I'm attempting to create a PHP extension/wrapper for a C library. I have followed this tutorial Extension Writing Part I very closely and have bought the book "Extending and Embedding PHP" from the same author.
I am working on a MAC and have MAMP installed.
I have downloaded and installed make-3.82, autoconf-2.69, automake-1.9 and libtool-2.4.2 without problems.
I have created a hello folder in the Applications/MAMP/bin/php/php5.4.4/lib/php/extensions folder and have created the files listed in the tutorial above exactly as instructed.
I did these three steps:
$ phpize
$ ./configure --enable-hello
$ make
Again no problem.
But when calling the php -r 'echo hello_world();' I get an 'undefined function hello_world' error.
I know that several of the steps listed above are not the recommended way to do this.
Am I in the wrong folder for extensions? The extensions folder is not the folder recommended but I couldn't find an ext folder anywhere.
Do the more current versions of these additions work the same as the old ones or do I need to go back to the earlier versions?
Is there a more current set of instructions for putting together an extension for PHP that anyone can recommend?
On further research I found that my MAMP install is missing an includes directory tree which contains the ext folder referred to in all of the current documentation. I don't know if that is simply an upgrade or not but I am going to abandon this and switch to a Linux environment for development.
EDIT:
So having fought with the same problem on Linux I discovered a file in etc/php5/apache2/conf.d called the name of the existing extension with the same extension = {extension}.so line that is also in the php.ini. When I duplicated that file with my own extension information the extensions began to function. This file was not anything I saw referred to in any of the documentation I reviewed. I do not know if there is a corresponding file in the MAMP environment that was also causing the issues there.
I'm having trouble understanding these ;extension=xxx.dll files in php.ini
Is there any document I can refer to which explains these extensions in detail?
The .dll files are for PHP extensions. You can read about all of them here: http://php.net/manual/en/install.windows.extensions.php
PHP extensions give you extra PHP functionality. They are basically function libraries that add features like MySQL functions, LDAP functions, and even Java functions.
To activate the extensions provided by the default PHP install, simply uncomment the ;extension=xxx.dll line (remove the semicolon) so that it just looks like extension=xxx.dll.
However, not all extensions are bundled with PHP. For example, the PECL extensions, including APC, have to be installed externally. Instructions for installing PECL can be found here: http://www.php.net/manual/en/install.pecl.php
"Extension Writing Part I: Introduction to PHP and Zend"
You only need to worry about those if you're running on a Windows server - since they appear to be commented out (; at the start of the line) I would assume you're on a Linux server?
In any case, you should be able to look up each extension individually on Google.
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/
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