|
6 | 6 | <div class="panel"> |
7 | 7 | <div class="body"> |
8 | 8 | <p> |
9 | | - This page is intended to help setup a development environment for PHP, if mistakes are found |
| 9 | + This page is intended to help set up a development environment for PHP, if mistakes are found |
10 | 10 | please <a href="https://bugs.php.net">report</a> them. |
11 | 11 | </p> |
12 | 12 | </div> |
13 | 13 | </div> |
14 | 14 | '; |
15 | 15 |
|
16 | | -site_header("Operating System Preparation", ["current" => "community"]); |
| 16 | +site_header( |
| 17 | + "Operating System Preparation", |
| 18 | + [ |
| 19 | + "current" => "community", |
| 20 | + "css" => [ |
| 21 | + "code-syntax.css", |
| 22 | + ], |
| 23 | + ], |
| 24 | +); |
17 | 25 |
|
18 | 26 | ?> |
19 | 27 | <h2 id="os-prep" class="content-header">Operating System Preparation</h2> |
|
22 | 30 | Improving PHP requires a working build environment to test changes, the following section deals with setting up a working build environment. |
23 | 31 | </p> |
24 | 32 | <p> |
25 | | - Your build environment should have an appropriate toolchain that includes a working C compiler, |
26 | | - for those not working in Microsoft Windows, you will need a working, compatible autotools installation, and at the very least a shared copy of zlib. |
| 33 | + Your build environment should have an appropriate toolchain that includes a working C compiler. |
| 34 | + For those not working in Microsoft Windows, you will need a working, compatible autotools installation, and at the very least a shared copy of zlib. |
27 | 35 | </p> |
28 | 36 | <p> |
29 | 37 | For most *nix like operating systems, some external dependencies may be required to bring a build to completion; |
30 | | - if a build fails because of missing headers or libraries, issuing a variant of the following command should resolve those dependencies, allowing the build to continue: |
31 | | - <ul> |
32 | | - <li><pre class="small">[sudo] yum|apt-get|ports install package[-dev[el]]</pre></li> |
33 | | - </ul> |
| 38 | + if a build fails because of missing headers or libraries, issuing a variant of the following command should resolve those dependencies, allowing the build to continue. |
34 | 39 | </p> |
| 40 | +<div class="code-toolbar"> |
| 41 | +<pre class="small">[sudo] yum|apt|port install package[-dev[el]]</pre> |
| 42 | +</div> |
| 43 | +<p> |
| 44 | + For those working in <i>Ubuntu Linux</i>, you can run the following command to automate the installation of dependencies. |
| 45 | +</p> |
| 46 | +<div class="code-toolbar"> |
| 47 | +<pre class="small">sudo apt build-dep php</pre> |
| 48 | +</div> |
35 | 49 | <p> |
36 | | - For those working in <i>Ubuntu Linux</i>, you can run the following command to automate the installation of dependencies: |
37 | | - <ul> |
38 | | - <li><pre class="small">sudo apt-get build-dep php5</pre></li> |
39 | | - </ul> |
40 | | - If the compilation of <i>an extension</i> should fail because of missing dependencies, <i>Ubuntu Linux</i> can attempt to automate the resolution of those dependencies by issuing: |
41 | | - <ul> |
42 | | - <li><pre class="small">sudo apt-get build-dep php5-<i>extname</i></pre></li> |
43 | | - </ul> |
| 50 | + If the compilation of <i>an extension</i> fails because of missing dependencies, <i>Ubuntu Linux</i> can attempt to automate the resolution of those dependencies by issuing: |
44 | 51 | </p> |
| 52 | +<div class="code-toolbar"> |
| 53 | +<pre class="small">sudo apt build-dep php-<extname></pre> |
| 54 | +</div> |
45 | 55 | <p> |
46 | | - The following table shows what is required for Microsoft Windows users to build PHP: |
| 56 | + The following table shows what is required for Microsoft Windows users to build supported PHP versions: |
47 | 57 | </p> |
48 | 58 | <table> |
49 | 59 | <tr> |
|
54 | 64 | <th>PHP SDK</th> |
55 | 65 | </tr> |
56 | 66 | <tr> |
57 | | - <td align="center">5.3</td> |
58 | | - <td align="center">Visual Studio 2008</td> |
59 | | - <td align="center">6.1</td> |
60 | | - <td align="center"><a href="http://windows.php.net/downloads/php-sdk/deps-5.3-vc9-x86.7z">x86</a></td> |
61 | | - <td align="center"><a href="http://windows.php.net/downloads/php-sdk/php-sdk-binary-tools-20110512.zip">here</a></td> |
| 67 | + <td align="center">8.2</td> |
| 68 | + <td align="center">Visual Studio 2019</td> |
| 69 | + <td align="center">VS16</td> |
| 70 | + <td align="center"> |
| 71 | + <a href="https://downloads.php.net/~windows/php-sdk/deps/vs16/x86/">x86</a>, |
| 72 | + <a href="https://downloads.php.net/~windows/php-sdk/deps/vs16/x64/">x64</a> |
| 73 | + </td> |
| 74 | + <td align="center"><a href="https://github.com/php/php-sdk-binary-tools/releases">tools</a></td> |
62 | 75 | </tr> |
63 | 76 | <tr> |
64 | | - <td align="center">5.4</td> |
65 | | - <td align="center">Visual Studio 2008</td> |
66 | | - <td align="center">6.1</td> |
67 | | - <td align="center"><a href="http://windows.php.net/downloads/php-sdk/deps-5.4-vc9-x86.7z">x86</a></td> |
68 | | - <td align="center"><a href="http://windows.php.net/downloads/php-sdk/php-sdk-binary-tools-20110915.zip">here</a></td> |
| 77 | + <td align="center">8.3</td> |
| 78 | + <td align="center">Visual Studio 2019</td> |
| 79 | + <td align="center">VS16</td> |
| 80 | + <td align="center"> |
| 81 | + <a href="https://downloads.php.net/~windows/php-sdk/deps/vs16/x86/">x86</a>, |
| 82 | + <a href="https://downloads.php.net/~windows/php-sdk/deps/vs16/x64/">x64</a> |
| 83 | + </td> |
| 84 | + <td align="center"><a href="https://github.com/php/php-sdk-binary-tools/releases">tools</a></td> |
69 | 85 | </tr> |
70 | 86 | <tr> |
71 | | - <td align="center">5.5</td> |
72 | | - <td align="center">Visual Studio 2008</td> |
73 | | - <td align="center">6.1</td> |
74 | | - <td align="center"><a href="http://windows.php.net/downloads/php-sdk/deps-5.5-vc9-x86.7z">x86</a></td> |
75 | | - <td align="center"><a href="http://windows.php.net/downloads/php-sdk/php-sdk-binary-tools-20110915.zip">here</a></td> |
| 87 | + <td align="center">8.4</td> |
| 88 | + <td align="center">Visual Studio 2022</td> |
| 89 | + <td align="center">VS17</td> |
| 90 | + <td align="center"> |
| 91 | + <a href="https://downloads.php.net/~windows/php-sdk/deps/vs17/x86/">x86</a>, |
| 92 | + <a href="https://downloads.php.net/~windows/php-sdk/deps/vs17/x64/">x64</a> |
| 93 | + </td> |
| 94 | + <td align="center"><a href="https://github.com/php/php-sdk-binary-tools/releases">tools</a></td> |
76 | 95 | </tr> |
77 | 96 | <tr> |
78 | | - <td align="center">5.5</td> |
79 | | - <td align="center">Visual Studio 2012</td> |
80 | | - <td align="center">N/A</td> |
| 97 | + <td align="center">8.5</td> |
| 98 | + <td align="center">Visual Studio 2022</td> |
| 99 | + <td align="center">VS17</td> |
81 | 100 | <td align="center"> |
82 | | - <a href="http://windows.php.net/downloads/php-sdk/deps-5.5-vc11-x86.7z">x86</a>, |
83 | | - <a href="http://windows.php.net/downloads/php-sdk/deps-5.5-vc11-x64.7z">x64</a> |
| 101 | + <a href="https://downloads.php.net/~windows/php-sdk/deps/vs17/x86/">x86</a>, |
| 102 | + <a href="https://downloads.php.net/~windows/php-sdk/deps/vs17/x64/">x64</a> |
84 | 103 | </td> |
85 | | - <td align="center"><a href="http://windows.php.net/downloads/php-sdk/php-sdk-binary-tools-20110915.zip">here</a></td> |
| 104 | + <td align="center"><a href="https://github.com/php/php-sdk-binary-tools/releases">tools</a></td> |
86 | 105 | </tr> |
87 | 106 | </table> |
88 | 107 | <p><b>Note:</b> If a Windows SDK is required, it is advised to install the SDK <i>before</i> Visual Studio.</p> |
|
91 | 110 | <h2 id="workspace-prep" class="content-header">Workspace Preparation</h2> |
92 | 111 | <div class="content-box"> |
93 | 112 | <p> |
94 | | - Windows users should now download and unzip the PHP SDK to their workspace and execute the following commands in an appropriate Visual Studio Console: |
| 113 | + Windows users should now download and unzip the PHP SDK to their workspace and execute the following commands in an appropriate Visual Studio 2019/2022 Developer Command Prompt: |
95 | 114 | </p> |
96 | 115 | <p> |
97 | | - Visual Studio 2008: |
98 | | - <ul> |
99 | | - <li><pre>setenv /xp /Release /x86</pre></li> |
100 | | - </ul> |
101 | | - Visual Studio 2008 and 2012: |
102 | | - <ul> |
103 | | - <li><pre class="small">cd C:\path-to-workspace</pre></li> |
104 | | - <li><pre class="small">bin\phpsdk_setvars.bat</pre></li> |
105 | | - <li><pre class="small">bin\phpsdk_buildtree.bat phpdev</pre></li> |
106 | | - </ul> |
107 | | - Windows should now change to the directory C:\path-to-workspace\phpdev\<i>VCXX</i>\<i>XARCH</i>, and consider it the root of the workspace for the current build. |
| 116 | + Visual Studio 2019 and 2022: |
| 117 | +</p> |
| 118 | +<div class="code-toolbar"> |
| 119 | +<pre class="small">cd C:\path-to-workspace |
| 120 | +bin\phpsdk_setvars.bat |
| 121 | +bin\phpsdk_buildtree.bat phpdev</pre> |
| 122 | +</div> |
| 123 | +<p> |
| 124 | + Windows should now change to the directory C:\path-to-workspace\phpdev\<i>VSXX</i>\<i>XARCH</i>, and consider it the root of the workspace for the current build. |
108 | 125 | </p> |
109 | 126 | <p> |
110 | 127 | The next step for everyone is to obtain the versioned PHP sources via git: |
111 | | - <ul> |
112 | | - <li><pre class="small">git clone -b BRANCH https://github.com/php/php-src .</pre></li> |
113 | | - </ul> |
114 | | - BRANCH should be replaced with an appropriate branch name, for example <i>PHP-5.5</i>. |
| 128 | +</p> |
| 129 | +<div class="code-toolbar"> |
| 130 | +<pre class="small">git clone -b BRANCH https://github.com/php/php-src .</pre> |
| 131 | +</div> |
| 132 | +<p> |
| 133 | + BRANCH should be replaced with an appropriate branch name, for example, <i>PHP-8.5</i>. |
115 | 134 | </p> |
116 | 135 | <p> |
117 | | - At this point you have a working build environment and the vanilla sources for your chosen branch of PHP, it is a good idea, before you change anything at all, to create a new branch and switch to it, in preparation for your awesome changes to come: |
118 | | - <ul> |
119 | | - <li><pre class="small">git checkout -b my-awesome-changes</pre></li> |
120 | | - </ul> |
| 136 | + At this point you have a working build environment and the vanilla sources for your chosen branch of PHP, it is a good idea, before you change anything at all, to create a new branch and switch to it, in preparation for your awesome changes to come. |
121 | 137 | </p> |
| 138 | +<div class="code-toolbar"> |
| 139 | +<pre class="small">git checkout -b my-awesome-changes</pre> |
| 140 | +</div> |
122 | 141 | </div> |
123 | 142 |
|
124 | 143 |
|
125 | 144 | <h2 id="build-dev" class="content-header">Building Your Development PHP</h2> |
126 | 145 | <div class="content-box"> |
127 | 146 | <p> |
128 | 147 | All operating systems now converge on (near as makes no difference) the same solutions for the rest of the build process: |
129 | | - <ul class="listed"> |
130 | | - <li><pre class="small">buildconf: generates the configure script for PHP</pre></li> |
131 | | - <li><pre class="small">configure: configures the build of PHP and creates Makefile</pre></li> |
132 | | - <li><pre class="small">make: builds PHP</pre></li> |
133 | | - <li><pre class="small">make test: runs testsuite</pre></li> |
134 | | - <li><pre class="small">make install: installs PHP</pre></li> |
135 | | - </ul> |
136 | 148 | </p> |
137 | | -<p> |
138 | | - For Microsoft Windows operating systems, those commands looks like this: |
139 | | - <ul class="listed"> |
140 | | - <li><pre class="small">buildconf</pre></li> |
141 | | - <li><pre class="small">configure --with-prefix=C:\my-awesome-php</pre></li> |
142 | | - <li><pre class="small">nmake</pre></li> |
143 | | - <li><pre class="small">nmake test</pre></li> |
144 | | - <li><pre class="small">nmake install</pre></li> |
145 | | - </ul> |
| 149 | +<ul class="listed"> |
| 150 | + <li><code>buildconf</code>: generates the configure script for PHP</li> |
| 151 | + <li><code>configure</code>: configures the build of PHP and creates Makefile</li> |
| 152 | + <li><code>make</code>: builds PHP</li> |
| 153 | + <li><code>make test</code>: runs testsuite</li> |
| 154 | + <li><code>make install</code>: installs PHP</li> |
| 155 | +</ul> |
| 156 | +<p> |
| 157 | + For Microsoft Windows operating systems, those commands look like this: |
146 | 158 | </p> |
| 159 | +<div class="code-toolbar"> |
| 160 | +<pre class="small">buildconf |
| 161 | +configure --with-prefix=C:\my-awesome-php |
| 162 | +nmake |
| 163 | +nmake test |
| 164 | +nmake install</pre> |
| 165 | +</div> |
147 | 166 | <p> |
148 | 167 | While for the rest of us, those commands look like this: |
149 | | - <ul class="listed"> |
150 | | - <li><pre class="small">./buildconf</pre></li> |
151 | | - <li><pre class="small">./configure --prefix=/opt/my-awesome-php</pre></li> |
152 | | - <li><pre class="small">make</pre></li> |
153 | | - <li><pre class="small">make test</pre></li> |
154 | | - <li><pre class="small">make install</pre></li> |
155 | | - </ul> |
156 | 168 | </p> |
| 169 | +<div class="code-toolbar"> |
| 170 | +<pre class="small">./buildconf |
| 171 | +./configure --prefix=/opt/my-awesome-php |
| 172 | +make |
| 173 | +make test |
| 174 | +make install</pre> |
| 175 | +</div> |
157 | 176 | <p> |
158 | | - The <i>configure</i> script has the ability to customize almost every aspect of PHP, to elicit help at the console pass <i>--help</i> |
| 177 | + The <i>configure</i> script can customize almost every aspect of PHP, to elicit help at the console pass <i>--help</i> |
159 | 178 | as the only argument to <i>configure</i></p> |
160 | 179 | <p> |
161 | 180 | When <i>configure</i> executes, it saves the options passed in to a re-usable <i>config.nice</i> which executes <i>configure</i> when invoked. |
162 | 181 | </p> |
163 | 182 | <p> |
164 | | - Upon successful completion of a build, it is recommended to run the test suite, this will help you to identify regression problems in your work, |
| 183 | + Upon successful completion of a build, it is recommended to run the test suite; this will help you to identify regression problems in your work, |
165 | 184 | running the test suite can take a while; go out for a run, or a burger. |
166 | 185 | </p> |
167 | 186 | <p> |
168 | 187 | It is also possible to run a set (directory) of tests in the following way: |
169 | | - <ul> |
170 | | - <li><pre class="small">[n]make test TESTS=sapi/cli</pre></li> |
171 | | - </ul> |
172 | 188 | </p> |
| 189 | +<div class="code-toolbar"> |
| 190 | +<pre class="small">[n]make test TESTS=sapi/cli</pre> |
| 191 | +</div> |
173 | 192 | </div> |
174 | 193 | <?php |
175 | 194 | site_footer(['sidebar' => $SIDEBAR_DATA]); |
0 commit comments