Posts: 17
Joined: Sun Jul 22, 2012 9:33 pm

Using PHP to control SPI devices

Wed Sep 05, 2012 4:46 pm

I have made a PHP extension that provides an object oriented interface to the SPI devices. To build the extension, you will need to have php5-dev installed, and the instructions in the README should guide you through the install process. The repository can be found here

The inspiration for this project was to be able to replicate the software used in this project: ... i/software in PHP as that is where my skills lie. I hope that this extension will prove useful to other PHP developers working with a Pi out there...

Posts: 2
Joined: Mon Mar 11, 2013 1:33 pm

Re: Using PHP to control SPI devices

Mon Mar 11, 2013 2:58 pm

Hi Frak,

I really want to use your PHP extension but I'm getting stuck on
$ ./phpize
$ ./configure --enable--spi
$ make
$ make test
$ sudo make install

Can you explain it further? Getting now a "No such file or directory" error.

Thanks in advance!

Posts: 13
Joined: Thu Apr 25, 2013 4:58 pm

Re: Using PHP to control SPI devices

Sat May 11, 2013 1:24 pm

Hi @Frak,

I can confirm as @PHMJS replied to your post that I'm stuck at the same step. Could you please give details how to install?

Can you tell us where you run these commands?

Code: Select all

$ ./phpize
$ ./configure --enable--spi
$ make
$ make test
$ sudo make install
Read on other blog sites / forums that phpize is installed on /usr/bin/ but I'm not able to enter to that folder
As you might see in below terminal there are two folders but I'm not sure how to install it.


Posts: 3
Joined: Thu Aug 15, 2013 3:44 pm

Re: Using PHP to control SPI devices

Thu Aug 15, 2013 3:54 pm

For anyone who is still having a problem with phpize...

I used ...
$ cd ~/php_spi
and then
$ /usr/bin/phpize
I encountered a problem with $ make test but $ sudo make install appeared to work.

Hope this is of some help.

Posts: 1
Joined: Thu Nov 15, 2018 9:20 pm

Re: Using PHP to control SPI devices

Thu Nov 15, 2018 9:26 pm

In the meanwhile there was some development on this topic in the PHP world.
You have now the following possibilities:
  • Using the berry-spi extension for native communication (linked against the C interface of Pigpio)

Return to “Other programming languages”