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
-1
votes
1 answer

Why appear "Linux host path" in the process of the code "echo"? Usage PHP extension "PCNTL"

I use PHP extension "PCNTL" write some codes, and run it in terminal, but why appear the Linux host Path "gdy@localhost:~/myDev/webroot/spider/my$" This is my echo in terminal This is my PHP CODE
Damon
  • 103
  • 1
  • 7
-1
votes
1 answer

PHP extension calling another extension function

I'm writing a PHP extension and wanted to call openssl extension functions from my extension, to be specific, I want to call openssl_x509_read function from inside my extension. Is it possible? And how do I do it?
-1
votes
2 answers

in whm where can i access(type) "/scripts/installimagemagick"

my server is on whm and trying to install imagemagick and then imagick, but can't seem to find out where to type in: /scripts/installimagemagick I currently do not have commandline access to do this. So how else can i go about installing…
dave
  • 14,991
  • 26
  • 76
  • 110
-1
votes
1 answer

Call to undefined function mssql_connect()

I always used PHP 5.2.3 version, but now I updated PHP to version 5.3.2. I have problem with MSSQL, I can`t connect to MSSQL server. I have downloaded a SQL server driver for PHP 1.1 There are a lot of files, I used php_sqlsrv_53_ts_vc9. Put it on…
Dezigo
  • 3,220
  • 3
  • 31
  • 39
-1
votes
2 answers

Setting PHP format in Sublime 3

I am using Sublime 3 and just started working with PHP. My problem is that the PHP file is showing up as an HTML. When I save it as index.php and try to view it in the MAMP server, it won't work. I am assuming it's because Sublime 3 is not…
Joanna K.
  • 33
  • 1
  • 9
-1
votes
1 answer

Are PHP extensions just "shell cases" for real libraries?

If this is true and PHP extensions run shell commands in the background, why not just use shell_exec instead? Would there be any difference? I'm under the impression that PHP extension are usually written by newbs because they are full of bugs. For…
thelolcat
  • 10,995
  • 21
  • 60
  • 102
-1
votes
1 answer

PECL Adding gearman to php extension

Hi i'm really having a hard time here, I'm trying to install gearman job/task queue. I'm using windows, wappstack to be exact, then followed exactly the instructions here, and so far so good. I think I've installed the gearman server. But I can't…
muffin
  • 2,034
  • 10
  • 43
  • 79
-1
votes
1 answer

upload a new php extestion with WHM

I need to load and run a new extension on an apache/linux server I have downloaded the extension from the vendor website and they say to upload to: /usr/local/lib/php/extensions/ How can I upload to that path via whm? (I have no ssh access and I…
-1
votes
1 answer

how to remove extension in php

Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase /online_shoping/ RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\s([^.]+)\.php [NC] RewriteRule ^ %1 [R,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule…
Shubham Verma
  • 39
  • 1
  • 12
-1
votes
2 answers

How to enable cURL programmatically?

I know the manual process uncomment the line ;extension=php_curl.dll But I need this enable using php code. any idea?
Shawon
  • 930
  • 2
  • 10
  • 19
-1
votes
2 answers

Where to download iMagick PHP extension VC6 and VC9

I would like to use iMagick with my PHP web page, but I can't find where to download an official PHP extension for Windows compiled with code http://pecl.php.net/package/imagick I found some links on the web like…
sdespont
  • 13,915
  • 9
  • 56
  • 97
-1
votes
3 answers

PHP Extension: Defined function is undefined

I am creating an SPI extension for my Raspberry Pi, and have encountered a rather strange problem with a class function that I am trying to add. (The repo is here if you want to check anything obvious I am missing: php_spi on Github) In my…
frak
  • 858
  • 1
  • 10
  • 30
-1
votes
1 answer

Minimum requirements to compile a PHP extension

I have the source for a PHP extension, and the compiled version for PHP 5.3. But I have PHP 5.4, and the project appears to have been abandoned. So given the source code, what is the minimum I have to do to compile it for PHP 5.4? EDIT Note: I'm on…
Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592
-2
votes
1 answer

How to using Java from PHP?

Possible Duplicate: Make PHP execute and communicate with a Java application on a web server I want to use http://code.google.com/p/zxing/ in my PHP web application. How do I do I do this since zxing is in Java? I downloaded this:…
StackOverflowNewbie
  • 39,403
  • 111
  • 277
  • 441
-2
votes
1 answer

composer update problem with ext-calender * is missing from your system

Am trying to update composer dependencies on a Laravel application but getting this error Problem 1 - The requested PHP extension ext-calender* is missing from your system. Install or enable PHP's calendar extension. in my composer.json…
Jonathan
  • 39
  • 8
1 2 3
67
68