Cover image for How to install SVN extension for PHP 7

How to install SVN extension for PHP 7

alwinaugustin profile image Alwin ・2 min read

SVN extension for PHP allows PHP scripts to communicate with SVN repositories without using direct command line calls to the SVN executable. The extension is not available with standard PHP installation. There are two ways that the extnesion can be installed.

1. From PECL

As the extension is part of PECL, it can be installed like any other PECL extension. Even though the subversion executable is not required for the installation of the extension, subversion headers are required for compiling it. So it is better to install subversion, subversion-devel, and neon packages first. In a CentOS-based system, the installation is as follows:

# yum install subversion subversion-devel neon neon-devel
# pecl install svn
# echo "extension=svn.so" > /etc/php.ini
# service httpd restart

2. From Source

The extension can be compiled and installed from the source. This allows specifying PHP configurations and versions for the SVN extension. In the following section, we are discussing how to install SVN extension for PHP 7+ versions.

First, download and extract the extension from the PECL repository. Type the following commands in your terminal.

# wget https://pecl.php.net/get/svn-2.0.3.tgz

The only version of the SVN extension which supports PHP versions higher than 7 is the 2.0.3 . It is still in the beta phase and is not recommended to use in a production environment.

Extract the tar file.

# tar -xvzf svn-2.0.3.tgz

Navigate to the extracted folder

# cd svn-2.0.3

Now we can compile the extension from here.

First, prepare the build environment using phpize . Run the following command from your terminal.

# /your/path/to/phpize

Compile and install

# ./configure
# make
# make install

Finally, the extension needs to be added to php.ini

# echo "extension=svn.so" >> /etc/php.ini

Now check the phpinfo(); or use php -i|grep 'SVN' to see whether the extension is installed.

During the compilation process, if you get an error like

configure: error: Cannot find php-config. Please use --with-php-config=PATH

Use :

# ./configure --with-php-config=<your path to php-config file>


markdown guide