This repository is intended for the JSP and PHP labs only.
- MySQL JDBC connector jars are already vendored for the JSP labs:
- Database bootstrap SQL for the shared
AppLabschema: - Helper scripts for JSP and PHP labs:
- JDK 17+
- Apache Tomcat 9.0.x
- MySQL Server 8.x
- MySQL client (
mysql) - PHP 8+
Use this checklist on each Windows machine before running scripts.
- Install JDK 17 or newer.
- Ensure
JAVA_HOMEpoints to JDK folder (not JRE). - Ensure
%JAVA_HOME%\\binis inPath. - Open a new Command Prompt and verify:
java -version
javac -version
echo %JAVA_HOME%If javac is not recognized, fix JAVA_HOME and Path first.
- Install MySQL Server 8.x.
- Ensure MySQL service is running.
- Ensure
mysql.exeis available inPath. - Verify:
mysql --version
mysql -u root -pThen run database bootstrap:
cd AppLab-main
scripts\init_db.cmdIf using ZIP package:
- Extract to a fixed path, for example
C:\\tools\\php-8.3.x. - Add that folder to
Path. - Copy
php.ini-developmenttophp.ini. - In
php.ini, enable:
extension_dir = "ext"extension=pdo_mysqlextension=mysqli
- Verify:
php -v
php -mConfirm modules include PDO, pdo_mysql, and mysqli.
- Download Tomcat 9 Core ZIP (64-bit Windows zip).
- Extract it inside this repo at:
third_party\\tomcat\\apache-tomcat-9.0.117
- In Command Prompt from
AppLab-main, set:
set TOMCAT_HOME=%cd%\third_party\tomcat\apache-tomcat-9.0.117- Verify Tomcat files exist:
dir "%TOMCAT_HOME%\bin\startup.bat"
dir "%TOMCAT_HOME%\lib\servlet-api.jar"Download Core -> 64-bit Windows zip if you want the simplest portable setup on Windows.
Why:
- It is just the Tomcat files in a zip archive.
- You can unzip it anywhere and point
TOMCAT_HOMEto that folder. - It is better for a repo-based, machine-independent setup than the service installer.
Use the 32-bit/64-bit Windows Service Installer only if you want Tomcat installed as a Windows service on one machine.
Do not download:
- Full documentation, Deployer, Embedded, or Source Code distributions for normal JSP lab use.
For Linux, use Core -> tar.gz.
Run all commands from the AppLab-main folder.
- Initialize the database schema and seed data:
bash scripts/init_db.shThe script prompts for MySQL root password. Leave it blank only if root has no password.
- Set Tomcat path (for the current repo layout):
export TOMCAT_HOME="$PWD/third_party/tomcat/apache-tomcat-9.0.117"- Compile/deploy/run JSP apps (lab6a and lab7a):
bash scripts/run_web_labs.sh- Run PHP lab8 server:
bash scripts/run_lab8.sh-
Open Command Prompt in AppLab-main
-
Initialize MySQL schema and seed data:
scripts\init_db.cmd- Set Tomcat path:
set TOMCAT_HOME=%cd%\third_party\tomcat\apache-tomcat-9.0.117- Compile/deploy/run JSP apps (lab6a and lab7a):
scripts\run_web_labs.cmd- Run PHP lab8 server:
scripts\run_lab8.cmdYes, this can work on offline Windows machines if you carry installers and ZIPs in a pendrive.
- Your full repo clone (or zipped repo folder).
- JDK installer (17+).
- MySQL Server installer.
- PHP ZIP package (x64 Thread Safe).
- Tomcat 9 Core ZIP (64-bit Windows zip).
Optional:
- A text file with your exact setup commands for quick copy-paste.
- Install JDK.
- Install MySQL.
- Extract PHP and add to
Path. - Extract Tomcat into
AppLab-main\\third_party\\tomcat\\apache-tomcat-9.0.117. - Open Command Prompt in
AppLab-mainand run:
scripts\init_db.cmd
set TOMCAT_HOME=%cd%\third_party\tomcat\apache-tomcat-9.0.117
scripts\run_web_labs.cmd
scripts\run_lab8.cmdThis is the closest to one-click with current implementation. Tool installation is still one-time per machine.
If scripts\run_lab8.cmd says php is not found, install PHP from ZIP using these steps:
-
Download PHP 8.x for Windows (x64, Thread Safe ZIP).
-
Extract to a fixed location, for example:
C:\tools\php-8.5.5. -
Open the extracted folder and confirm
php.exeexists. -
Optional temporary PATH (current Command Prompt only):
set PATH=C:\tools\php-8.5.5;%PATH%
php -v-
Permanent PATH (recommended):
-
Press
Winkey and searchEnvironment Variables. -
Open
Edit the system environment variables. -
Click
Environment Variables.... -
Under
User variablesselectPathand clickEdit. -
Click
Newand addC:\tools\php-8.5.5. -
Click
OKon all dialogs. -
Close old Command Prompt windows and open a new one.
-
Verify PHP is now found globally:
php -v
where php-
In PHP folder, create config file:
-
Copy
php.ini-developmentand rename tophp.ini. -
Open
php.iniin a text editor. -
Ensure these lines are enabled:
extension_dir = "ext"extension=pdo_mysqlextension=mysqli
-
Verify required modules:
php -mConfirm output includes PDO, pdo_mysql, and mysqli.
- Run PHP lab server:
cd AppLab-main
scripts\run_lab8.cmd- lab6a: http://localhost:8080/lab6a/
- lab7a employee: http://localhost:8080/lab7a/e/index.jsp
- lab7a book: http://localhost:8080/lab7a/h/index.jsp
- lab8 PHP: http://127.0.0.1:8088/a.php
For lab8 with the provided scripts, use /a.php and /b.php.
Do not use /lab8/a.php because the script serves the lab8 folder itself as web root.
Linux Tomcat stop command:
"$TOMCAT_HOME/bin/catalina.sh" stopWindows Tomcat stop command:
"%TOMCAT_HOME%\bin\shutdown.bat"- The JSP code expects the
AppLabdatabase and tables created by offline/applab_init.sql. - Keep the MySQL username/password consistent across the JSP files.
- If your Tomcat folder version changes, update only
TOMCAT_HOMEcommand and keep the same script flow.