If you wish to get the latest PHP source tree, you can obtain it through SVN. You should be warned that the SVN version is a development version, and as such, is often unstable, and may not even compile properly. The advantage of using SVN, though, is that you can get the latest fixes and updates, without having to wait for the official releases.
PHP uses an advanced configuration system that requires you to have the following tools. re2c is only necessary for developers and can be found here. All other utilities can be obtained from the GNU FTP site.
- autoconf: 2.13 (2.59+ for PHP 5.4+)
- automake: 1.4+
- libtool: 1.4.x+ (except 1.4.2)
- bison: 1.28, 1.35, 1.75, 2.0 or higher
- flex (PHP 5.2 and earlier): 2.5.4 (not higher)
- re2c: 0.13.4+
If you're experiencing problems, see also the section on buildconf failures.
Steps for using PHP from SVN
Note to PHP.net developers: SSL is set up, so use your credentials and https://svn.php.net/ to access SVN.
The recommended way is to make a sparse checkout of the php-src directory only, then grab
the parts that you need. This enables a single commit to span multiple branches.
svn checkout https://svn.php.net/repository/php/php-src --depth immediates php-src
svn update branches tags --set-depth immediates
svn update trunk branches/PHP_5_4 branches/PHP_5_3 --set-depth infinity
Or alternatively, you can fetch the current PHP source code and the active branches:
svn checkout https://svn.php.net/repository/php/php-src/branches/PHP_5_3 php-src-5.3
svn checkout https://svn.php.net/repository/php/php-src/branches/PHP_5_4 php-src-5.4
svn checkout https://svn.php.net/repository/php/php-src/trunk php-src-trunk
The branch names can also be used for SVN diff and merge operations.
Note that certain combinations of autoconf, automake and libtool may not work when used together. See below for details.
Also, certain versions of autoconf may generate warnings of
AC_PROG_CPP called before AC_PROG_CC. These messages can usually be ignored.
./buildconfto generate the configure script. This may take several moments.
- From this point onwards, installation is similar to the installation of one of the official packages with one main difference – you may need bison 1.28 or later and flex 2.5.4 (PHP 5.2 and earlier) or re2c 0.13.4+ or later (PHP 5.3 and later) to compile, because the pre-generated scanner and parser files may not be included in SVN.
There are many other things, such as the XML source code
for the documentation, available via SVN. See
the web-based view of the SVN
server to see what is available. For example, to checkout the
latest english version of the PHP manual:
svn checkout https://svn.php.net/repository/phpdoc/modules/doc-en ./phpdoc-en
You can also check the SVN FAQ on the wiki.
autoconf, automake and libtool information
There seem to be problems with libtool 1.4.2. It is suggested that you use libtool 1.4, along with autoconf 2.13 and automake 1.4. You should also ensure that autoconf, automake and libtool are installed in the same directory. libtool 1.5 will not work.
The following combinations are known to work with PHP 5.3 and below:
- autoconf 2.13, automake 1.4 and libtool 1.4.3
- autoconf 2.13, automake 1.5 and libtool 1.4.3
If you have multiple versions of autoconf installed on your computer, as is
common for many UNIXes, you can set the PHP_AUTOCONF and PHP_AUTOHEADER
variables when running buildconf to indicate which versions it should use
PHP_AUTOCONF=autoconf213 PHP_AUTOHEADER=autoheader213 ./buildconf
Zend/zend_language_scanner.c: No such file or directory
PHP only supports flex 2.5.4, not later versions as they broke backwards compatibility. Please note that PHP 5.3 and later do not require flex at all.