Wednesday, July 6, 2011

15 steps for running PHP 5.3 and PHP 5.2 on the same Apache server

Recently i faced with a case when i need to run an old website which requires PHP 5.2 when my main version on the test server is 5.3.5

System configuration:
Debian Squeeze 6.0
Apache 2.2
MySQL 5.1

Here i place a very short step by step instruction for how to do so.

1. Go to http://us3.php.net/downloads.php and download needed php version.

2. Extract just downloaded file: shell> tar xzvf php-5.2.17.tar.gz

3. Install PHP development libraries:
as root:
shell> apt-get update
shell> apt-get install libxml2-dev libmysqlclient-dev libcurl4-gnutls-dev libcurl4-openssl-dev libpng12-dev libjpeg62-dev

4. go to the folder where you extracted PHP archive

5. configure and make it:
shell> ./configure --prefix=/opt/php5.2 \
--with-config-file-path=/opt/php5.2 \
--with-mysqli \
--with-pdo-mysql \
--with-mysql \
--with-curl \
--with-gd \
--with-jpeg \
--with-jpeg-dir \
--with-xsl \
--with-zlib \
--enable-cli \
--enable-fastcgi \
--enable-discard-path \
--enable-force-cgi-redirect
shell> make
shell> make install

6. Install and set up fastcgi support for PHP:
shell> apt-get install libapache2-mod-fastcgi

7. Enable fastcgi:
shell> a2enmod fastcgi

8. Enable mod_actions:
shell> a2enmod actions

9. Set up PHP cgi wrapper. Create file '/usr/lib/cgi-bin/php52-cgi' with the following content:
#!/bin/sh
PHPRC="/opt/php5.2/"
export PHPRC
PHP_FCGI_CHILDREN=4
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_MAX_REQUESTS
exec /opt/php5.2/bin/php-cgi
10. Make this file executable:
shell> chmod +x /usr/lib/cgi-bin/php5-cgi

11. Create include file for Virtual Hosts: '/etc/apache2/php52.conf'

12. Fill it in with the following content:
#include for virtual hosts that need to run php-5.2
<FilesMatch "\.php">
   SetHandler application/x-httpd-php5
</FilesMatch>
ScriptAlias /php52-cgi /usr/lib/cgi-bin/php52-cgi
Action application/x-httpd-php5 /php52-cgi
AddHandler application/x-httpd-php5 .php
13. copy php.ini-recommended file to /opt/php5.2/ and rename it to php.ini

14. Include this file in to Virtual Hosts, where PHP2 is needed.
Example:
<VirtualHost *.80>

# ...

#needs to run version 5.2.x of PHP
Include php52.conf

</VirtualHost>

15. Restart Apache: /etc/init.d/apache2 restart

That is it.

Thanks to Brett's blog!

Also I invite you to visit us at www.mbi-solutions.net

Tuesday, July 5, 2011

MBI Solutions website is now multilingual!


Hi, today we added an English version to our website http://www.mbi-solutions.net

For this we split the content in to 2 folders: "nl" - for Dutch one and "en" for English.

The only page - index.html remains in the root folder.
To all the pages we added language switcher which cross references corresponding pages.

From the SEO point of view what has been done:
  1. Language tags (see previous post) have been changed to reflect thee new language.
  2. Titles, keywords, descriptions and pages content have been translated
  3. Sitemap file which is used by search engines has been also updated to reflect the changes.
After we uploaded the new website structure we also left there old pages. That is for a while until search engines index the new wesbsite structure. It will be deleted in coming days.

Friday, July 1, 2011

SEO optimization for MBI-Solutions.net

Here i'm going to put SEO optimization tips used while optimizing www.mbi-solutions.net.


Generally that's for myself for not to forget it.

1. Don't forget doctype:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

2. <html> tag should look like this:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="nl" lang="nl">
(MBI Solutions is Belgium website that's why i used "nl" to show that the language of website is Dutch)
Also i added these tags (some manuals recommended to do so):
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="content-language" content="nl" />
<meta http-equiv="language" content="NL" />
<meta name="language" content="nederland" />

3. All pages must contain title, keywords and description meta tags. They should look like this:
<title>MBI Solutions</title>
<meta name="keywords" content="MBI Solutions, software, web-site, internet, Belgium, software ontwikkeling" />
<meta name="description" content="MBI Solutions. Vaste Project prijzen. Professioneel en flexibel. Bespaar tot 50%. Social media. Verhogen klantwaarde. Klantgericht." />
Title will be shown in the browser's headr
Keywords should contain key words describing this page (not whole website!)
Description should contain a short explanations, examples of what this page is about.
!!The most important!!: words which you put in to title, keywords and description must appear in the page content. Better if they appear there not once.

4. All images on pages must have ALT tag filled in. you should put there short description of what is shown on the image. Also the names of images should also men something. For example:
<img src="img/office.jpg" width="296" height="182" alt="MBI Solutions office foto" />
Here the name of the immage says that it's an office photo and the same is mentioned in the image alt tag.