How can I disable a compiled in extension in PHP - php

My home system has a version of PHP compiled with the SOAP extension. The live system has a version of PHP without the SOAP extension, and most of the scripts rely on the NuSOAP library quite heavily. The fact that NuSOAP and the SOAP extension use the same names for their classes is a terrible headache.
How can I disable the SOAP extension on my home system without doing a reinstall / recompile? It's compiled in, and not enabled by a extension directive in a ini file.

it's an extension, so you can disable it in php.ini. Just outcomment the line. Remember to restart Apache afterwards.
I have found nusoap to be rather buggy, so upgrading to native soap should be a priority. If this isn't immediately possible, it would be a good idea to switch to nusoap-for-php5, since it allows you to run both the native soap extension and nusoap alongside. You can then implement new code against native soap, while still using nusoap for legacy code.

Related

Mismatch between Php and Extension module

I am trying to install the following php extension. Microsoft Drivers for SQL Server for PHP.
I have tried both versions of the driver but both seem to mismatch the version of php i am running. I looked around and it appears I have to recompile the modules in order to match the php api version. But I don't have any idea how to do this.
Any ideas on how to make this work? Or maybe a simpler way to use PHP 5.4.7 to access SQL.
You can do it with some tricks, its not recommended but it will work fine and in my case, it has not crashed yet :)
Check your phpinfo() page for:
1-PHP extension API Number
2-Thread safe or non-thread safe version
3-(Windows) compiler version
1-For building your extension you need php.lib. It is in your PHP-server dev directory.
2-You need PHP header files for compiling your extension, after including PHP header files, go to PHP/Zend directory and open zend_modules.h file and change the #define ZEND_MODULE_API_NO 20060613to your PHP extension API number for example change it to #define ZEND_MODULE_API_NO 20090626.
3- If you use windows based servers the compiler version is important(VC8 - VC10), if your PHP was compiled with VC8, build the extension in VS2008 or use VC8 for building your project.
If you encounter any wired error just comment it. I spent 3 months to make this worked ;)

Different API number for PHP extension

So this is the case, I am trying to develop an php-extension for my customers. I use SWIG for generating the wrapper code and my main code is c++. After I create my extension successfully I load it in /ext and restart the web server for testing it. I've got the error which mentioned that the extension has been built with API 20090626 but the PHP server(in my case XAMPP) API is 20100525. I totally understand the error, so I open the Zend_modules.h header file in php source and change the API number from 20090626 to 20100525, then I build my extension with updated zend_modules.h header file and now I have no problem.
The question is, my customers are using different php servers with different APIs for sure, and I planed to give them a dll (my extension) which can be loaded easily without any struggles. But now I should give them a VS2010 solution with my main code (dll) dynamically loaded. I mean each user should first check the PHP API from his own server and change the Zend_modules.h header file, build the solution and then use the extension. I need a solution which make my extension totally independent to that API number.
I really appreciate any idea.
I totally understand the error, so I open the Zend_modules.h header file in php source and change the API number from 20090626 to 20100525
The fact that you're doing this tells me that you do not actually understand the error.
Modules are NOT compatible between different major versions of PHP -- the Zend API number is used to ensure that PHP does not inadvertently attempt to load a module that was built for a different version. The modifications that you're making to your PHP build tree are causing it to build modules that will not function correctly on any version at all.
If you need to build modules for multiple major versions of PHP, you need to run the builds using the corresponding version of PHP. You cannot mix and match, and you cannot build a single module that will work for multiple versions. (Nor should you advise your users to modify their PHP build to accept an incompatible module. That'll just make horrible things happen.)
The API versions for a few versions of PHP are listed below:
PHP 5.2: 20060613
PHP 5.3: 20090626
PHP 5.4: 20100525
PHP 5.5: 20120211

Is it possible to access a local printer using TCP/IP sockets in PHP?

I know that PHP has it's own PECL to do this, but I'm currently using PHP 5.4 and the php_printer.dll isn't compiled for this version.
PECL can have some old stuff on there, php_printer.dll is all but deprecated.
Also, as PHP is a scripting language, it's incredibly difficult to gain access to hardware functions (like a printer) directly.
You are best off finding or writing printer access functions in something like C++, and running the script using system(); .
Best of luck!
Printing directly from PHP over TCP/IP sockets requires huge amount of work especially on windows environment without Printer extension or a nice library.
From the documentation:
Windows users must enable php_printer.dll inside of php.ini in order
to use these functions. A DLL for this PECL extension is currently
unavailable.
So, you can try to download php_printer.dll precompiled binary for PHP 5.3 from http://downloads.php.net/pierre/ and use that. Probably it will work with PHP 5.4 too. If not, you should compile PHP from source to use windows Printer extension.

Can I use the PHP SOAP library in PHP 5.1.1?

I have developed a PHP site with PHP 5.3, and would like to deploy it to a server running PHP 5.1.1. My site depends heavily on the PHP SOAP library, since pretty much everything that isn't a presentation task is done by a Web Service. Does PHP 5.1.1 support the SOAP library? Apparently, it doesn't come with the default PHP installation, so, where could I download it?
Before answering your question, I want to mention that you really should upgrade (or convince whoever is in charge) to 5.3.
That said, soap is available, but you must compile with --enable-soap. If you're on a system that uses a package manager, you may try apt-get install php-soap, yum install php-soap, etc. If you're on windows, you may have to download php_soap.dll.
SOAP should be able to run on any version of PHP 5. However, it's important to note that prior to PHP 5.2.9 the SOAP extension is only capable of understanding WSDL 1.0 and 1.1 formats.
To enable SOAP support, configure PHP with --enable-soap.

How to enable soap extensions

Is it possible to enable soap extensions in php without compiling the php dist? I´m using Mac OS X 10.5+ with the built in php interpreter.
If you really don't want to compile it you can use NuSoap from PEAR.
But I'd compile it if I were you, nusoap is not compatible with the built-in soap and it's a pain to juggle. Just do it right and start with the PHP5 SOAP lib.
Alan
As far as i know, you need to compile it because it's a core function. But you could try to copy precompiled php packages over your existing ones to put the compiled soap binaries and it's loading informations into the propriate files. Don't forget to make a backup!

Categories