<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>GIS and Web Tricks &#187; web 2.0</title>
	<atom:link href="http://www.bernawebdesign.ch/byteblog/category/web20/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bernawebdesign.ch/byteblog</link>
	<description>Thougts and tricks on GIS, web development and FOSS</description>
	<lastBuildDate>Tue, 31 Jan 2012 23:52:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Custom PHP 5.3.1 with APC and XDEBUG on (Dreamhost) Shared Host</title>
		<link>http://www.bernawebdesign.ch/byteblog/2010/02/17/custom-php-5-3-1-with-apc-and-xdebug-on-dreamhost-shared-hosting/</link>
		<comments>http://www.bernawebdesign.ch/byteblog/2010/02/17/custom-php-5-3-1-with-apc-and-xdebug-on-dreamhost-shared-hosting/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 09:35:38 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[web 2.0]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[custom php]]></category>
		<category><![CDATA[Dreamhost]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://www.bernawebdesign.ch/byteblog/?p=116</guid>
		<description><![CDATA[I&#8217;ve recently been setting up my new dreamhost for symfony projects deployment and the only thing the default PHP is missing is the support for APC (alternate php cache). So after looking at the dreamhost wiki I cleaned up and added some features to the one of the install scripts. Here it is for your/mine [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently been setting up my new dreamhost for symfony projects deployment and the only thing the default PHP is missing is the support for APC (alternate php cache). <span id="more-116"></span>So after looking at the <a href="http://wiki.dreamhost.com/index.php/Installing_PHP5">dreamhost wiki</a> I cleaned up and added some features to the <a href="http://wiki.dreamhost.com/index.php/Installing_PHP5#Improved_script_for_a_minimal_PHP_5.3.x_install_with_APC">one of the install scripts</a>. Here it is for your/mine (future) commodity.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># update 16.2.2010 </span>
<span style="color: #666666; font-style: italic;"># @author Marco Bernasocchi &lt;marco@bernawebdesign.ch&gt;</span>
<span style="color: #666666; font-style: italic;"># - Added OPENSSL LIBMCRYPT LIBTOOL and a promt for installing XDEBUG</span>
<span style="color: #666666; font-style: italic;">#   (still uses XDEBUG 2.05, which has basic PHP 5.3.1 support. 2.1.0 is on its way)</span>
<span style="color: #666666; font-style: italic;"># - removed unsupported php configure switches</span>
<span style="color: #666666; font-style: italic;"># - disabled --with-xsl, if you want to use it you'll probably need to install</span>
<span style="color: #666666; font-style: italic;">#   libxslt (http://xmlsoft.org/XSLT/) version 1.1.0 or greater.</span>
<span style="color: #666666; font-style: italic;"># - sets the ini files into the install directory instead than on cgi-bin</span>
<span style="color: #666666; font-style: italic;"># - to add more domains just copy the cgi binary to the new domain</span>
<span style="color: #666666; font-style: italic;">#   cp &quot;$PHP_BIN_DIR/php-cgi&quot; &quot;$NEW_CGI_BIN_DIR/php.cgi&quot; and modifiy the .htaccess</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#Script for a minimal PHP 5.3.x install with APC</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#- Prompts for the domain to build for</span>
<span style="color: #666666; font-style: italic;">#- PHP configure line contains only valid PHP5 options</span>
<span style="color: #666666; font-style: italic;">#- Displays colourful status messages</span>
<span style="color: #666666; font-style: italic;">#- Many build messages, which aren't helpful to most people, are now suppressed</span>
<span style="color: #666666; font-style: italic;">#- Procedurised, making it cleaner and easier to follow</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#The only things you may want to change in here are marked with &quot;@todo&quot;s</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#Derived form the original PHP 5.3 install script at</span>
<span style="color: #666666; font-style: italic;">#http://wiki.dreamhost.com/Installing_PHP5</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#@author Dan Bettles &lt;dan@danbettles.net&gt;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#Exit on error</span>
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-e</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">clear</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Enter the domain for which you want to build PHP and press [ENTER]: &quot;</span>
<span style="color: #c20cb9; font-weight: bold;">read</span> DOMAIN
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Enable XDEBUG (y|n): &quot;</span>
<span style="color: #c20cb9; font-weight: bold;">read</span> ENABLEXDEBUG
&nbsp;
<span style="color: #666666; font-style: italic;">#===============================================================================</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#@todo Update versions, if necessary</span>
<span style="color: #007800;">M4</span>=<span style="color: #ff0000;">&quot;m4-1.4.13&quot;</span>
<span style="color: #007800;">AUTOCONF</span>=<span style="color: #ff0000;">&quot;autoconf-2.65&quot;</span>
<span style="color: #007800;">OPENSSL</span>=<span style="color: #ff0000;">&quot;openssl-0.9.8l&quot;</span>   
<span style="color: #007800;">CURL</span>=<span style="color: #ff0000;">&quot;curl-7.20.0&quot;</span>
<span style="color: #007800;">LIBMCRYPT</span>=<span style="color: #ff0000;">&quot;libmcrypt-2.5.8&quot;</span>
<span style="color: #007800;">LIBTOOL</span>=<span style="color: #ff0000;">&quot;libtool-2.2.6b&quot;</span>
<span style="color: #007800;">PHP</span>=<span style="color: #ff0000;">&quot;php-5.3.1&quot;</span>
<span style="color: #007800;">APC</span>=<span style="color: #ff0000;">&quot;APC-3.1.3p1&quot;</span>
<span style="color: #007800;">XDEBUG</span>=<span style="color: #ff0000;">&quot;xdebug-2.0.5&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#@todo Update install paths, if necessary</span>
<span style="color: #007800;">WEB_ROOT</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$HOME</span>/<span style="color: #007800;">$DOMAIN</span>/web&quot;</span>
<span style="color: #007800;">CGI_BIN_DIR</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$WEB_ROOT</span>/cgi-bin&quot;</span>
<span style="color: #007800;">HTACCESS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$WEB_ROOT</span>/.htaccess&quot;</span>
&nbsp;
<span style="color: #007800;">INSTALL_DIR</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$HOME</span>/mycompiles&quot;</span>
<span style="color: #007800;">BUILD_DIR</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$INSTALL_DIR</span>/build&quot;</span>
<span style="color: #007800;">DOWNLOADS_DIR</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$INSTALL_DIR</span>/downloads&quot;</span>
<span style="color: #007800;">PHP_BASE_DIR</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$INSTALL_DIR</span>/<span style="color: #007800;">$PHP</span>&quot;</span>
<span style="color: #007800;">PHP_BIN_DIR</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$PHP_BASE_DIR</span>/bin&quot;</span>
<span style="color: #007800;">PHP_EXTENSIONS_DIR</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$PHP_BASE_DIR</span>/extensions&quot;</span>
<span style="color: #007800;">PHP_CONFIG_DIR</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$PHP_BASE_DIR</span>/etc/php5/config&quot;</span>
<span style="color: #007800;">PHP_INI</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$PHP_CONFIG_DIR</span>/php.ini&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#@todo Alter features, if necessary</span>
<span style="color: #007800;">PHP_FEATURES</span>=<span style="color: #ff0000;">&quot;--prefix=<span style="color: #007800;">$PHP_BASE_DIR</span> <span style="color: #000099; font-weight: bold;">\
</span> --with-config-file-path=<span style="color: #007800;">$PHP_CONFIG_DIR</span> <span style="color: #000099; font-weight: bold;">\
</span> --with-config-file-scan-dir=<span style="color: #007800;">$PHP_CONFIG_DIR</span> <span style="color: #000099; font-weight: bold;">\
</span> --bindir=<span style="color: #007800;">$PHP_BIN_DIR</span> <span style="color: #000099; font-weight: bold;">\
</span> --enable-zip <span style="color: #000099; font-weight: bold;">\
</span> --with-xmlrpc <span style="color: #000099; font-weight: bold;">\
</span> --with-freetype-dir=/usr <span style="color: #000099; font-weight: bold;">\
</span> --with-zlib-dir=/usr <span style="color: #000099; font-weight: bold;">\
</span> --with-jpeg-dir=/usr <span style="color: #000099; font-weight: bold;">\
</span> --with-png-dir=/usr <span style="color: #000099; font-weight: bold;">\
</span> --with-curl=<span style="color: #007800;">$PHP_BASE_DIR</span> <span style="color: #000099; font-weight: bold;">\
</span> --with-gd <span style="color: #000099; font-weight: bold;">\
</span> --enable-gd-native-ttf <span style="color: #000099; font-weight: bold;">\
</span> --enable-ftp <span style="color: #000099; font-weight: bold;">\
</span> --enable-exif <span style="color: #000099; font-weight: bold;">\
</span> --enable-sockets <span style="color: #000099; font-weight: bold;">\
</span> --enable-wddx <span style="color: #000099; font-weight: bold;">\
</span> --enable-sqlite-utf8 <span style="color: #000099; font-weight: bold;">\
</span> --enable-calendar <span style="color: #000099; font-weight: bold;">\
</span> --enable-mbstring <span style="color: #000099; font-weight: bold;">\
</span> --enable-mbregex <span style="color: #000099; font-weight: bold;">\
</span> --enable-bcmath <span style="color: #000099; font-weight: bold;">\
</span> --with-mysql=/usr <span style="color: #000099; font-weight: bold;">\
</span> --with-mysqli <span style="color: #000099; font-weight: bold;">\
</span> --without-pear <span style="color: #000099; font-weight: bold;">\
</span> --with-gettext <span style="color: #000099; font-weight: bold;">\
</span> --with-pdo-mysql <span style="color: #000099; font-weight: bold;">\
</span> --with-openssl=<span style="color: #007800;">$PHP_BASE_DIR</span> <span style="color: #000099; font-weight: bold;">\
</span> #--with-xsl=$=<span style="color: #007800;">$PHP_BASE_DIR</span> <span style="color: #000099; font-weight: bold;">\
</span> --with-mcrypt=<span style="color: #007800;">$PHP_BASE_DIR</span>&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#===============================================================================</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#@param string $1 Message</span>
<span style="color: #000000; font-weight: bold;">function</span> echoL1 <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>\033[1;37;44m$1\033[0;0;0m<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#@param string $1 Message</span>
<span style="color: #000000; font-weight: bold;">function</span> echoL2 <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>\033[0;37;44m$1\033[0;0;0m<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#@param string $1 URL</span>
<span style="color: #666666; font-style: italic;">#@param string $2 Output directory</span>
<span style="color: #000000; font-weight: bold;">function</span> downloadTo <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-c</span> <span style="color: #007800;">$1</span> <span style="color: #660033;">--directory-prefix</span>=<span style="color: #007800;">$2</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#@param string $1 TAR filename</span>
<span style="color: #666666; font-style: italic;">#@param string $2 Output directory</span>
<span style="color: #000000; font-weight: bold;">function</span> untarTo <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$2</span>
    <span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xzf</span> <span style="color: #007800;">$1</span>
    <span style="color: #7a0874; font-weight: bold;">cd</span> -
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#@param string $1 Source directory</span>
<span style="color: #666666; font-style: italic;">#@param string $2 Output directory</span>
<span style="color: #666666; font-style: italic;">#@param string $3 configure arguments</span>
<span style="color: #000000; font-weight: bold;">function</span> configureAndMake <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$1</span>
    <span style="color: #007800;">COMMAND</span>=<span style="color: #ff0000;">&quot;./configure --quiet --prefix=$2 $3&quot;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$1</span> = <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BUILD_DIR</span>/<span style="color: #007800;">$OPENSSL</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
      <span style="color: #666666; font-style: italic;">#special command for OPEN SSL</span>
      <span style="color: #007800;">COMMAND</span>=<span style="color: #ff0000;">&quot;./config --prefix=$2 $3&quot;</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$COMMAND</span>&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">eval</span> <span style="color: #007800;">$COMMAND</span>
    <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #660033;">--quiet</span> 
    <span style="color: #7a0874; font-weight: bold;">cd</span> -
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#@param string $1 Source directory</span>
<span style="color: #666666; font-style: italic;">#@param string $2 Output directory</span>
<span style="color: #666666; font-style: italic;">#@param string $3 configure arguments</span>
<span style="color: #000000; font-weight: bold;">function</span> makeAndInstall <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    configureAndMake <span style="color: #007800;">$1</span> <span style="color: #007800;">$2</span> <span style="color: #ff0000;">&quot;$3&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$1</span>
    <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #660033;">--quiet</span> 
    <span style="color: #7a0874; font-weight: bold;">cd</span> -
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#@param string $1 Directory</span>
<span style="color: #000000; font-weight: bold;">function</span> mkdirClean <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> <span style="color: #007800;">$1</span>
    <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #007800;">$1</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#@param string $1 Message</span>
<span style="color: #000000; font-weight: bold;">function</span> echoWarning <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>\033[1;37;41m$1\033[0;0;0m<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PATH</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$PATH</span>:<span style="color: #007800;">$PHP_BIN_DIR</span>&quot;</span>
&nbsp;
echoL1 <span style="color: #ff0000;">&quot;-&gt; DOWNLOADING...&quot;</span>
&nbsp;
mkdirClean <span style="color: #007800;">$BUILD_DIR</span> 
&nbsp;
echoL2 <span style="color: #ff0000;">&quot;--&gt; Downloading <span style="color: #007800;">$M4</span>...&quot;</span>
downloadTo <span style="color: #ff0000;">&quot;http://ftp.gnu.org/gnu/m4/<span style="color: #007800;">$M4</span>.tar.gz&quot;</span> <span style="color: #007800;">$DOWNLOADS_DIR</span>
untarTo <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DOWNLOADS_DIR</span>/<span style="color: #007800;">$M4</span>.tar.gz&quot;</span> <span style="color: #007800;">$BUILD_DIR</span> 
&nbsp;
echoL2 <span style="color: #ff0000;">&quot;--&gt; Downloading <span style="color: #007800;">$AUTOCONF</span>...&quot;</span>
downloadTo <span style="color: #ff0000;">&quot;http://ftp.gnu.org/gnu/autoconf/<span style="color: #007800;">$AUTOCONF</span>.tar.gz&quot;</span> <span style="color: #007800;">$DOWNLOADS_DIR</span>
untarTo <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DOWNLOADS_DIR</span>/<span style="color: #007800;">$AUTOCONF</span>.tar.gz&quot;</span> <span style="color: #007800;">$BUILD_DIR</span> 
&nbsp;
echoL2 <span style="color: #ff0000;">&quot;--&gt; Downloading <span style="color: #007800;">$OPENSSL</span>...&quot;</span>
downloadTo <span style="color: #ff0000;">&quot;http://www.openssl.org/source/<span style="color: #007800;">$OPENSSL</span>.tar.gz&quot;</span> <span style="color: #007800;">$DOWNLOADS_DIR</span>
untarTo <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DOWNLOADS_DIR</span>/<span style="color: #007800;">$OPENSSL</span>.tar.gz&quot;</span> <span style="color: #007800;">$BUILD_DIR</span> 
&nbsp;
echoL2 <span style="color: #ff0000;">&quot;--&gt; Downloading <span style="color: #007800;">$CURL</span>...&quot;</span>
downloadTo <span style="color: #ff0000;">&quot;http://curl.haxx.se/download/<span style="color: #007800;">$CURL</span>.tar.gz&quot;</span> <span style="color: #007800;">$DOWNLOADS_DIR</span>
untarTo <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DOWNLOADS_DIR</span>/<span style="color: #007800;">$CURL</span>.tar.gz&quot;</span> <span style="color: #007800;">$BUILD_DIR</span> 
&nbsp;
echoL2 <span style="color: #ff0000;">&quot;--&gt; Downloading <span style="color: #007800;">$LIBMCRYPT</span>...&quot;</span>
downloadTo <span style="color: #ff0000;">&quot;http://easynews.dl.sourceforge.net/sourceforge/mcrypt/<span style="color: #007800;">$LIBMCRYPT</span>.tar.gz&quot;</span> <span style="color: #007800;">$DOWNLOADS_DIR</span>
untarTo <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DOWNLOADS_DIR</span>/<span style="color: #007800;">$LIBMCRYPT</span>.tar.gz&quot;</span> <span style="color: #007800;">$BUILD_DIR</span> 
&nbsp;
echoL2 <span style="color: #ff0000;">&quot;--&gt; Downloading <span style="color: #007800;">$LIBTOOL</span>...&quot;</span>
downloadTo <span style="color: #ff0000;">&quot;http://ftp.gnu.org/gnu/libtool/<span style="color: #007800;">$LIBTOOL</span>.tar.gz&quot;</span> <span style="color: #007800;">$DOWNLOADS_DIR</span>
untarTo <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DOWNLOADS_DIR</span>/<span style="color: #007800;">$LIBTOOL</span>.tar.gz&quot;</span> <span style="color: #007800;">$BUILD_DIR</span> 
&nbsp;
echoL2 <span style="color: #ff0000;">&quot;--&gt; Downloading <span style="color: #007800;">$PHP</span>...&quot;</span>
downloadTo <span style="color: #ff0000;">&quot;http://www.php.net/get/<span style="color: #007800;">$PHP</span>.tar.gz/from/this/mirror&quot;</span> <span style="color: #007800;">$DOWNLOADS_DIR</span>
untarTo <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DOWNLOADS_DIR</span>/<span style="color: #007800;">$PHP</span>.tar.gz&quot;</span> <span style="color: #007800;">$BUILD_DIR</span> 
&nbsp;
echoL2 <span style="color: #ff0000;">&quot;--&gt; Downloading <span style="color: #007800;">$APC</span>...&quot;</span>
downloadTo <span style="color: #ff0000;">&quot;http://pecl.php.net/get/<span style="color: #007800;">$APC</span>.tgz&quot;</span> <span style="color: #007800;">$DOWNLOADS_DIR</span>
untarTo <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DOWNLOADS_DIR</span>/<span style="color: #007800;">$APC</span>.tgz&quot;</span> <span style="color: #007800;">$BUILD_DIR</span> 
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$ENABLEXDEBUG</span> = <span style="color: #ff0000;">&quot;y&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
  echoL2 <span style="color: #ff0000;">&quot;--&gt; Downloading <span style="color: #007800;">$XDEBUG</span>...&quot;</span>
  downloadTo <span style="color: #ff0000;">&quot;http://xdebug.org/files/<span style="color: #007800;">$XDEBUG</span>.tgz&quot;</span> <span style="color: #007800;">$DOWNLOADS_DIR</span>
  untarTo <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DOWNLOADS_DIR</span>/<span style="color: #007800;">$XDEBUG</span>.tgz&quot;</span> <span style="color: #007800;">$BUILD_DIR</span> 
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span>
&nbsp;
echoL1 <span style="color: #ff0000;">&quot;-&gt; BUILDING...&quot;</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #007800;">$PHP_BASE_DIR</span> 
&nbsp;
echoL2 <span style="color: #ff0000;">&quot;--&gt; Building <span style="color: #007800;">$M4</span>...&quot;</span>
makeAndInstall <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BUILD_DIR</span>/<span style="color: #007800;">$M4</span>&quot;</span> <span style="color: #007800;">$PHP_BASE_DIR</span>
&nbsp;
echoL2 <span style="color: #ff0000;">&quot;--&gt; Building <span style="color: #007800;">$AUTOCONF</span>...&quot;</span>
makeAndInstall <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BUILD_DIR</span>/<span style="color: #007800;">$AUTOCONF</span>&quot;</span> <span style="color: #007800;">$PHP_BASE_DIR</span>
&nbsp;
echoL2 <span style="color: #ff0000;">&quot;--&gt; Building <span style="color: #007800;">$OPENSSL</span>...&quot;</span>
makeAndInstall <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BUILD_DIR</span>/<span style="color: #007800;">$OPENSSL</span>&quot;</span> <span style="color: #007800;">$PHP_BASE_DIR</span>
&nbsp;
echoL2 <span style="color: #ff0000;">&quot;--&gt; Building <span style="color: #007800;">$CURL</span>...&quot;</span>
makeAndInstall <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BUILD_DIR</span>/<span style="color: #007800;">$CURL</span>&quot;</span> <span style="color: #007800;">$PHP_BASE_DIR</span> <span style="color: #ff0000;">&quot;--enable-ipv6 --enable-cookies<span style="color: #000099; font-weight: bold;">\
</span> --enable-crypto-auth --with-ssl&quot;</span> 
&nbsp;
echoL2 <span style="color: #ff0000;">&quot;--&gt; Building <span style="color: #007800;">$LIBMCRYPT</span>...&quot;</span>
makeAndInstall <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BUILD_DIR</span>/<span style="color: #007800;">$LIBMCRYPT</span>&quot;</span> <span style="color: #007800;">$PHP_BASE_DIR</span> <span style="color: #ff0000;">&quot;--disable-posix-threads&quot;</span>
&nbsp;
echoL2 <span style="color: #ff0000;">&quot;--&gt; Building <span style="color: #007800;">$LIBTOOL</span>...&quot;</span>
makeAndInstall <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BUILD_DIR</span>/<span style="color: #007800;">$LIBTOOL</span>&quot;</span> <span style="color: #007800;">$PHP_BASE_DIR</span> 
&nbsp;
echoL2 <span style="color: #ff0000;">&quot;--&gt; Building <span style="color: #007800;">$PHP</span>...&quot;</span>
<span style="color: #666666; font-style: italic;">#Fixes compile error</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">EXTRA_LIBS</span>=<span style="color: #ff0000;">&quot;-lresolv&quot;</span>
makeAndInstall <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BUILD_DIR</span>/<span style="color: #007800;">$PHP</span>&quot;</span> <span style="color: #007800;">$PHP_BASE_DIR</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$PHP_FEATURES</span>&quot;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span>
&nbsp;
echoL1 <span style="color: #ff0000;">&quot;-&gt; INSTALLING PHP...&quot;</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #660033;">-m</span> 0755 <span style="color: #007800;">$CGI_BIN_DIR</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #660033;">-m</span> 0755 <span style="color: #007800;">$PHP_CONFIG_DIR</span>
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$PHP_BIN_DIR</span>/php-cgi&quot;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$CGI_BIN_DIR</span>/php.cgi&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BUILD_DIR</span>/<span style="color: #007800;">$PHP</span>/php.ini-production&quot;</span> <span style="color: #007800;">$PHP_INI</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #007800;">$PHP_EXTENSIONS_DIR</span>
&nbsp;
echoL2 <span style="color: #ff0000;">&quot;--&gt; Building <span style="color: #007800;">$APC</span>...&quot;</span>
<span style="color: #007800;">APC_SOURCE_DIR</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$BUILD_DIR</span>/<span style="color: #007800;">$APC</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$APC_SOURCE_DIR</span>
<span style="color: #007800;">$PHP_BIN_DIR</span><span style="color: #000000; font-weight: bold;">/</span>phpize
configureAndMake <span style="color: #007800;">$APC_SOURCE_DIR</span> <span style="color: #007800;">$PHP_BASE_DIR</span> <span style="color: #ff0000;">&quot;--enable-apc --enable-apc-mmap<span style="color: #000099; font-weight: bold;">\
</span> --with-php-config=<span style="color: #007800;">$PHP_BIN_DIR</span>/php-config&quot;</span> 
<span style="color: #c20cb9; font-weight: bold;">cp</span> modules<span style="color: #000000; font-weight: bold;">/</span>apc.so <span style="color: #007800;">$PHP_EXTENSIONS_DIR</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;extension=<span style="color: #007800;">$PHP_EXTENSIONS_DIR</span>/apc.so&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$PHP_CONFIG_DIR</span><span style="color: #000000; font-weight: bold;">/</span>apc.ini
<span style="color: #7a0874; font-weight: bold;">cd</span> -
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$ENABLEXDEBUG</span> = <span style="color: #ff0000;">&quot;y&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
  echoL2 <span style="color: #ff0000;">&quot;--&gt; Building <span style="color: #007800;">$XDEBUG</span>...&quot;</span>
  <span style="color: #007800;">XDEBUG_SOURCE_DIR</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$BUILD_DIR</span>/<span style="color: #007800;">$XDEBUG</span>&quot;</span>
  <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$XDEBUG_SOURCE_DIR</span>
  <span style="color: #007800;">$PHP_BIN_DIR</span><span style="color: #000000; font-weight: bold;">/</span>phpize
  configureAndMake <span style="color: #007800;">$XDEBUG_SOURCE_DIR</span> <span style="color: #007800;">$PHP_BASE_DIR</span> <span style="color: #ff0000;">&quot;--enable-xdebug<span style="color: #000099; font-weight: bold;">\
</span>   --with-php-config=<span style="color: #007800;">$PHP_BIN_DIR</span>/php-config&quot;</span> 
  <span style="color: #c20cb9; font-weight: bold;">cp</span> modules<span style="color: #000000; font-weight: bold;">/</span>xdebug.so <span style="color: #007800;">$PHP_EXTENSIONS_DIR</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;zend_extension=<span style="color: #007800;">$PHP_EXTENSIONS_DIR</span>/xdebug.so&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$PHP_CONFIG_DIR</span><span style="color: #000000; font-weight: bold;">/</span>xdebug.ini
  <span style="color: #7a0874; font-weight: bold;">cd</span> -
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #666666; font-style: italic;">#-------------------------------------------------------------------------------</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$HTACCESS</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #007800;">HTACCESS_NEW</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$HTACCESS</span>.old&quot;</span>
    <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #007800;">$HTACCESS</span> <span style="color: #007800;">$HTACCESS_NEW</span>
    echoWarning <span style="color: #ff0000;">&quot;--&gt; Copied <span style="color: #007800;">$HTACCESS</span> to <span style="color: #007800;">$HTACCESS_NEW</span>&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#The backslash prevents a newline being inserted at the start</span>
<span style="color: #007800;">HTACCESS_CONTENT</span>=<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\
</span>Options +ExecCGI
AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi
&nbsp;
#Deny access to the PHP CGI executable and config files
&lt;FilesMatch <span style="color: #000099; font-weight: bold;">\&quot;</span>^php5?\.(cgi|ini)$<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;
    Order Deny,Allow
    Deny from All
    Allow from env=REDIRECT_STATUS
&lt;/FilesMatch&gt;&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#Preserve newlines in the content by quoting the variable name</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;#######ADDED BY installPHP script&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$HTACCESS</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$HTACCESS_CONTENT</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$HTACCESS</span>
&nbsp;
echoL2 <span style="color: #ff0000;">&quot;--&gt; Created <span style="color: #007800;">$PHP_INI</span>&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> <span style="color: #007800;">$BUILD_DIR</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Delete the downloads directory? (y/n): &quot;</span>
<span style="color: #c20cb9; font-weight: bold;">read</span> DELETE_DOWNLOADS_DIR
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$DELETE_DOWNLOADS_DIR</span> = <span style="color: #ff0000;">&quot;y&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> <span style="color: #007800;">$DOWNLOADS_DIR</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
echoL1 <span style="color: #ff0000;">&quot;DONE&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bernawebdesign.ch/byteblog/2010/02/17/custom-php-5-3-1-with-apc-and-xdebug-on-dreamhost-shared-hosting/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>migrating wordpress from gengo to wpml</title>
		<link>http://www.bernawebdesign.ch/byteblog/2009/08/15/migrating-wordpress-from-gengo-to-wpml/</link>
		<comments>http://www.bernawebdesign.ch/byteblog/2009/08/15/migrating-wordpress-from-gengo-to-wpml/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 13:13:59 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[web 2.0]]></category>
		<category><![CDATA[gengo]]></category>
		<category><![CDATA[multilingual blogging]]></category>
		<category><![CDATA[wpml]]></category>

		<guid isPermaLink="false">http://www.bernawebdesign.ch/byteblog/?p=94</guid>
		<description><![CDATA[A client of mine used to have a multilingual blog using the Gengo plugin, which I consider by now unfortunatly dead. Fortunately, the guys at http://www.wpml.org did a great job creating a new plugin that works like a charm. I did the migration from one to the other and I had no troubles (beside figuring [...]]]></description>
			<content:encoded><![CDATA[<p>A client of mine used to have a multilingual blog using the Gengo plugin, which I consider by now unfortunatly dead. Fortunately, the guys at http://www.wpml.org did a great job creating a new plugin that works like a charm.<span id="more-94"></span></p>
<p>I did the migration from one to the other and I had no troubles (beside figuring out how to map gengo&#8217;s model to wpml). Further down  are two SQL statements to check and update the posts language in wpml.</p>
<p>IMPORTANT: first disable gengo, then install wpml, then choose the default language and create the languages you had in geng. All your post will now be in the default language. you can check this with this SQL statement (for example using phpMyAdmin)</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> post<span style="color: #66cc66;">.</span><span style="color: #ff0000;">`ID`</span><span style="color: #66cc66;">,</span> post<span style="color: #66cc66;">.</span><span style="color: #ff0000;">`post_title`</span><span style="color: #66cc66;">,</span> wpml<span style="color: #66cc66;">.</span><span style="color: #ff0000;">`language_code`</span> <span style="color: #993333; font-weight: bold;">AS</span> wpml_language<span style="color: #66cc66;">,</span> gengoLang<span style="color: #66cc66;">.</span><span style="color: #ff0000;">`code`</span> <span style="color: #993333; font-weight: bold;">AS</span> gengo_language
<span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #ff0000;">`wp_posts`</span> post
<span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">JOIN</span> <span style="color: #ff0000;">`wp_icl_translations`</span> wpml <span style="color: #993333; font-weight: bold;">ON</span> wpml<span style="color: #66cc66;">.</span><span style="color: #ff0000;">`element_id`</span> <span style="color: #66cc66;">=</span> post<span style="color: #66cc66;">.</span><span style="color: #ff0000;">`ID`</span>
<span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">JOIN</span> <span style="color: #ff0000;">`wp_post2lang`</span> gengo <span style="color: #993333; font-weight: bold;">ON</span> gengo<span style="color: #66cc66;">.</span><span style="color: #ff0000;">`post_id`</span> <span style="color: #66cc66;">=</span> post<span style="color: #66cc66;">.</span>ID
<span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">JOIN</span> <span style="color: #ff0000;">`wp_languages`</span> gengoLang <span style="color: #993333; font-weight: bold;">ON</span> gengoLang<span style="color: #66cc66;">.</span><span style="color: #ff0000;">`language_id`</span> <span style="color: #66cc66;">=</span> gengo<span style="color: #66cc66;">.</span><span style="color: #ff0000;">`language_id`</span>
<span style="color: #993333; font-weight: bold;">WHERE</span> wpml<span style="color: #66cc66;">.</span><span style="color: #ff0000;">`element_type`</span> <span style="color: #66cc66;">=</span><span style="color: #ff0000;">'post'</span>
<span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> post<span style="color: #66cc66;">.</span><span style="color: #ff0000;">`ID`</span>  <span style="color: #993333; font-weight: bold;">DESC</span>;</pre></div></div>

<p>Then you can update the post language with the following statement:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">UPDATE</span> <span style="color: #ff0000;">`wp_icl_translations`</span> wpml
<span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">JOIN</span> <span style="color: #ff0000;">`wp_posts`</span> post <span style="color: #993333; font-weight: bold;">ON</span> wpml<span style="color: #66cc66;">.</span><span style="color: #ff0000;">`element_id`</span> <span style="color: #66cc66;">=</span> post<span style="color: #66cc66;">.</span><span style="color: #ff0000;">`ID`</span>
<span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">JOIN</span> <span style="color: #ff0000;">`wp_post2lang`</span> gengo <span style="color: #993333; font-weight: bold;">ON</span> gengo<span style="color: #66cc66;">.</span><span style="color: #ff0000;">`post_id`</span> <span style="color: #66cc66;">=</span> post<span style="color: #66cc66;">.</span>ID
<span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">JOIN</span> <span style="color: #ff0000;">`wp_languages`</span> gengoLang <span style="color: #993333; font-weight: bold;">ON</span> gengoLang<span style="color: #66cc66;">.</span><span style="color: #ff0000;">`language_id`</span> <span style="color: #66cc66;">=</span> gengo<span style="color: #66cc66;">.</span><span style="color: #ff0000;">`language_id`</span>
<span style="color: #993333; font-weight: bold;">SET</span> wpml<span style="color: #66cc66;">.</span><span style="color: #ff0000;">`language_code`</span> <span style="color: #66cc66;">=</span> gengoLang<span style="color: #66cc66;">.</span><span style="color: #ff0000;">`code`</span>
<span style="color: #993333; font-weight: bold;">WHERE</span> wpml<span style="color: #66cc66;">.</span><span style="color: #ff0000;">`element_type`</span> <span style="color: #66cc66;">=</span><span style="color: #ff0000;">'post'</span></pre></div></div>

<p>This will update your POSTS only, no category or tags yet. I might look at those as well and I&#8217;ll get in touch with wpml to see if they can use my snippets to get out a sort of import tool.</p>
<p>cheers Marco</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bernawebdesign.ch/byteblog/2009/08/15/migrating-wordpress-from-gengo-to-wpml/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>wordpress iphone app with wpml</title>
		<link>http://www.bernawebdesign.ch/byteblog/2009/08/07/wordpress-wpml-iphone-app/</link>
		<comments>http://www.bernawebdesign.ch/byteblog/2009/08/07/wordpress-wpml-iphone-app/#comments</comments>
		<pubDate>Fri, 07 Aug 2009 20:30:34 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[web 2.0]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wpml]]></category>

		<guid isPermaLink="false">http://www.bernawebdesign.ch/byteblog/?p=68</guid>
		<description><![CDATA[Solution to use the iphone application for multilingual blogging with wpml]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve a client using a wordpress multilingual blog with the wpml plugin (<a href="http://wpml.org/">wpml.org/</a>) and that wants to use the wordpress iphone app (<a href="http://iphone.wordpress.org/">iphone.wordpress.org</a>). The app and the plugin work like a charm. the only problem is that in the app you can&#8217;t set the post language, hence you are (well by now were <img src='http://www.bernawebdesign.ch/byteblog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ) able to post only using the default language.<br />
I wrote a small PHP script<span id="more-68"></span> to put in the root dir of your blog that updates the default language of the blog when called. so basically before using the iphone app you call the script using safari (http://domain.tdl/blog/set_post_lang.php?to=de) and then use the iphone application to post to your blog.<br />
The script requires minimal configuration, you have to set the blog_id (if you have a single install, 0 should be ok, but you can find this by looking at the wp_options table in the DB) and an array of valid languages. Please note that the script uses no authentication methods, up to you to decide if you want to implement it (very easy actually for example with http_auth or with a key). I didn&#8217;t because the script does something very small and irrelevant from the security point of view.<br />
And  here the code, enjoy.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009933; font-style: italic;">/**
 * script to change the default language of a wpml installation
 * so that a new post written from fot example the iphone app is set to the right language
 * 
 * @use call it like this: www.domain.tld/set_post_lang.php?to=it
 * @author Marco Bernasocchi   marco@bernawebdesign.ch
 * @copyright LGPLv3
 */</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//___________________SETTINGS________________</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;BLOG_ID&quot;</span><span style="color: #339933;">,</span>  <span style="color: #0000ff;">&quot;0&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//id of the blog</span>
<span style="color: #000088;">$active_languages</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;it&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;de&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//use lowercase codes of the languages active in your blog</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//___________________SCRIPT__________________</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp-config.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//used to get hostname, DB, USER &amp; PASSW</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*check if the passed language is a valid one*/</span>
<span style="color: #000088;">$set_to</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;to&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$set_to</span><span style="color: #339933;">,</span> <span style="color: #000088;">$active_languages</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'invalid language'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*open DB connection */</span>
<span style="color: #000088;">$mysqli</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> mysqli<span style="color: #009900;">&#40;</span>DB_HOST<span style="color: #339933;">,</span> DB_USER<span style="color: #339933;">,</span> DB_PASSWORD<span style="color: #339933;">,</span> DB_NAME<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">/* check connection */</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">mysqli_connect_errno</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB Connect failed'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* get the actual settings of the wpml plugin */</span>
<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT option_value from `'</span><span style="color: #339933;">.</span>DB_NAME<span style="color: #339933;">.</span><span style="color: #0000ff;">'`.`wp_options`
          WHERE CONVERT(`wp_options`.`option_name` USING utf8) = &quot;icl_sitepress_settings&quot;
          AND `wp_options`.`blog_id` = '</span><span style="color: #339933;">.</span>BLOG_ID<span style="color: #339933;">.</span><span style="color: #0000ff;">' 
          LIMIT 1;'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$mysqli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">num_rows</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$value</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;option_value&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>  
  <span style="color: #666666; font-style: italic;">/* free result set */</span>
  <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Error getting the actual setting'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* check if update needed */</span>
<span style="color: #000088;">$new_pattern</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&quot;default_language&quot;;s:2:&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$set_to</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$replace</span> <span style="color: #339933;">=</span> <span style="color: #339933;">!</span><span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/<span style="color: #006699; font-weight: bold;">$new_pattern</span>/&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* change the language then update the DB */</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$replace</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$pattern</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/&quot;default_language&quot;;s:2:&quot;[a-z]{2}&quot;/'</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$value</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pattern</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$new_pattern</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'UPDATE `'</span><span style="color: #339933;">.</span>DB_NAME<span style="color: #339933;">.</span><span style="color: #0000ff;">'`.`wp_options` 
            SET `option_value` = \''</span><span style="color: #339933;">.</span><span style="color: #000088;">$value</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'\'
            WHERE CONVERT(`wp_options`.`option_name` USING utf8) = &quot;icl_sitepress_settings&quot;
            AND `wp_options`.`blog_id` = '</span><span style="color: #339933;">.</span>BLOG_ID<span style="color: #339933;">.</span><span style="color: #0000ff;">'
            LIMIT 1;'</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$mysqli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Default post language is now set to '</span><span style="color: #339933;">.</span><span style="color: #990000;">strtoupper</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$set_to</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Problem updating the language, please try again'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Default post language is already set to '</span><span style="color: #339933;">.</span><span style="color: #990000;">strtoupper</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$set_to</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//close DB connection</span>
<span style="color: #000088;">$mysqli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bernawebdesign.ch/byteblog/2009/08/07/wordpress-wpml-iphone-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

