xref: /web-php/git.php (revision 673fcf38)
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><i>autoconf</i>:
47  <ul>
48   <li><i>PHP 5.4 - 7.1</i>: 2.59+</li>
49   <li><i>PHP 7.2</i>: 2.64+</li>
50   <li><i>PHP 7.3</i>: 2.68+</li>
51  </ul>
52 </li>
53 <li><i>libtool</i>: 1.4.x+ (except 1.4.2)</li>
54 <li><i>re2c</i>: 0.13.4+</li>
55 <li id="bison"><i>bison</i>:
56  <ul>
57   <li><i>PHP 5.4</i>: 1.28, 1.35, 1.75, 2.0 to 2.6.4</li>
58   <li><i>PHP 5.5 and 5.6</i>: 2.4 to 2.7</li>
59   <li><i>PHP 7.0 - 7.3</i>: 2.4+</li>
60   <li><i>PHP 7.4 - PHP 8.0</i>: 3.0.0+</li>
61  </ul>
62 </li>
63</ul>
64
65<p>
66 If you're experiencing problems, see also the section on
67 <a href="#buildconf_fail">buildconf failures</a>.
68</p>
69
70<h2>Steps for using PHP from Git</h2>
71
72<ol>
73 <li>
74  You can retrieve the PHP source code from our
75  <a href="https://github.com/php/php-src.git">GitHub</a> with this
76  command:
77  <br><br>
78  <code>git clone https://github.com/php/php-src.git</code>
79  <br><br>
80
81  You can also download a snapshot from GitHub:<br><br>
82  <ul>
83   <li>Go to the <a href="https://github.com/php/php-src">php-src project page</a>.</li>
84   <li>Select the branch you're interested in from the branch dropdown.</li>
85   <li>Click on the <strong>Download ZIP</strong> button.</li>
86  </ul>
87 </li>
88
89 <li>
90  Make sure you're in the right directory to work on PHP:
91  <br><br>
92  <code>cd php-src</code>
93  <br><br>
94 </li>
95
96 <li>
97  You can then check out the branch you want to build, for example:
98  <br><br>
99  <strong>PHP 7.4</strong>:
100  <code>git checkout PHP-7.4</code>
101  <br>
102  <strong>PHP 8.0</strong>:
103  <code>git checkout PHP-8.0</code>
104  <br>
105  <strong>PHP 8.1</strong>:
106  <code>git checkout PHP-8.1</code>
107  <br>
108  <strong>PHP 8.2</strong>:
109  <code>git checkout PHP-8.2</code>
110  <br>
111  <strong>PHP HEAD</strong>:
112  <code>git checkout master</code>
113  <br><br>
114 </li>
115
116 <li>
117  <div class="tip" style="margin: 10px 0 10px 20px;">
118   <p>Note that certain combinations of autoconf and libtool may not
119   work when used together, particularly with historical versions of PHP. See
120   <a href="#buildconf_fail">below</a> for details.<br>
121   Also, certain versions of autoconf may generate warnings of <code>AC_PROG_CPP
122   called before AC_PROG_CC</code>. These messages can usually be ignored.</p>
123  </div>
124 </li>
125
126 <li>
127  Run <code>./buildconf</code> to generate the configure script. This may take several moments.
128 </li>
129
130 <li>
131  From this point onwards, installation is similar to the installation of one of
132  the official packages with one main difference &ndash; you will need
133  <a href="#bison">a version of bison that is supported for the PHP version you want to build</a>.
134  You may also require re2c if you intend to change any of the scanner and
135  parser files PHP uses.
136 </li>
137</ol>
138
139<p>
140 There are many other things, such as the XML source code
141 for the documentation, available via Git. See
142 <a href="https://github.com/php/">the web-based view of the Git
143 server</a> to see what is available.
144</p>
145
146<p>
147 The PHP Wiki has a useful
148 <a href="https://wiki.php.net/vcs/gitfaq">Git FAQ</a>, which provides useful
149 tips and cheatsheets for using the PHP Git repository, and if you want to
150 become involved in developing PHP, the
151 <a href="https://wiki.php.net/vcs/gitworkflow">Git Workflow</a> page is also
152 likely to be of interest.
153</p>
154
155<h2>PHP manual</h2>
156
157<p>
158 The PHP manual is hosted on Git. To checkout the latest English version of the PHP
159 manual:<br>
160 <code>git clone https://github.com/php/doc-en.git ./phpdoc-en</code>
161</p>
162
163<h2>Historical issues</h2>
164
165<h3 id="buildconf_fail">autoconf and libtool information for PHP 5.3 and below</h3>
166
167<p>
168 There seem to be problems with libtool 1.4.2. It is suggested
169 that you use libtool 1.4, along with autoconf 2.13 and
170 automake 1.4. You should also ensure that autoconf, automake
171 and libtool are installed in the same directory. libtool 1.5
172 will not work.
173</p>
174
175<p>The following combinations are known to work with PHP 5.3 and below:</p>
176<ul>
177 <li>autoconf 2.13, automake 1.4 and libtool 1.4.3</li>
178 <li>autoconf 2.13, automake 1.5 and libtool 1.4.3</li>
179</ul>
180
181<p>Since PHP 4.3 automake and its aclocal program are no longer needed to build PHP.</p>
182
183<p>
184 If you have multiple versions of autoconf installed on your computer, as is
185 common for many UNIXes, you can set the PHP_AUTOCONF and PHP_AUTOHEADER
186 variables when running buildconf to indicate which versions it should use
187 e.g.:<br>
188 <code>PHP_AUTOCONF=autoconf213 PHP_AUTOHEADER=autoheader213 ./buildconf</code>
189</p>
190
191<h3 id="flex_fail">Zend/zend_language_scanner.c: No such file or directory</h3>
192
193<p>
194 PHP only supports flex 2.5.4, <strong>not</strong> later versions as they broke backwards compatibility.
195 Please note that PHP 5.3 and later do not require flex at all.
196</p>
197
198<?php site_footer(); ?>
199