Install php53 to php52 in parallel » History » Version 30
Andreas Kohlbecker, 05/04/2012 02:49 PM
1 | 1 | Andreas Kohlbecker | |
---|---|---|---|
2 | |||
3 | ## How to install php5.3 to php5.2 in parallel |
||
4 | |||
5 | |||
6 | 18 | Andreas Kohlbecker | _This instructions are specific to Debian Linux and derivatives like Ubuntu from version 12.04 on. For install php5.3 to 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]]._ |
7 | |||
8 | |||
9 | 20 | Andreas Kohlbecker | **In the following you will find a brief description on how to compile and install php 5.2 from source.** |
10 | 1 | Andreas Kohlbecker | |
11 | 2 | Andreas Kohlbecker | |
12 | |||
13 | 1 | Andreas Kohlbecker | see also: |
14 | |||
15 | * 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 | 2 | Andreas Kohlbecker | |
19 | |||
20 | |||
21 | |||
22 | |||
23 | 3 | Andreas Kohlbecker | ### Install additional packages |
24 | 2 | Andreas Kohlbecker | |
25 | |||
26 | ~~~ |
||
27 | 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 |
28 | 29 | Andreas Kohlbecker | |
29 | 2 | Andreas Kohlbecker | ~~~ |
30 | 4 | Andreas Kohlbecker | |
31 | 6 | Andreas Kohlbecker | _You may need more package if you are not having apache2, mysql, gcc and linux sources._ |
32 | 5 | Andreas Kohlbecker | |
33 | 6 | Andreas Kohlbecker | |
34 | |||
35 | 21 | Andreas Kohlbecker | ### Check symlinks in /usr/lib (Ubuntu only, not needed for Debian?) |
36 | 5 | Andreas Kohlbecker | |
37 | |||
38 | Check if the below symlinks exist in @/usr/lib@, if nor create them!: |
||
39 | |||
40 | |||
41 | 1 | Andreas Kohlbecker | ~~~ |
42 | 21 | Andreas Kohlbecker | # cd /usr/lib |
43 | # ln -s x86_64-linux-gnu/libjpeg.a libjpeg.a |
||
44 | # ln -s x86_64-linux-gnu/libjpeg.so libjpeg.so |
||
45 | # ln -s x86_64-linux-gnu/libpng.a libpng.a |
||
46 | # ln -s x86_64-linux-gnu/libpng.so libpng.so |
||
47 | # ln -s x86_64-linux-gnu/libXpm.so libXpm.so |
||
48 | # ln -s x86_64-linux-gnu/libgd.a libgd.a |
||
49 | # ln -s /usr/include/gd.h gd.h |
||
50 | # ln -s /usr/lib/x86_64-linux-gnu/libmysqlclient.so /usr/lib/ |
||
51 | 5 | Andreas Kohlbecker | ~~~ |
52 | 1 | Andreas Kohlbecker | |
53 | 21 | Andreas Kohlbecker | see also https://github.com/vladgh/VladGh.com-LEMP/blob/master/install_files/php.sh |
54 | 1 | Andreas Kohlbecker | |
55 | |||
56 | |||
57 | 8 | Andreas Kohlbecker | |
58 | 1 | Andreas Kohlbecker | |
59 | 21 | Andreas Kohlbecker | ### Download and extract php 5.2 source |
60 | |||
61 | |||
62 | 8 | Andreas Kohlbecker | 1. download http://php.net/downloads.php |
63 | |||
64 | 1. extract |
||
65 | |||
66 | 6 | Andreas Kohlbecker | 1. cd into the extracted folder |
67 | |||
68 | |||
69 | |||
70 | ### Run the configure command |
||
71 | |||
72 | |||
73 | |||
74 | _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) |
||
75 | 1 | Andreas Kohlbecker | |
76 | 6 | Andreas Kohlbecker | |
77 | Run the configure command below inside the extracted php source folder. |
||
78 | 1 | Andreas Kohlbecker | |
79 | 6 | Andreas Kohlbecker | |
80 | 21 | Andreas Kohlbecker | `dpkg-architecture -qDEB_HOST_GNU_TYPE` |
81 | 6 | Andreas Kohlbecker | |
82 | 21 | Andreas Kohlbecker | |
83 | 6 | Andreas Kohlbecker | ./configure is *reporting errors*: |
84 | 10 | Andreas Kohlbecker | |
85 | 12 | Andreas Kohlbecker | 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. |
86 | |||
87 | 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: |
||
88 | |||
89 | |||
90 | 10 | Andreas Kohlbecker | ~~~ |
91 | ###DEBUG |
||
92 | set -x |
||
93 | ~~~ |
||
94 | |||
95 | Execute the configure command again an see the detailed output. |
||
96 | |||
97 | 14 | Andreas Kohlbecker | |
98 | |||
99 | ### Build and install |
||
100 | |||
101 | |||
102 | ~~~ |
||
103 | make |
||
104 | # optional, dauert, findet aber Fehler: |
||
105 | make test |
||
106 | # bringt die Dateien an ihren Platz: |
||
107 | 21 | Andreas Kohlbecker | sudo make install | tee php52-install.log |
108 | 14 | Andreas Kohlbecker | ~~~ |
109 | 15 | Andreas Kohlbecker | |
110 | |||
111 | ### Configure Apache |
||
112 | |||
113 | |||
114 | This was the tricky part! |
||
115 | |||
116 | 23 | Andreas Kohlbecker | |
117 | 15 | Andreas Kohlbecker | Now please follow the instruction on: http://bernhardhaeussner.de/blog/89_Howto:_PHP5.3_parallel_zu_PHP5_installieren |
118 | |||
119 | 26 | 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*. |
120 | 25 | Andreas Kohlbecker | |
121 | 1 | Andreas Kohlbecker | |
122 | 23 | Andreas Kohlbecker | Since the original blog post is no longer available I am copying the relevant paragraphs to here: |
123 | |||
124 | |||
125 | |||
126 | ---- |
||
127 | |||
128 | 24 | Andreas Kohlbecker | _original blog post from Bernhard Häussner - http://bernhardhaeussner.de/blog/89_Howto:_PHP5.3_parallel_zu_PHP5_installieren_ |
129 | 23 | Andreas Kohlbecker | |
130 | |||
131 | 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/php53cgi.conf): |
||
132 | |||
133 | ~~~ |
||
134 | # Damit mod_mime die neue Dateierweiterung erkennt: |
||
135 | AddHandler php53-cgi .php53 |
||
136 | # Damit die Binaries aufgerufen, nicht versendet, werden: |
||
137 | ScriptAlias /bin-php53 /usr/bin/php53/ |
||
138 | # Was eigentlich passieren soll: |
||
139 | Action php53-cgi /bin-php53/php-cgi |
||
140 | # Und noch ein paar Einstellungen für die Binaries: |
||
141 | <Directory /usr/bin/php53> |
||
142 | # Kein .htaccess: |
||
143 | AllowOverride None |
||
144 | # CGI aktivieren, softlinks folgen |
||
145 | Options +ExecCGI +FollowSymLinks |
||
146 | # normalerweise ist der Zugriff auf alle „sonstigen“ Dateien gesperrt, |
||
147 | # daher hier wieder freigeben: |
||
148 | Order allow,deny |
||
149 | Allow from all |
||
150 | </Directory> |
||
151 | ~~~ |
||
152 | Zum Testen kann man z.B. eine phpinfo.php53-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.3 wird auch seine eigene php.ini in /etc/php53/apache2/php.ini verwenden, wohin man vielleicht zunächst die alte Konfigurationsdatei kopieren will. |
||
153 | |||
154 | ~~~ |
||
155 | # php.ini replazieren: |
||
156 | sudo cp /etc/php5/apache2/php.ini /etc/php53/apache2/php.ini |
||
157 | # im Webroot phpinfo mit namespace-Spielerei anlegen :) |
||
158 | echo "<?php namespace YEEES; phpinfo();" > phpinfo.php53 |
||
159 | ~~~ |
||
160 | 1 | Andreas Kohlbecker | Nach den Schritten dieses Tutorials dürfte dann PHP 5.3 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. |
161 | 24 | Andreas Kohlbecker | |
162 | |||
163 | 23 | Andreas Kohlbecker | |
164 | 27 | Andreas Kohlbecker | ---- |
165 | 23 | Andreas Kohlbecker | |
166 | 1 | Andreas Kohlbecker | |
167 | 27 | Andreas Kohlbecker | |
168 | #### Virtual Host and directory configuration |
||
169 | = |
||
170 | |||
171 | |||
172 | In your virtual host configuration file, put a SetHandler directive in the according Directory directive. E.g: |
||
173 | |||
174 | |||
175 | ~~~ |
||
176 | # |
||
177 | # Drupal 5 to run with php5.2 |
||
178 | # |
||
179 | <Directory /var/www/drupal5> |
||
180 | # run Drupal 5 with php5.2 which has been installed manually |
||
181 | # see also http://dev.e-taxonomy.eu/trac/wiki/Install_php5.3_to_php5.2_in_parallel |
||
182 | # |
||
183 | |||
184 | <FilesMatch "\.php"> |
||
185 | SetHandler php52-cgi |
||
186 | </FilesMatch> |
||
187 | Options FollowSymLinks MultiViews |
||
188 | AllowOverride All |
||
189 | Order allow,deny |
||
190 | allow from all |
||
191 | </Directory> |
||
192 | |||
193 | ~~~ |