xref: /web-php/git.php (revision 65f08351)
1<?php
2$_SERVER['BASE_PAGE'] = 'git.php';
3include_once __DIR__ . '/include/prepend.inc';
4$SIDEBAR_DATA = '
5<h3>What is Git?</h3>
6<p>
7 You can find more information about Git and download clients for most major
8 platforms at <a href="http://git-scm.com/">the official Git site</a>.
9</p>
10
11<p>
12 The <a href="http://progit.org/">Pro Git book</a> may also be useful.
13</p>
14
15
16<h3>Contribute</h3>
17<p>
18 If you would like to join PHP development or would like to
19 contribute to the PHP documentation, contact the relevant
20 group. You may want <a href="/git-php.php">your own Git account</a>
21 to contribute.
22</p>
23';
24site_header("Git Access", ["current" => "community"]);
25?>
26
27<h1>Git Access</h1>
28
29<p>
30 If you wish to get the latest PHP source tree, you can obtain it through Git.
31 You should be warned that the Git version is a development version, and as
32 such, is often unstable, and may not even compile properly. The advantage of
33 using Git, though, is that you can get the latest fixes and updates, without
34 having to wait for the official releases.
35</p>
36
37<p>
38 PHP uses an advanced configuration system that requires you to have
39 the following tools. re2c is only necessary for developers and can be found
40 <a href="http://re2c.org">here</a>.
41 All other utilities can be obtained from
42 <a href="ftp://ftp.gnu.org/pub/gnu/">the GNU FTP site</a>.
43</p>
44
45<ul>
46 <li id="autoconf"><i>autoconf</i>:
47  <ul>
48   <li><i>PHP 7.3 and later</i>: 2.68+</li>
49   <li><i>PHP 7.2</i>: 2.64+</li>
50   <li><i>PHP 7.1 and earlier</i>: 2.59+</li>
51  </ul>
52 </li>
53 <li id="libtool"><i>libtool</i>: 1.4.x+ (except 1.4.2)</li>
54 <li id="re2c"><i>re2c</i>:
55  <ul>
56    <li><i>PHP 8.3 and later</i>: 1.0.3+</li>
57    <li><i>PHP 8.2 and earlier</i>: 0.13.4+</li>
58  </ul>
59 </li>
60 <li id="bison"><i>bison</i>:
61  <ul>
62   <li><i>PHP 7.4 and later</i>: 3.0.0+</li>
63   <li><i>PHP 7.3 and earlier</i>: 2.4+</li>
64  </ul>
65 </li>
66</ul>
67
68<p>
69 If you're experiencing problems, see also the section on
70 <a href="#buildconf_fail">buildconf failures</a>.
71</p>
72
73<h2>Steps for using PHP from Git</h2>
74
75<ol>
76 <li>
77  You can retrieve the PHP source code from our
78  <a href="https://github.com/php/php-src.git">GitHub</a> with this
79  command:
80  <br><br>
81  <code>git clone https://github.com/php/php-src.git</code>
82  <br><br>
83
84  You can also download a snapshot from GitHub:<br><br>
85  <ul>
86   <li>Go to the <a href="https://github.com/php/php-src">php-src project page</a>.</li>
87   <li>Select the branch you're interested in from the branch dropdown.</li>
88   <li>Click on the <strong>Download ZIP</strong> button.</li>
89  </ul>
90 </li>
91
92 <li>
93  Make sure you're in the right directory to work on PHP:
94  <br><br>
95  <code>cd php-src</code>
96  <br><br>
97 </li>
98
99 <li>
100  You can then check out the branch you want to build, for example:
101  <br><br>
102  <strong>PHP 7.4</strong>:
103  <code>git checkout PHP-7.4</code>
104  <br>
105  <strong>PHP 8.0</strong>:
106  <code>git checkout PHP-8.0</code>
107  <br>
108  <strong>PHP 8.1</strong>:
109  <code>git checkout PHP-8.1</code>
110  <br>
111  <strong>PHP 8.2</strong>:
112  <code>git checkout PHP-8.2</code>
113  <br>
114  <strong>PHP HEAD</strong>:
115  <code>git checkout master</code>
116  <br><br>
117 </li>
118
119 <li>
120  <div class="tip" style="margin: 10px 0 10px 20px;">
121   <p>Note that certain combinations of autoconf and libtool may not
122   work when used together, particularly with historical versions of PHP. See
123   <a href="#buildconf_fail">below</a> for details.<br>
124   Also, certain versions of autoconf may generate warnings of <code>AC_PROG_CPP
125   called before AC_PROG_CC</code>. These messages can usually be ignored.</p>
126  </div>
127 </li>
128
129 <li>
130  Run <code>./buildconf</code> to generate the configure script. This may take several moments.
131 </li>
132
133 <li>
134  From this point onwards, installation is similar to the installation of one of
135  the official packages with one main difference &ndash; you will need
136  <a href="#bison">a version of bison that is supported for the PHP version you want to build</a>.
137  You may also require re2c if you intend to change any of the scanner and
138  parser files PHP uses.
139 </li>
140</ol>
141
142<p>
143 There are many other things, such as the XML source code
144 for the documentation, available via Git. See
145 <a href="https://github.com/php/">the web-based view of the Git
146 server</a> to see what is available.
147</p>
148
149<p>
150 The PHP Wiki has a useful
151 <a href="https://wiki.php.net/vcs/gitfaq">Git FAQ</a>, which provides useful
152 tips and cheatsheets for using the PHP Git repository, and if you want to
153 become involved in developing PHP, the
154 <a href="https://wiki.php.net/vcs/gitworkflow">Git Workflow</a> page is also
155 likely to be of interest.
156</p>
157
158<h2>PHP manual</h2>
159
160<p>
161 The PHP manual is hosted on Git. To checkout the latest English version of the PHP
162 manual:<br>
163 <code>git clone https://github.com/php/doc-en.git ./phpdoc-en</code>
164</p>
165
166<h2>Historical issues</h2>
167
168<h3 id="buildconf_fail">autoconf and libtool information for PHP 5.3 and below</h3>
169
170<p>
171 There seem to be problems with libtool 1.4.2. It is suggested
172 that you use libtool 1.4, along with autoconf 2.13 and
173 automake 1.4. You should also ensure that autoconf, automake
174 and libtool are installed in the same directory. libtool 1.5
175 will not work.
176</p>
177
178<p>The following combinations are known to work with PHP 5.3 and below:</p>
179<ul>
180 <li>autoconf 2.13, automake 1.4 and libtool 1.4.3</li>
181 <li>autoconf 2.13, automake 1.5 and libtool 1.4.3</li>
182</ul>
183
184<p>Since PHP 4.3 automake and its aclocal program are no longer needed to build PHP.</p>
185
186<p>
187 If you have multiple versions of autoconf installed on your computer, as is
188 common for many UNIXes, you can set the PHP_AUTOCONF and PHP_AUTOHEADER
189 variables when running buildconf to indicate which versions it should use
190 e.g.:<br>
191 <code>PHP_AUTOCONF=autoconf213 PHP_AUTOHEADER=autoheader213 ./buildconf</code>
192</p>
193
194<h3 id="flex_fail">Zend/zend_language_scanner.c: No such file or directory</h3>
195
196<p>
197 PHP only supports flex 2.5.4, <strong>not</strong> later versions as they broke backwards compatibility.
198 Please note that PHP 5.3 and later do not require flex at all.
199</p>
200
201<?php site_footer(); ?>
202