How to test the guestbook in "local" (on your PC) ?

Frequently Asked Questions

Modérateurs : boulmontjj, Pierre G., Malabar

Règles du forum
Would you have questions, misunderstandings or suggestions about this FAQ, please post in the Installation et utilisation or Personnalisation forums.
This FAQ forum is in read-only mode.
boulmontjj
Modérateur
Modérateur
Messages : 1360
Inscription : Mer 30 Août 2006, 13:41
Localisation : Marchiennes
Contact :

How to test the guestbook in "local" (on your PC) ?

Messagepar boulmontjj » Lun 14 Avr 2008, 10:31

Many users of the guestbook wish to test its functioning in local (that is, install on his own computer).

Web server software
First of all, you need to install a web server software.
Software solutions exist which integrate a Web server + a data base server.
Two of these are EasyPhp and Wamp Server.
Attention, often these software packages are configured so that the guestbook will not work because some essential functions are deactivated (for safety reasons or to ease the use of the server). Not easy to test the guestbook in such conditions.
It can occur that the guestbook displays correctly but either the access to the administration part is impossible (bothering enough) or the security code does not display (not really nice for those who exactly want to test this very practical feature to limit the spam).

Our choice is XAMPP, an all-in-one server (Apache, mysql, php) that works as well under Windows, MAC OS and Linux.
AlexGuestbook script installs and works well with this suite.
The configuration by default allows the functioning of all the options of AlexGuestbook (usefull because beginners will not have to try to configure the server).

AlexgGuestbook works also perfectly with Wampserver 2.0 under Windows XP SP2.

Web server parameter, installation and startup of AlexGuestbook
The only manipulation to perform is the creation of a database on the server by using phpmyadmin (THE data base administrator software !!) : access by typing the address 127.0.0.1/phpmyadmin in your browser. Then fill in the field "Create a data base" with the name of the base that you wish to create (agb for example) and click "create".

Then you'll just copy the guestbook folder in the "C:\Program Files\xampp\htdocs" directory. Access the guestbook by the address 127.0.0.1/agb (if you did not change the name of the folder for the book).

Installation parameters :
Server adress : 127.0.0.1
login : root
Password : (none by default)
Database name : the same you gave during creation (agb to continue with our example)

With these informations, you should be able to test the AlexGuestbook script and all its hidden recesses !!
The only function which does not work is the sending of a "thank-you" e-mail for every posted message (it is necessary to install a SMTP server, supplied with XAMPP but not activated by default).


Astuce d'Otomatic

Otomatic a écrit :To be able to advance quietly, I modify and try the PHP scripts and the style sheets ( CSS) in premises, under WampServer on my PC and, when everything seems to be ok, I transfer files on one or several real servers by FTP.

But it raises the problem of names:
- Data base server ( host )
- Bases themselves
- User names to use (user)
- Passwords ( password )
which are different.

We are thus obliged, before making transfers, to modify the configuration files of access to data bases.

To avoid, one time for all, having to modify files in every transfer, it is enough to make a permanent modification which will change automatically the configuration of access data bases according to the used server.

The system variable which gives the serve name is :

Code : Tout sélectionner

$_SERVER['SERVER_NAME']


Thus, for the guestbook, it is necessary to modify the config file / config_base.php as follows.
( To adapt according to your own sites). Use of if and elseif but we could use switch and case

Code : Tout sélectionner

<?php
$database_type = "MySQL";

$location=$_SERVER['SERVER_NAME'];

// For a site hosted at Free
if ($location=="aviatechno.free.fr") {
 $f_mysql_host = "sql.free.fr";    //Serveur MySql
 $f_mysql_user = "aviatechno";     //Nom utilisateur
 $f_mysql_pass = "mon_pass_free";  //Password
 $f_mysql_base = "ma_base_free";   //Nom de la base
}
// Wampserver local hosted
elseif ($location=="aviatechno") {
 $f_mysql_host = "localhost";
 $f_mysql_user = "root";
 $f_mysql_pass = "mon_pass_local";
 $f_mysql_base = "ma_base_locale";
}
// Microweb host - Site on CD-ROM or Clé USB
elseif ($location=="microweb") {
 $f_mysql_host = "localhost";
 $f_mysql_user = "root";
 $f_mysql_pass = "mon_pass_microweb";
 $f_mysql_base = "ma_base_microweb";
}
// 1and1 hosted
elseif ($location=="aviatechno.info") {
 $f_mysql_host = "db780.1and1.fr";
 $f_mysql_user = "dbo199078218";
 $f_mysql_pass = "mon_pass_1and1";
 $f_mysql_base = "ma_base_1and1";
}
$name_table['alex_livre_txt_lang'] = "alex_livre_txt_lang";
$name_table['alex_livre_sessions'] = "alex_livre_sessions";
$name_table['alex_livre_users'] = "alex_livre_users";
$name_table['alex_livre_messages'] = "alex_livre_messages";
$name_table['alex_livre_censure'] = "alex_livre_censure";
$name_table['alex_livre_ban'] = "alex_livre_ban";
$name_table['alex_livre_smileys'] = "alex_livre_smileys";
$name_table['alex_img_verif_add'] = "alex_livre_img_verif_add";
$name_table['alex_livre_config'] = "alex_livre_config";
?>


To simplify itself the life, it is necessary to be very lazy. ;-)

Dominique.

Thanks to Dominique

Revenir vers « English »

Qui est en ligne ?

Utilisateurs parcourant ce forum : Aucun utilisateur inscrit et 2 invités