Install php53 to php52 in parallel » History » Version 39
Andreas Müller, 02/24/2022 08:19 PM
1 | 1 | Andreas Kohlbecker | |
---|---|---|---|
2 | |||
3 | 37 | Andreas Kohlbecker | ## Installing php5.2 and php5.3 in parallel |
4 | 1 | Andreas Kohlbecker | |
5 | |||
6 | 39 | Andreas Müller | _Running multiple versions of PHP at the same time is required if you are about running Druapl 5 and Druapl 6 or 7 together on the same server._ |
7 | 18 | Andreas Kohlbecker | |
8 | 39 | Andreas Müller | _The following guide describes how to install php5.2 manually in parallel to php5.3, which includes compiling and installing php 5.2 from source.The instructions will work with the following Debian Linux versions and derived distributions: Debian sqeeze 6.0.4 and Ubuntu Precise Pangolin 12.04._ |
9 | 1 | Andreas Kohlbecker | |
10 | 39 | Andreas Müller | _For similar instructions on installing php5.3 and php5.2 in parallel in older distributions please refer to [[Install_php53_to_php52_in_parallel_ubuntu-1110|Install php5.3 to php5.2 in parallel in ubuntu-11.10]]._ |
11 | 2 | Andreas Kohlbecker | |
12 | |||
13 | 1 | Andreas Kohlbecker | see also: |
14 | |||
15 | 2 | Andreas Kohlbecker | * http://bernhardhaeussner.de/blog/89_Howto:_PHP5.3_parallel_zu_PHP5_installieren |
16 | |||
17 | * http://artur.ejsmont.org/blog/content/compiling-and-building-php-53-on-ubuntu |
||
18 | |||
19 | |||
20 | 3 | Andreas Kohlbecker | ### Install additional packages |
21 | 2 | Andreas Kohlbecker | |
22 | |||
23 | ~~~ |
||
24 | 30 | Andreas Kohlbecker | apt-get install bison re2c libmysqlclient-dev libbz2-dev bzip2 libxslt1.1 libxslt1-dev libxml2 libxml2-dev libjpeg62-dev libpng12-dev libxpm-dev dpkg-dev libcurl4-gnutls-dev gawk libgd2-xpm-dev libgd2-xpm libmhash-dev |
25 | 29 | Andreas Kohlbecker | |
26 | 2 | Andreas Kohlbecker | ~~~ |
27 | 4 | Andreas Kohlbecker | |
28 | 6 | Andreas Kohlbecker | _You may need more package if you are not having apache2, mysql, gcc and linux sources._ |
29 | 5 | Andreas Kohlbecker | |
30 | 6 | Andreas Kohlbecker | |
31 | |||
32 | 33 | Andreas Kohlbecker | ### Check symlinks in /usr/lib |
33 | 5 | Andreas Kohlbecker | |
34 | |||
35 | 33 | Andreas Kohlbecker | Check if the below symbolic links exist if nor create them!: |
36 | 1 | Andreas Kohlbecker | |
37 | |||
38 | 33 | Andreas Kohlbecker | Ubuntu and Debian: |
39 | |||
40 | 1 | Andreas Kohlbecker | ~~~ |
41 | 33 | Andreas Kohlbecker | ln -s /usr/include/gd.h /usr/lib/gd.h |
42 | 1 | Andreas Kohlbecker | ~~~ |
43 | |||
44 | |||
45 | 33 | Andreas Kohlbecker | Ubuntu only: |
46 | 1 | Andreas Kohlbecker | |
47 | 33 | Andreas Kohlbecker | ~~~ |
48 | cd /usr/lib |
||
49 | ln -s x86_64-linux-gnu/libjpeg.a libjpeg.a |
||
50 | ln -s x86_64-linux-gnu/libjpeg.so libjpeg.so |
||
51 | ln -s x86_64-linux-gnu/libpng.a libpng.a |
||
52 | ln -s x86_64-linux-gnu/libpng.so libpng.so |
||
53 | ln -s x86_64-linux-gnu/libXpm.so libXpm.so |
||
54 | ln -s x86_64-linux-gnu/libgd.a libgd.a |
||
55 | ln -s /usr/lib/x86_64-linux-gnu/libmysqlclient.so /usr/lib/ |
||
56 | ~~~ |
||
57 | |||
58 | see also https://github.com/vladgh/VladGh.com-LEMP/blob/master/install_files/php.sh |
||
59 | 8 | Andreas Kohlbecker | |
60 | 1 | Andreas Kohlbecker | |
61 | 21 | Andreas Kohlbecker | |
62 | ### Download and extract php 5.2 source |
||
63 | |||
64 | 8 | Andreas Kohlbecker | |
65 | 1. download http://php.net/downloads.php |
||
66 | |||
67 | 1. extract |
||
68 | 6 | Andreas Kohlbecker | |
69 | 1. cd into the extracted folder |
||
70 | |||
71 | |||
72 | |||
73 | ### Run the configure command |
||
74 | |||
75 | |||
76 | |||
77 | 1 | Andreas Kohlbecker | _This configuration is based on based on [pkg-php/php.git/debian/rules":http://anonscm.debian.org/gitweb/?p=pkg-php/php.git;a=blob_plain;f=debian/rules;hb=HEAD._ The php5.2 rules are found "here](http://anonscm.debian.org/gitweb/?p=pkg-php/php.git;a=blob_plain;f=debian/rules;hb=41ffb985b80d560777d6c9f9264d129cc6d386ee) |
78 | 6 | Andreas Kohlbecker | |
79 | |||
80 | 1 | Andreas Kohlbecker | Run the configure command below inside the extracted php source folder. |
81 | 6 | Andreas Kohlbecker | |
82 | 21 | Andreas Kohlbecker | |
83 | 6 | Andreas Kohlbecker | `dpkg-architecture -qDEB_HOST_GNU_TYPE` |
84 | 21 | Andreas Kohlbecker | |
85 | 6 | Andreas Kohlbecker | |
86 | 10 | Andreas Kohlbecker | ./configure is *reporting errors*: |
87 | 12 | Andreas Kohlbecker | |
88 | 1. I you are getting an error like `configure: error: xxxx not found. Please check your XXXX installation.` Check if you have installed the xxx package and also the according development package. |
||
89 | |||
90 | 1. You can debug your the configuration by searching for the line of code in `./configure` wich is producing the error message and add the following code snipped before the lines found: |
||
91 | |||
92 | 10 | Andreas Kohlbecker | |
93 | ~~~ |
||
94 | ###DEBUG |
||
95 | set -x |
||
96 | ~~~ |
||
97 | |||
98 | Execute the configure command again an see the detailed output. |
||
99 | 14 | Andreas Kohlbecker | |
100 | |||
101 | |||
102 | ### Build and install |
||
103 | |||
104 | |||
105 | ~~~ |
||
106 | make |
||
107 | # optional, dauert, findet aber Fehler: |
||
108 | make test |
||
109 | 21 | Andreas Kohlbecker | # bringt die Dateien an ihren Platz: |
110 | 14 | Andreas Kohlbecker | sudo make install | tee php52-install.log |
111 | 15 | Andreas Kohlbecker | ~~~ |
112 | |||
113 | |||
114 | ### Configure Apache |
||
115 | |||
116 | |||
117 | This was the tricky part! |
||
118 | 23 | Andreas Kohlbecker | |
119 | 15 | Andreas Kohlbecker | |
120 | Now please follow the instruction on: http://bernhardhaeussner.de/blog/89_Howto:_PHP5.3_parallel_zu_PHP5_installieren |
||
121 | 26 | Andreas Kohlbecker | |
122 | 25 | Andreas Kohlbecker | The instruction on this page are on manually installing php 5.3, so *you have to replace all occurrences of "php53" by "php52" in order translate it to our case*. |
123 | 1 | Andreas Kohlbecker | |
124 | 23 | Andreas Kohlbecker | |
125 | Since the original blog post is no longer available I am copying the relevant paragraphs to here: |
||
126 | |||
127 | |||
128 | |||
129 | ---- |
||
130 | 24 | Andreas Kohlbecker | |
131 | 23 | Andreas Kohlbecker | _original blog post from Bernhard Häussner - http://bernhardhaeussner.de/blog/89_Howto:_PHP5.3_parallel_zu_PHP5_installieren_ |
132 | |||
133 | |||
134 | 35 | Andreas Kohlbecker | Jetzt muss noch Apache über das neue CGI-Modul informiert werden. Dazu müssen die folgenden Konfigurationen gesetzt werden (z.B. elegant in einer neuen Datei /etc/apache2/conf.d/php52cgi.conf): |
135 | 23 | Andreas Kohlbecker | |
136 | ~~~ |
||
137 | 36 | Andreas Kohlbecker | # |
138 | # Installed manually |
||
139 | # based on http://bernhardhaeussner.de/blog/89_Howto:_PHP5.3_parallel_zu_PHP5_installieren |
||
140 | # see also http://dev.e-taxonomy.eu/trac/wiki/Install_php5.3_to_php5.2_in_parallel |
||
141 | |||
142 | 1 | Andreas Kohlbecker | AddHandler php52-cgi .php52 |
143 | 36 | Andreas Kohlbecker | |
144 | ScriptAlias /bin-php52 /usr/bin/php52/ |
||
145 | |||
146 | 35 | Andreas Kohlbecker | Action php52-cgi /bin-php52/php-cgi |
147 | 36 | Andreas Kohlbecker | |
148 | # configuring the php52 binaries folder |
||
149 | 23 | Andreas Kohlbecker | <Directory /usr/bin/php52> |
150 | 36 | Andreas Kohlbecker | # NO .htaccess: |
151 | 1 | Andreas Kohlbecker | AllowOverride None |
152 | 23 | Andreas Kohlbecker | Options +ExecCGI +FollowSymLinks |
153 | # normalerweise ist der Zugriff auf alle „sonstigen“ Dateien gesperrt, |
||
154 | # daher hier wieder freigeben: |
||
155 | Order allow,deny |
||
156 | Allow from all |
||
157 | </Directory> |
||
158 | 36 | Andreas Kohlbecker | |
159 | 23 | Andreas Kohlbecker | ~~~ |
160 | Zum Testen kann man z.B. eine phpinfo.php52-Datei anlegen und man sollte die neue PHP-Verion angezeigt bekommen. Auf dieser Info-Seite kann man dann prüfen, ob alle Module verwendbar sind, die Zeitzone gesetzt ist und anderen potentielle Konfigurationsfehler auf die Schliche kommen. PHP 5.2 wird auch seine eigene php.ini in /etc/php53/apache2/php.ini verwenden, wohin man vielleicht zunächst die alte Konfigurationsdatei kopieren will. |
||
161 | |||
162 | ~~~ |
||
163 | # php.ini replazieren: |
||
164 | sudo cp /etc/php5/apache2/php.ini /etc/php53/apache2/php.ini |
||
165 | 1 | Andreas Kohlbecker | # im Webroot phpinfo mit namespace-Spielerei anlegen :) |
166 | 35 | Andreas Kohlbecker | echo "<?php namespace YEEES; phpinfo();" > phpinfo.php53 |
167 | 24 | Andreas Kohlbecker | ~~~ |
168 | 27 | Andreas Kohlbecker | Nach den Schritten dieses Tutorials dürfte dann PHP 5.2 mehr oder weniger optimal laufen, ohne dass die Funktion alter Scripte eingeschränkt werden muss, und es lässt sich einfach die Interkompatibilität zwischen den Versionen testen. |
169 | 23 | Andreas Kohlbecker | |
170 | 1 | Andreas Kohlbecker | |
171 | 27 | Andreas Kohlbecker | |
172 | ---- |
||
173 | |||
174 | |||
175 | |||
176 | #### Virtual Host and directory configuration |
||
177 | |||
178 | |||
179 | In your virtual host configuration file, put a SetHandler directive in the according Directory directive. E.g: |
||
180 | |||
181 | |||
182 | ~~~ |
||
183 | # |
||
184 | # Drupal 5 to run with php5.2 |
||
185 | # |
||
186 | <Directory /var/www/drupal5> |
||
187 | # run Drupal 5 with php5.2 which has been installed manually |
||
188 | # see also http://dev.e-taxonomy.eu/trac/wiki/Install_php5.3_to_php5.2_in_parallel |
||
189 | # |
||
190 | |||
191 | <FilesMatch "\.php"> |
||
192 | SetHandler php52-cgi |
||
193 | </FilesMatch> |
||
194 | Options FollowSymLinks MultiViews |
||
195 | AllowOverride All |
||
196 | Order allow,deny |
||
197 | allow from all |
||
198 | 1 | Andreas Kohlbecker | </Directory> |
199 | |||
200 | ~~~ |