Get your PHP on the right Trax

Framework flattery

Security and trust: The backbone of doing business over the internet

A database.ini database configuration file gets created in the config directory. Modify the database.ini file for the MySQL database. We shall be using the development mode as follows:

    phptype = mysql
    database = test
    hostspec = localhost
    username = root
    password = 
  persistent = true

Modify the config/environment.php directory to set the PHP directory, the trax root directory, and the trax environment mode. Define variables PHP_LIB_ROOT, TRAX_ROOT, and TRAX_ENV.

define("PHP_LIB_ROOT",    "C:/PHP/PEAR");
define("TRAX_ROOT",       "C:/Apache/htdocs/catalog");
define("TRAX_ENV",    "development");

The public/.htaccess file specifies configuration directives for the Apache HTTP server. The configuration directives in the .htaccess file apply to the directory in which the .htaccess file is placed and the sub-directories of the directory. Modify the public/.htaccess file. Replace the following line with the subsequent line:

php_value include_path .:C:\Apache\htdocs\catalog/config
php_value include_path .;C:\Apache\htdocs\catalog/config

The include_path directive specifies a list of directories and is used to locate files. Access the Trax application console with the URL http://localhost/catalog/public.

Modify the C:\Apache\conf\httpd.conf file so the directives in the .htaccess file may override earlier access information. Activate the mod_rewrite module by removing the '#' before the following line:

LoadModule rewrite_module modules/mod_rewrite.so

The mod_rewrite module provides a rules-based rewriting engine to rewrite requested URLs. Also set all the AllowOverride directives to All.

AllowOverride All

The AllowOverride directive specifies which directives in the .htaccess may override earlier access information. Modify the DocumentRoot directive and <Directory> setting in httpd.conf to the following:

DocumentRoot "C:/Apache/htdocs/catalog/public"
<Directory "C:/Apache/htdocs/catalog/public">

Reboot time

Restart the Apache server. We shall generate a model class and the scaffolding for the model class, which models a database table, with the scaffold generator. Create a scaffold.bat file in the C:\Apache\htdocs\catalog directory. Copy the following code to the scaffold.bat file:

php ./script/generate.php scaffold  %1 %2

Before creating the scaffolding, build a database table catalogs in the MySQL database with the SQL script catalog.sql. The primary key field should be "id" and of type INT. Create a scaffolding for the "catalogs" table with the following command:

C:\Apache\htdocs\catalog>scaffold catalog catalog

A model class catalog.php gets generated in the models directory.

class Catalog extends ActiveRecord {      

Security and trust: The backbone of doing business over the internet

More from The Register

next story
New 'Cosmos' browser surfs the net by TXT alone
No data plan? No WiFi? No worries ... except sluggish download speed
'Windows 9' LEAK: Microsoft's playing catchup with Linux
Multiple desktops and live tiles in restored Start button star in new vids
iOS 8 release: WebGL now runs everywhere. Hurrah for 3D graphics!
HTML 5's pretty neat ... when your browser supports it
Mathematica hits the Web
Wolfram embraces the cloud, promies private cloud cut of its number-cruncher
Google extends app refund window to two hours
You now have 120 minutes to finish that game instead of 15
Intel: Hey, enterprises, drop everything and DO HADOOP
Big Data analytics projected to run on more servers than any other app
Mozilla shutters Labs, tells nobody it's been dead for five months
Staffer's blog reveals all as projects languish on GitHub
SUSE Linux owner Attachmate gobbled by Micro Focus for $2.3bn
Merger will lead to mainframe and COBOL powerhouse
iOS 8 Healthkit gets a bug SO Apple KILLS it. That's real healthcare!
Not fit for purpose on day of launch, says Cupertino
prev story


Providing a secure and efficient Helpdesk
A single remote control platform for user support is be key to providing an efficient helpdesk. Retain full control over the way in which screen and keystroke data is transmitted.
WIN a very cool portable ZX Spectrum
Win a one-off portable Spectrum built by legendary hardware hacker Ben Heck
Saudi Petroleum chooses Tegile storage solution
A storage solution that addresses company growth and performance for business-critical applications of caseware archive and search along with other key operational systems.
Protecting users from Firesheep and other Sidejacking attacks with SSL
Discussing the vulnerabilities inherent in Wi-Fi networks, and how using TLS/SSL for your entire site will assure security.
Security for virtualized datacentres
Legacy security solutions are inefficient due to the architectural differences between physical and virtual environments.