150 likes | 291 Views
ECA 236. Open Source Server Side Scripting Installation and Testing. PHP / MySQL / Server. Response. .html. Local Browser. Remote Server. PHP engine. .php. SQL. results. Request. MySQL DB. MySQL. database of choice for majority of PHP users efficiency and ease of use free
E N D
ECA 236 Open Source Server Side Scripting Installation and Testing Open Source Server Side Scripting
PHP / MySQL / Server Response .html LocalBrowser RemoteServer PHPengine .php SQL results Request MySQLDB Open Source Server Side Scripting
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
Installing MySQL • MySQL version 5.0, distributed by MySQL AB • www.mysql.com • 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
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
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
Testing MySQL cont … Open Source Server Side Scripting
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
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
Installing Xitami • download and install Xitami from my web sitewww.justustwo.com/mbarath.htm • 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
Installing Xitami cont … • Start Xitami (green icon in taskbar) • Point your browser to http://localhost:88/ • 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
Installing PHP 5 . x . x • Current version is PHP version 5.x.x • www.php.net/downloads.php • 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.iniuncomment extension=php_mysql.dll (app. line 657) • Set PATH • C:\php\binC:\php\ext • Restart computer Open Source Server Side Scripting
Installing PHP 4 . 4 . 4 • If you want to install an earlier version of PHP • www.php.net/downloads.php • Download Windows Binaries • PHP 4.4.4 installer • Extract files • follow directions • set PATH Open Source Server Side Scripting
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 127.0.0.1:88 • When typing in URL, do not add “webpages” to URL Open Source Server Side Scripting
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 <body> <?php phpinfo( ); ?> • Name it phpinfo.php, save in C:\Xitami\webpages • Run it: http://localhost:82/phpinfo.php Open Source Server Side Scripting