FIRST SESSION - XAMPP Jeongmin Lee Jeongmin Lee CS PHD Machine Learning, AI Web System Development Information Office Hours: TBD Email: jlee@cs.pitt.edu XAMPP XAMPP X ( L = Linux, M = Mac, W= Windows but X = cross-platform) Apache Server MySQL PHP Perl Apache Server HTTP Server Written in C Open Source Windows, Linux, Mac OS X, Solaris, etc. By 2013 54.2% of all websites used Apache What is HTTP? Hypertext Transfer Protocol HTTP is the foundation of data communication for the World Wide Web. Hypertext is structured text that uses logical links (hyperlinks) between nodes containing text. HTTP is a request-response protocol between server and client to transfer data Example Request 1 Response 1 Request 2 Response 2 Request 3 Response 3 MySQL Relational Database Management System Open Source Written in C and C++ PHP PHP: Hypertext Preprocessor (recursive acronym ) PHP is a server-side scripting language designed for web development PHP code is interpreted by a web server with a PHP processor module Perl Perl is a programming language. In the web development environment, Perl is a very powerful way to create dynamic web pages. PHP vs Perl? PHP is easier to learn PHP is inline scripting language while Perl is not It is written within HTML code PHP is usually faster Perl much more powerfull in regex (PHP actually uses Perl to provide regex) Etc. How to install XAMPP? Install on USB Flash Drive using zip file Install on USB Flash Drive Install on Mac Install on Windows Install on USB Flash Drive using the zip file Download the zip file from http://sourceforge.net/projects/xampp/files/XAMPP% 20Windows/1.8.3/xampp-win32-1.8.3-4VC11.zip/download Unzip the files into a directory in the root of the flash drive and name it xampp. In the xampp directory run “setup-xampp.bat” file to setup xampp settings in the current directory Run “xampp-control.exe” Continue the rest from slide 29 XAMPP for Portable for Windows on USB Use the following link to download the portable installer: http://sourceforge.net/projects/xampp/files/XAMPP% 20Windows/1.8.3/xampp-portable-win32-1.8.3-1VC11-installer.exe/download Portable XAMPP for Windows Installer will show you the a welcome window. Click next. Portable XAMPP for Windows Installer will show options you can choose from, preferably, keep everything unless your running short of disc. You definitely will need MySQL, PHP, PHPMyAdmin and Apache. Portable XAMPP for Windows Next page will ask you to choose proper location. For portable installation choose the USB flash drive. Portable XAMPP for Windows After progress bar is finished click next till you can click on Finish. Portable XAMPP for Windows Click on Finish. Portable XAMPP for Windows Start Apache and MySQL servers when you open xampp from the installation folder. Portable XAMPP for Windows To test, click on Admin button for Apache server and you will see a page similar to the following. Install on Mac Go to: https://www.apachefriends.org/download.html Download desired version (preferably the one with the news PHP version) XAMPP for MAC Open the .dmg file For example: xampp-osx-1.8.2-5-installer.dmg In the following window open the installer XAMPP for MAC Choose next in the first setup window XAMPP for MAC You can choose options and click next Keep both if you don’t really have disc problems XAMPP for MAC Keep clicking on next till you the installation starts… XAMPP for MAC Keep clicking on next till you the installation starts… XAMPP for MAC After installation is done click on Finish XAMPP for MAC In application window: go to Manage Servers tab All servers should have been started otherwise choose them and click on start. (You may need to give permissions) XAMPP for MAC Make sure you don’t have any other instance of these Apache server or MySQL server running on your machine Stop them if any existed Stop Apache in terminal by running the following command: sudo apachectl stop Stop MySQL by running the following command in Terminal: sudo /usr/local/mysql/support-files/mysql.server stop XAMPP for MAC Try XAMPP by clicking on “Go To Application” in “Welcome” Tab This what you will have to see in your browser. Under http://localhost/xampp/splash.php XAMPP for MAC Try XAMPP Installation by clicking on “Go To Application Folder” in “Welcome” Tab There should be similar content in xamppfiles as shown in picture XAMPP for MAC htdocs in xamppfiles is where you can store all your future PHP, HTML or any other files types needed. Install on Windows Go to: https://www.apachefriends.org/download.html Download desired version (preferably the one with the news PHP version) Install on Windows Installer will show you the a welcome window. Click next. Install on Windows Installer will show options you can choose from, preferably, keep everything unless your running short of disc. You definitely will need MySQL, PHP, PHPMyAdmin and Apache. Install on Windows Next page will ask you to choose proper location. Choose a proper place on your Hard Drive. Install on Windows After progress bar is finished click next till you can click on Finish. Install on Windows Click on Finish. Install on Windows Start Apache and MySQL servers when you open xampp from the installation folder. Install on Windows To test, click on Admin button for Apache server and you will see a page similar to the following. Playing Around With Configs How to have two different apache servers? What is the problem here? Why do you think that we had to stop the previous apache server? What if I want them to work simultaneously? Problem? Both servers what to listen to the same port? Port 80 We have to change setting to use different port on XAMPP Change Apache Port on Mac In Manage Servers tab, choose to highlight Apache Web Server and click on Configure. Change Apache Port on Mac Change 80 to any port above 1024. Since anything below it is a reserved port. For example 8080 and restart server. Change Apache Port on Mac Now http://localhost/xampp doesn’t work anymore but http://localhost:8080/xampp is now active Fix on Windows On windows you’ll clock on Config in the top right corner. Then you’ll click on Service and Port Settings in the new window an you’ll change 80 to 8080 in the new window and you’ll need to also save Change Apache Port on Windows Now http://localhost/xampp doesn’t work anymore but http://localhost:8080/xampp is now active In case the GUI didn’t work Go to: Mac OS X: Windows: httpd.conf Apply following changes: Find the line which specifies the port number <USB drive letter>:\apache\conf\ Open the file: “/Applications/XAMPP/xampfiles/etc/” “Listen 80” It should be at line 58 in Windows and 52 In Mac Change the port from 80 to anything you desire Save and exit the file Restart apache server Test it Localhost:<port number> Safety Issues If you visit the security status page http://localhost/security/index.php if not working, visit http://localhost/ Click “English” Click “Security” on left side bar You will se that there are three security errors To fix this on Mac Run sudo /Applications/XAMPP/xamppfiles/xampp security Then open MySQL config file using the menues and find the line with: #password = your_password Remove # and change “your_password” to any password you desire. Fix on Windows Go to http://localhost/security/xamppsecurity.php Select password for both MySQL and XAMPP pages. THANKS