Questions tagged [php-extension]

The PHP language can be enhanced through the use of extensions, which provide to PHP scripts new internal functions, classes, resource types, streams (also stream wrappers and filters) and, in general, can do anything a native program would be able to do.

The PHP language can be enhanced through the use of extensions, which provide to PHP scripts new internal functions, classes, resource types, streams (also stream wrappers and filters) and, in general, can do anything a native program would be able to do. Extensions are typically written in order to:

  • Wrap a native library, which is typically written in C or C++.
  • Implement PHP code in a language that offers more optimization opportunities, such as C, so that pages can be served faster and/or more pages can be served concurrently.
  • Implement/functions classes that, being closer to PHP's core, are able to do things that would otherwise not be possible (e.g. add/remove functions from the function table dynamically, bypass open_basedir).

PHP is written in C and has a C API available for extensions, therefore these tend to be written in that language. However, the only requirement is that the resulting extension is able to interface with PHP's APIs, handle its data structures and can be loaded by PHP's extension loading mechanism.

SWIG can be used to wrap native libraries in an easier fashion. See also PHP4Delphi, which allows embedding PHP in Delphi and other applications as well as writing PHP extensions in Delphi.

A special type of extensions, Zend extensions, are more tightly coupled with PHP and are provided with more hooks so that they can modify PHP's behavior more extensively. They are typically used to implement debuggers (e.g. XDebug).

Unfortunately, there is no official and up-to-date reference on how to write PHP extensions. However, see this answer for several resources.

1016 questions
4
votes
2 answers

Error during installing XML_RPC2

I'm trying to install XML_RPC2 package from PEAR library, but whenever I type a proper command (pear install XML_RPC2) I'm getting an error: pear/XML_RPC2 requires PHP extension "curl" No valid packages found install faild Strangely enough…
Błażej Klisz
  • 1,730
  • 2
  • 16
  • 16
4
votes
2 answers

PHP Docker install php7-mysql

For a while now, I'm trying to install the php7-mysql driver into different PHP docker containers from php/docker with no luck. My Dockerfile looks like this: # Dockerfile FROM php:7.3-rc-apache-stretch RUN apt-get update && apt-get upgrade -y When…
divramod
  • 1,454
  • 2
  • 20
  • 35
4
votes
1 answer

Warnings after recompiling php (Unable to load dynamic library & Unable to initialize module)

After recompiling php I get the following errors when I use php cli: PHP Warning: PHP Startup: imap: Unable to initialize module Module compiled with module API=20050922 PHP compiled with module API=20090626 These options need to match in…
Reem
  • 1,439
  • 2
  • 18
  • 21
4
votes
1 answer

Howto ubuntu 18.04 install / activate PHP extension ext-mcrypt

I am installing a fresh kubuntu system 18.04, which is using by default php7.2 A composer install for my current software project gibves me this error message: The requested PHP extension ext-mcrypt * is missing from your system. Install or…
Calamity Jane
  • 2,189
  • 5
  • 36
  • 68
4
votes
2 answers

PHP 7.1+ Windows readline extension not all functions exist

One of the improvements in PHP7.1 is that in Windows the readline extension is available out of the box. I'm having trouble using all of the functions though, as they don't all exist. The following code: $functions = [ 'readline_add_history', …
e_i_pi
  • 4,590
  • 4
  • 27
  • 45
4
votes
0 answers

How to install sqlsrv for xampp mac os version

I used XAMPP 7.1.11 for Mac OS. I could not find the extensions directory to install SQLSRV extension I try so many way to solved this problem about 2 Weeks. Is there anyone every setup PHP like this. Let discus together.
4
votes
1 answer

macOS Sierra installing PHP Extension intl

I am trying to get magento 2.x to run on my machine. I am using xampp 5.6 with the same php version and running a virtual apache server. As seen in this screenshot The PHP Extension intl. is missing. I was researching on how it can be added /…
noa-dev
  • 3,561
  • 9
  • 34
  • 72
4
votes
1 answer

Elastic Beanstalk compile php with ZipArchive enabled

I need to set my PHP project to compile php with ZipArchive enabled. I am running php7 on Elastic Beanstalk and need help on how to write a ".ebextensions" file to accomplish this task. Can someone help me out here? Thank!
4
votes
1 answer

configure: error: Cannot find OpenSSL's

I've installed the php7 on my redhat server,while i want to use the mysql extension.I cd the php7 source ext dir,and configured many times but all result that "configure: error: Cannot find OpenSSL's ".It's awfal! 1.I had the openssl there. [root@xx…
Yong
  • 71
  • 2
  • 9
4
votes
1 answer

Zend Global Variable in an Extension Persisting Across Multiple Requests

As the title explains, I want to maintain an information across requests from multiple clients. Let me put in a simple example to explain what I want. This example is just for illustration of my question and not the purpose of the post. Example: I…
Karthick
  • 2,844
  • 4
  • 34
  • 55
4
votes
4 answers

Installing xDebug on xampp on mac: phpize not working

I am using xampp5.6.15 on OS 10.11. I was following this instruction to install xDebug. My "tailored installation instruction" is as follows: In this instruction, it doesn't mention where to put the downloaded tgz file, so I just left it where it…
shenkwen
  • 3,536
  • 5
  • 45
  • 85
4
votes
0 answers

Installing Moodle on Bluemix PHP runtime: missing extensions

I am trying to install Moodle on the default PHP runtime on Bluemix. But I run into the following problem with missing extensions: manifest.yml buildpack: php_buildpack I cloned the default PHP runtime to my localhost, included the Moodle…
remkohdev
  • 250
  • 3
  • 13
4
votes
2 answers

PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) in Unknown on line 0

Would like to add the gd zip extension to php, done the phpize ./configure make make install routine, still can't find gd zip. Any idea ? root@audio-mon[10.10.10.82] ~/DOWNLOADS/php-5.5.23/ext/zip # phpize Configuring for: PHP Api Version: …
ychaouche
  • 4,922
  • 2
  • 44
  • 52
4
votes
1 answer

Wrapping boost::shared_ptr in PHP using SWIG

If I use SWIG to wrap this C++ function: boost::shared_ptr Client::create() { return boost::shared_ptr(new Client()); } And then call it in PHP: $client = Client::create(); echo gettype($client); The type of $client is…
Ed Mazur
  • 3,042
  • 3
  • 21
  • 21
4
votes
1 answer

How can i enable php extension with .htaccess file

I need to enable php_intl extension only in a subdomain of my website, so i use the .htaccess file to do it with this code. php_extension_dir php_intl.dll php_extension php_intl.dll But not work. Someone…
user3332475
  • 55
  • 1
  • 2
  • 10