venerdì 5 settembre 2008

ISPCONFIG SUPHP and OPEN_BASEDIR

I'm a system administrator of a linux hosting server (ubuntu 8.0.4).
I chose to adopt ispconfig together with suphp.
I had PEAR not working, and in phpinfo() the variable open_basedir pointed only to the root of the hosting space (something like /var/www/web7).
I needed to add /tmp and /usr/share/php to each open_basedir vhost, but with suphp you use php CGI, so you can't use php_admin_value.
I was going crazy too to find out where open_basedir was set: not in Vhosts_ispconfig.conf, not in php.ini ....
I found the way out looking at /etc/suphp.conf at the line:

x-httpd-php=php:/home/admispconfig/ispconfig/tools/suphp/usr/bin/php-wrapper

So I took a look at php-wrapper, and there it was:

exec php-cgi -d open_basedir=${BASEDIR} -d upload_tmp_dir=${TMPDIR} -d session.save_path=${SESSDIR} -d safe_mode=${SAFE_MODE}

where BASEDIR=`dirname ${DOCUMENT_ROOT}`
So, if you have the same problem as I, define a new variable:

OPEN_BASEDIR="/tmp:/usr/share/php:"${BASEDIR}

and put it in the above line as follows:

exec php-cgi -d open_basedir=${OPEN_BASEDIR} -d upload_tmp_dir=${TMPDIR} -d session.save_path=${SESSDIR} -d safe_mode=${SAFE_MODE}

NOTE: if you successively upgrade ispconfig package, remember to re-apply the above patch.

domenica 27 luglio 2008

Web character encoding: many places to config it right

I start this entry only with few out-of-order notes: I'll put more info when I have more time.
To avoid surprises, choose UTF-8 and don't leave defaults: configure all the pieces you use.
For me, they are:
- tomcat 5.5: in server.xml, for all your connectors, set:
connectionTimeout="20000"
redirectPort="8443"

URIEncoding="UTF-8"
useBodyEncodingForURI="true"

/>
(see: http://tomcat.apache.org/tomcat-5.5-doc/config/http.html)
(see for SEAM: https://cloud.prod.atl2.jboss.com/jira/browse/JBSEAM-3148?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel)

- in JSF+facelets: (encoding of xml files + view + meta)
- to check, in browser you have to see meta and http header (mind double headers-> correct IIS or APACHE)
- html form: add accept-encoding

A must read: http://www.javaworld.com/javaworld/jw-04-2004/jw-0419-multibytes.html?page=7