lundi 11 août 2008

Que vérifier lors d'une installation d'une application php

Il y a plusieurs étapes obligatoires lors d'une installation d'une application php.

1) La première est la vérification du contexte serveur.Dans le cas d'une install xAMP, on vérifie :
- que le serveur possède les bons jeux de caractères (faites tout en utf-8),
- que le serveur possède les bonnes locales fr_FR (sert dans l'internationalisation de vos applis),
- que les extensions serveurs sont bien activés (je pense notamment au mod_rewrite sur apache),
- que les bonnes extensions php sont chargées.
Si ces tests échouent, l'installation peut passer en mode dégradé ou carrément échouer.

2) Dans un deuxième temps, l'utilisateur va définir les variables d'installation :- les chemins d'accès pour les fichiers à uploader, la configuration,- les paramètres de connexion à la base de données,
- les paramètres de connexion aux services tiers à utiliser (ldap etc),
- la time zone, les packages de langue à déployer,
- les paramètres de compte administrateur.


3) Finalement, on va vérifier plusieurs droits d'accès qui dépendent de la configuration précitée :
- les droits d'accès écritures/lectures sur des dossiers,
- les privileges sur la base de données si besoin est,
- les ports ouverts en cas d'une application utilisant des sockets et des fopen.
Si ces derniers tests échouent, il faut revenir à l'étape 2).

On arrive ensuite à un joli écran : install success.
Il n'y a pas à ma connaissance de joli programme pour packager et installer des applications PHP et chaque application code à nouveau son installer maison.
A bon entendeur...

Blogged with the Flock Browser

vendredi 8 août 2008

vendredi 21 mars 2008

Myth buster : Smarty sucks (part 2).

One can find some interesting discussions about Smarty and template engines [here].
New myth to bust :
  • With Smarty, we create too many templates, and the site becomes impossible to maintain.
I directly refer to this article. I hope the writer had honestly managed a large project with his method. Using OOP to output html is ineffective and inefficient. The success of PHP is a good example of what I'm talking about.

I would say that the maintainability of one site 's design essentially depends of the skills of the CSS engineer/dev rather than the number of templates.

  • Smarty is slow to process
Untrue. Show me your benchmark. For oolime projects, we benchmarked every single technology we are using, and I can tell you that the overload of Smarty is not critical. Moreover, the cache mechanism helps to speed up your website. With Smarty, we can put in cache chunks of HTML and assemble them when necessary. In some words, Smarty can cache the compiled template AND the output of any template.

I saw one "ignorant guy" (sorry for the adjective, but I couldn't find better :-) telling around the place that caching mechanism were useless if a website was fast enough...

  • We can do everything in PHP, so why using Smarty ?
Smarty is written in PHP so of course you can do everything that Smarty does in PHP. That's really a non valid argument. But beware of not reinventing the wheel for nothing...

About XSL
And when someone talks with me about xsl for HTML templating, I'm crying out loud. I've been developing templates and views in XSLT for three years before discovering how stupid XSLT is for this kind of tasks.

I needed to use DOM objects instead of PHP objects (and all the troubles of memory space & exec speed that it implies) the errors in the templates syntax were not explicit (blank html page syndrom), XSLT needs a long term investment for non interesting features for HTML (need to learn xpath, xslt, advanced xml)...

XSL is good to adapt XML data in a certain format (specified by a DTD or not) into another format.

mercredi 19 mars 2008

Myth buster : Smarty sucks (part 1).

On the one hand, MVC is one of the major design pattern in PHP world [wikipedia]. It provides a nice way to structure some programs.
On the other hand, Smarty is a templating engine for PHP. It is widely used and I recommend you to spend a couple of hours on it if you don't know it [smarty].
A little message from Planque on his blog criticizes the usage of Smarty to perform this famous MVC design pattern. We can see another here and there. The critics are quite different but all forget the same details about what is a good template engine. Let's try to make a synthesis of the complaints.
  • Smarty is more complicated than plain, old php with html.
Partly true. But being "complicated" is a big word here. Ten minutes and anyone who knows PHP does what he wants with Smarty. That's not like requiring a week of education and seminars...Anyhow sometimes being a bit more complicated provides nicies on the other side.

  • Smarty doesn't separate logic/business from view.
This point is the responsability of the developer. In SMarty, a dev can use the {php} tag to put any kind of php treatment in his template. These kind of operations does introduce logic in the template and therefore must be avoided But who can criticize Smarty on this point ? It was a choice between flexibility and structure. I would argue that any system must flexible in some way (and I know what I'm saying, I've been struggling with .NET platform for 7 months...). Or avoiding a trouble/bug/misconception can become a peplum.



Most part of the argument against smarty forgets one important part of a template system's job : caching mechanism. It is as simple as that.
Ans Smarty may do it quite well, although I didn't expertise this point.

So I wait for someone making a comparison of the different template engine, in term of efficiency, functionality.

mardi 26 février 2008

First post ever

Hi there !

I'm not a major blogger but I've been struggling with some technical details these last few months and I wanted to share my work with others. Some other dudes from my company (Inovia) also wanted to be a part of the adventures so they will write from time to time articles.


Here we will talk about PHP, Mysql, Flash, Flex, and other technologies in the web constellation.