Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Installation and Testing
Open Source Server Side Scripting 2 ECA 236 PHP / MySQL / Server Local Browser Remote Server PHP engine.php Request Response MySQL DB.html SQL results
Open Source Server Side Scripting 3 ECA 236 MySQL database of choice for majority of PHP users efficiency and ease of use free runs on multiple platforms documentation software consists of 3 pieces MySQL server MySQL monitor numerous utilities
Open Source Server Side Scripting 4 ECA 236 Installing MySQL MySQL version 5.0, distributed by MySQL AB dev.mysql.com/downloads Current Release Windows Downloads Windows Essentials: contains essential elements to run MySQL on Windows Extract files, double click setup.exe Install MySQL, noting any relevant information To start MySQL navigate to C:\mysqlbin or C:\Program Files\MYSQL\ Double click WinMySQLadmin to start MySQL server with GUI interface
Open Source Server Side Scripting 5 ECA 236 PATH Start R click My Computer L click Properties Advanced Environment Variables Path Edit Add C:\mysql\bin or proper path
Open Source Server Side Scripting 6 ECA 236 Testing MySQL Using the command line Open Command Prompt Change Directory to c:\mysql\bin unless PATH has been changed if mysql was installed as a service, it is already running in the background otherwise, type mysqld to start the server Create a test Database mysql monitor: type mysql at this point, all commands must end with a ;
Open Source Server Side Scripting 7 ECA 236 Testing MySQL cont … testDB test_table test_idtest_note 1This is note 1 99And another note 13And yet another
Open Source Server Side Scripting 8 ECA 236 Testing MySQL cont … Type use testDB; Create a test table: CREATE table test_table (test_id INT, test_note TEXT); Verify creation of table: SHOW tables; Verify field names and types: EXPLAIN test_table;
Open Source Server Side Scripting 9 ECA 236 Testing MySQL cont … Insert a row: INSERT INTO test_table VALUES (‘1’, ‘This is note 1’); Insert another row: INSERT INTO test_table VALUES (‘99’, ‘And another note’); Insert one more row: INSERT INTO test_table VALUES (‘13’, ‘And yet another’); Select data from test_table: SELECT * FROM test_table; Order by ID: SELECT * FROM test_table ORDER BY test_id DESC;
Open Source Server Side Scripting 10 ECA 236 Installing Xitami download and install Xitami from my web site if another web server (such as IIS) is already running, we must change the port from the default of 80 to 88 open xitami.cfg in the C:\Xitami directory open defaults.cfg add the following lines to default.cfg: [Server] portbase=8
Open Source Server Side Scripting 11 ECA 236 Installing Xitami cont … Start Xitami (green icon in taskbar) Point your browser to Bookmark this page in Favorites Links All web pages must be stored in the webpages folder of Xitami, or its subfolders
Open Source Server Side Scripting 12 ECA 236 Installing PHP 5. x. x Current version is PHP version 5.x.x Download Windows Binaries PHP 5.x.x zip package Create a directory named C:\php Extract files to this directory resave a copy of php.ini-recommended to php.ini open php.ini uncomment extension=php_mysql.dll (app. line 657) Set PATH C:\php\bin C:\php\ext Restart computer
Open Source Server Side Scripting 13 ECA 236 Installing PHP If you want to install an earlier version of PHP Download Windows Binaries PHP installer Extract files follow directions set PATH
Open Source Server Side Scripting 14 ECA 236 Testing PHP Xitami make config changes to defaults.cfg or defaults.aut if necessary In defaults.cfg add: [Filter].php=c:\php\ php.exe All php files must be run from C:\Xitami\webpages directory Access server through localhost:88 or :88 When typing in URL, do not add “webpages” to URL
Open Source Server Side Scripting 15 ECA 236 Testing PHP cont … In php.ini, set cgi.force_redirect to 0 make sure it is not commented out with a semicolon In a text editor create an HTML document with the following code in the Name it phpinfo.php, save in C:\Xitami\webpages Run it: