Installing and using XAMPP with NetBeans PHP



Similar documents
MOODLE Installation on Windows Platform

Lab: Data Backup and Recovery in Windows XP

Lab - Data Backup and Recovery in Windows XP

PHP+MYSQL, EASYPHP INSTALLATION GUIDE

Backup and Restore MySQL Databases

Transferring Your Hosting Account

TortoiseGIT / GIT Tutorial: Hosting a dedicated server with auto commit periodically on Windows 7 and Windows 8

Procedure for updating Firmware of EZ4 W or ICC50 W

Install Apache on windows 8 Create your own server

How to test and debug an ASP.NET application

5.6.2 Optional Lab: Restore Points in Windows Vista

SharePoint How To s / Team Sites 1of 6

The goal with this tutorial is to show how to implement and use the Selenium testing framework.

Tournament Pairing Program Installation Instructions for Windows 7

Installing a Browser Security Certificate for PowerChute Business Edition Agent

Adding Outlook to a Blackberry, Downloading, Installing and Configuring Blackberry Desktop Manager

Quick Start Guide. Installation and Setup

XCM Internet Explorer Settings

HOW TO SETUP AN APACHE WEB SERVER AND INTEGRATE COLDFUSION

OUTLOOK WEB APP (OWA): MAIL

Wakanda Studio Features

Guide to Using Citrix at SLU (Windows)

About the Canon Mobile Scanning MEAP Application

UOFL SHAREPOINT ADMINISTRATORS GUIDE

Automated backup. of the LumaSoft Gas database

OrangeHRM Web Installation Guide for Windows

For Introduction to Java Programming, 5E By Y. Daniel Liang

JOOMLA 2.5 MANUAL WEBSITEDESIGN.CO.ZA

EBOX Digital Content Management System (CMS) User Guide For Site Owners & Administrators

Website Creator Pro Quick Reference Guide. Version: 0.5

Getting Started using the SQuirreL SQL Client

Quick Start Guide Zend Studio for i5/os V5.5

Deploying Intellicus Portal on IBM WebSphere

Setting Up a Development Server

TM Online Storage: StorageSync

To download and install directly to your phone

Speedlink software will run on Windows NT, Windows 7, and Windows 8; it will run on both 32 byte and 64 byte versions of Windows.

RaidenFTPD Log Analyser Web Edition

owncloud Configuration and Usage Guide

How to Log in to LDRPS-Web v10 (L10)

Xythos on Demand Quick Start Guide For Xythos Drive

Installing the VMware Horizon View Client to Access Hoag Virtual Desktops

Appendix K Introduction to Microsoft Visual C++ 6.0

CEFNS Web Hosting a Guide for CS212

Allworx Installation Course

Publish Joomla! Article

Aladin. There are currently two recommended links for Aladin. Suitable for most users, the default Aladin link is:

Migrating helpdesk to a new server

MyNetFone Virtual Fax. Virtual Fax Installation

BushSoft Accounts - Installation manual

JTouch Mobile Extension for Joomla! User Guide

BROWSER-BASED DEVELOPMENT & NETWORK MONITORING UTILITIES

Creating Online Surveys with Qualtrics Survey Tool

Virtual Office Remote Installation Guide

1 Intel Smart Connect Technology Installation Guide:

Google Sites: Site Creation and Home Page Design

Table of Contents. Table of Contents

HowTo. Planning table online

INFORMATION SYSTEMS SERVICE NETWORKS AND TELECOMMUNICATIONS SECTOR. User Guide for the RightFax Fax Service. Web Utility

Getting Started Guide

Virtual Private Server Manual

Operate Backup Data. This how-to document will walk you through how to acquire and view your (M)SDS collection from the backup we send you.

How To Install Database Oasis On A Computer Or Computer (For Free)

DOCUMENT MANAGEMENT SYSTEM

TSM for Windows Installation Instructions: Download the latest TSM Client Using the following link:

Jolly Server Getting Started Guide

Twido Simulator - Online Help Scope What's in this Part? Twido Simulator Overview What's in this Chapter? How to Use Twido Simulator

Online Backup - Installation and Setup

BIGPOND ONLINE STORAGE USER GUIDE Issue August 2005

Managing Documents in the Citrix XenApp Remote Desktop

Google Trusted Stores Setup in Magento

BSDI Advanced Fitness & Wellness Software

SENDING S & MESSAGES TO GROUPS

Terminal 4 Site Manager User Guide. Need help? Call the ITD Lab, x7471

Instructions for Importing (migrating) Data

Sage Accpac ERP 5.6A. CRM Analytics for SageCRM I User Guide

How To Install And Run Cesview Iii (For New Users)

1. To ensure the appropriate level of security, you will need Microsoft Windows XP or above.

DROPFILES SUPPORT. Main advantages:

Jadu Content Management Systems Web Publishing Guide. Table of Contents (click on chapter titles to navigate to a specific chapter)

SharePoint 2007 Get started User Guide. Team Sites

Installing a Personal Server on your PC

Installing Drupal on Your Local Computer

Microsoft SharePoint 2010 End User Quick Reference Card

Installation Instructions

Using the Synchronization Client

Setting up a Scheduled task to upload pupil records to ParentPay

BSDI Advanced Fitness & Wellness Software

Java. How to install the Java Runtime Environment (JRE)

Installing the Android SDK

SINGLE SIGN-ON FOR MTWEB

HOW TO TRANSFER FILES BETWEEN EEN IDL7000 PVR AND USB2 DEVICE

Using an Automatic Back Up for Outlook 2003 and Outlook 2007 Personal Folders

If you are you are using Microsoft outlook 2007, then new toolbar will be added below the Outlook menu bar,

!"#$ Stonington Public Schools Parents Guide for InfoSnap Online Enrollment. for Returning. Students. August. Online Enrollment.

Content Management System

Training Manual Version 1.0

VP-ASP Shopping Cart Quick Start (Free Version) Guide Version 6.50 March

BLACKBOARD CONTENT COLLECTION FACULTY TRAINING GUIDE

Signup instructions for the End User

Transcription:

Installing and using XAMPP with NetBeans PHP About This document explains how to configure the XAMPP package with NetBeans for PHP programming and debugging (specifically for students using a Windows PC). Pre- requirements You will need a working install of XAMPP follow the instructions in the Installing and using XAMPP for PHP programming exercise ensuring that you have created a folder for your work called PHP in the My Documents folder. You should also have created and run the sample PHP program. Enabling the debugger in XAMPP The php_xdebug.dll debug file is supplied as part of XAMPP, but is not enabled in the default distribution. Check that the file php_xdebug.dll exists by looking in C:\XAMMP\php\ext To enable php_xdebug.dll, you will need to edit the php.ini (removing some semicolons) The php.ini to be edited is in C:\XAMMP\php IMPORTANT: Make a backup copy of the php.ini file (call it phpbackup.ini) BEFORE making any changes. It is very easy to make a mistake in this file which will result in XAMPP not working. If it all goes wrong the phpbackup.ini file can be used to revert the system back to the way it was before editing. Changing the PHP.INI file Open the php.ini file in a text editor (for example the free editor Notepad++). Use the search mechanism to look for the value XDebug Make these changes Edit the file to remove the semicolon at the start of the XDebug lines Change the value for xdebug.remote.enable to 1 Add the xdebug.remote_port line with the value 9000 Save the file. 1

Restart the servers The php.ini file is only used when PHP is started so you will need to use the interface to Stop and Start the servers. If the servers fail to start Close and restart XAMPP If they still fail to start Restart the whole computer If it still refuses to start at this stage, restore your backup php.ini file. Testing that the debug module is initiated Create a new PHP file called phptest.php in your PHP folder with the following lines <?php phpinfo();?> phpinfo is a built in function which displays the current configuration details of the running PHP engine. Start a browser and navigate to localhost/phptest.php to run the file. A full page of settings should be displayed. Scroll down the page to look for the (new) entry for xdebug entry for PHP. If there is no entry it means that xdebug isn t working (or isn t installed correctly) in which case follow the steps from the beginning again. 2

Installing Java NetBeans is a Java application which may not be installed by default on Windows. If you haven t used Java before you will need to download and install the latest version (available from http://java.com ). Figure 6 Next, download and install the latest version of the NetBeans IDE for PHP (the HTML5 & PHP indicated in figure 7). Figure 7 Launch the IDE and check for / install any updates (Use the Help Check for Updates) 3

Creating Projects in NetBeans NetBeans is a production level IDE (Integrated Development Environment) and is designed to work with Projects, which are collections of PHP scripts, CSS file, library and image files together. You should have a PHP folder (inside Documents) from the setting up XAMPP exercise, with the XAMPP application using this folder for its document source. To create a NetBeans project using this folder, select File New Project from the menu bar As this is a new Project with no new files, choose PHP PHP Application If you were converting an existing set of files into a NetBeans project you would select..with existing sources Use the Browse button select the PHP folder inside the Documents folder where you will be saving your PHP scripts (this is the folder the XAMPP server is using for PHP files). Give the Project a name (you should be able to leave the other settings). 4

Change the Project URL to match the XAMPP URL http://localhost When using NetBeans you should always have a Project open either through creating a new project or by using the File Open Project menu to open some previously saved project. The final part of the project creation process is to add in any PHP frameworks these can be left unselected. Using NetBeans to create a PHP file As we now have a NetBeans Project Open, any files created in the IDE will be placed in the project (i.e. inside the PHP folder). Create a new PHP file from the menu choose File New File and select PHP PHP file to create an empty file and then give it a filename. The file should open in the IDE, ready for editing. 5

Writing and running a simple PHP program Add some code to print a simple text message note the way that lightbulb icons appear in the place of line numbers where there are code hints (which you can either follow or ignore). Click the Run icon (the green triangle) to execute the file You will have to supply details to the IDE to run the file in particular the Index File may have to be changed to the filename you have just created. In a larger project with many files you may have a main file that is the first one that visitors land on (a default one for example index.php). This may be different to the file you are currently editing. The file should run and appear in a browser window The IDE will identify many common PHP syntax errors change the program to include two lines, missing out a semicolon. The Red icon indicates an error, and hovering the pointer over the icon should suggest the cause of the problem. 6

Debugging a project in NetBeans IDEs allow a program to be run in a variety of ways for testing, you can Run a program one line at a time, looking at the output and values of the variables as the program progresses Set breakpoints, which are halt points when the program is running so that variables can be examined part way through an execution To demonstrate these techniques, change the program to include more print messages and a loop Use the Debugging icon (the smaller green triangle) to start a debugging session. Use Step Into to progress down the page, running the program one line at a time Note how a green line indicates where you are in the program, moving down the code as you press the Step Into button over and over again The values that the variables take can be seen in the panel at the bottom of the page note how the value of $i changes as you progress through the loop. You should always click the Finish Debugger Session button at the end to terminate the link between MAMP, the browser and the IDE. Breakpoints With very long programs, it would become tiresome to press Step Into many time to get to a later point in the code that you wish to test to achieve this add a breakpoint by clicking on the line number so a red line appears. Pressing the Continue button will run the program to that point, from which point the Step Into / Over buttons can be used to run the code one line at a time. 7

To remove a breakpoint click on the red square again. Other debugging techniques The Step Into icon allows the execution to progress one line at a time through every line - this allows lines inside blocks of code (such as those in loops or in functions) to be individually examined. If you want to skip over blocks (for example to avoid having to go round a loop many times, or to avoid seing the inner workings of a function) use the Step Over icon. You can also place the cursor at a point further down in the code and choose Run to cursor so that you can move the debugging forward in the code. 8