How To Distribute A PHP And MySQL Web Site

Download and install DWebPro and then download and install one of our preconfigured PHP packages.

If you will use MySQL 4.1 (or above), you should use PHP 5.0 (or above). If you need to use PHP 4.4 and MySQL 4.1 (or above) you have to add the following string to the CustomParams field in the MySQL section:

--old-passwords

We recommend you to install PHP as ISAPI as it is a faster and more efficient interface than CGI, especially when PHP is executed on CD/DVD. Once you have installed PHP you can change its settings by editing the php.ini file in the deploy folder.

Download and install one of our preconfigured MySQL packages.

Download and install our preconfigured phpMyAdmin V.2.6.1 package.

Place your Web application files in the C:\DWebPro\deploy\www folder.

Start DWebPro (it should bring you to the phpMyAdmin section).

Create a MySQL database you will use for your Web site.

Import the dump of your MySQL database. This procedure can be done using any other MySQL client (for example, MySQL CC, DBTools, mysql.exe). When you connect to MySQL you MUST provide the correct port on which MySQL is listening . As default behavior, DWebPro starts any socket server on the first empty port. You can get the correct MySQL port using the following PHP code:

<?php
print(dwebpro_getvar("DWEBPRO_MYSQL_PORT"));
?>

Open your Web scripts and edit the MySQL connection settings to fit the following values:

<?php
$host = "127.0.0.1:" . dwebpro_getvar("DWEBPRO_MYSQL_PORT");
$database = "the database you have just created";
$username = "root";
$password = "";
?>

Burn the C:\DWebPro\deploy folder on a CD/DVD. You can place the contents of this folder in a subfolder of the CD/DVD, in this case you should put in the root folder both the autorun.inf and the autorun.exe files and edit the autorun.inf to point to the dwebpro.exe file in the subfolder. For instance, if you have placed the DWebPro files in the F:\website subfolder (where F: is the CD/DVD unit name), you have to edit the autorun.inf file as follows:

[autorun]
icon=website\dwebpro.exe
open=website\dwebpro.exe

If you want you can change the CD/DVD icon, change the icon setting in the autorun.inf file. The autorun.exe can be renamed into whatever you want (i.e., StartMe.exe). This program is provided to help the end user on starting DWebPro. It reads the autorun.inf directives and executes them, it is very useful when the end user has disabled the Windows autorun feature. Now you should be able to run you PHP/MySQL Web application with DWebPro. If you need to execute write operations on the MySQL database you have to configure DWebPro to copy the database files on the user file system. Read the MySQL section of the manual to understand the different ways this can be done. If in your configuration settings there are full paths like the following:

<?php
$root = "/urs/local/example.com/www/";
?>

You should rewrite them using a code like the following that will work correctly on any system:

<?php
$root = realpath(dirname(__FILE__) . "/../") . DIRECTORY_SEPARATOR;
?>

Here is a code excerpt that you should add to your web site config file to make PHP work correctly from CD/DVD:

<?php

/*
* This script contains some directives to make your PHP
* environment perfectly working on read only media like CD/DVD
*/

/* Session support */

ini_set('session.save_path', dwebpro_getvar('DWEBPRO_TEMP'));

/* MySQL support */

ini_set('mysql.default_port', dwebpro_getvar('DWEBPRO_MYSQL_PORT'));
ini_set('mysql.default_host', '127.0.0.1');
ini_set('mysql.default_user', 'root');
ini_set('mysql.default_password', '');

/* SMTP/Mail support */

ini_set('smtp_port', dwebpro_getvar('DWEBPRO_SMTPSERVER_PORT'));
ini_set('sendmail_from', 'support@dwebpro.com');

?>