CC ICT-SUD. Setting up and integrate Apache, MySQL and PHP on a Linux system



Similar documents
Document Freedom Workshop DFW 2012: CMS, Moodle and Web Publishing

Install and configure Apache, MySQL, PHP on OSX 10.8 Mountain Lion

Setup a Virtual Host/Website

Web Server using Apache. Heng Sovannarith

CPE111 COMPUTER EXPLORATION

Kollaborate Server Installation Guide!! 1. Kollaborate Server! Installation Guide!

Installation of PHP, MariaDB, and Apache

SIMIAN systems. Setting up a Sitellite development environment on Mac OS X. Sitellite Content Management System

SVNManager Installation. Documentation. Department of Public Health Erasmus MC University Medical Center

Installing Booked scheduler on CentOS 6.5

Backup and Restore MySQL Databases

Install Apache on windows 8 Create your own server

Host your websites. The process to host a single website is different from having multiple sites.

Getting the software The Apache webserver can be downloaded free from the Apache website :

Installation Instructions

What will be supplied with chemoventory package?

Created by : Ashish Shah, J.M. PATEL COLLEGE UNIT-5 CHAP-1 CONFIGURING WEB SERVER

owncloud 8 and DigitalOcean Matthew Davidson Bluegrass Linux User Group 03/09/2015

Cloud Homework instructions for AWS default instance (Red Hat based)

LAMP : THE PROMINENT OPEN SOURCE WEB PLATFORM FOR QUERY EXECUTION AND RESOURCE OPTIMIZATION. R. Mohanty Mumbai, India

Advantech AE Technical Share Document

C:\www\apache2214\conf\httpd.conf Freitag, 16. Dezember :50

EZcast Installation guide

Web Server: Principles and Configuration Web Programming 8) Web Server

Installing OptiRain Open on Macintosh OS X 10.6 (Snow Leopard)

Technical specification

Contents: 1. Preparation/download files 2. Apache HTTPD Web Server MySQL PHP PHPMyAdmin Ruby On Rails 1.8.

MAMP 3 User Guide! March 2014 (c) appsolute GmbH!

PassMark Software BurnInTest Management Console. Quick start guide

Graphviz Website Installation, Administration and Maintenance

Building Website with Drupal 7

OpenEyes - Windows Server Setup. OpenEyes - Windows Server Setup

The Whole OS X Web Development System

UQC103S1 UFCE Systems Development. uqc103s/ufce PHP-mySQL 1

Setting up an Apache Web Server for Greenstone 2 Walkthrough

Matlab Web Server Installation and Configuration Guide

Tonido Cloud Admin Guide

HOW TO BUILD A VMWARE APPLIANCE: A CASE STUDY

LAMP Quickstart for Red Hat Enterprise Linux 4

SQL Injection Attack Lab Using Collabtive

Ulteo Open Virtual Desktop Installation

Apache and Virtual Hosts Exercises

A Beginner's Guide to Setting Up A Web Hosting System (Or, the design and implementation of a system for the worldwide distribution of pictures of

SETTING UP A LAMP SERVER REMOTELY

Modelling with R and MySQL. - Manual - Gesine Bökenkamp, Frauke Wiese, Clemens Wingenbach

Installing an open source version of MateCat

How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu

Server Installation/Upgrade Guide

How to Install Multicraft on a VPS or Dedicated Server (Ubuntu bit)

Setting up a Web Server using Raspbian Wheezy on the Raspberry Pi ( Kenneth A Spencer)

OpenPro ERP Software Installation Guide REDHAT LINUX

Installing Rails 2.3 Under CentOS/RHEL 5 and Apache 2.2

How To Install Amyshelf On Windows 2000 Or Later

Installation documentation for Ulteo Open Virtual Desktop

PacsOne Server Installation Guide. Author(s): Xiaohui Li Revision: 6.4.4

Installing Apache Software

Install Cacti Network Monitoring Tool on CentOS 6.4 / RHEL 6.4 / Scientific Linux 6.4

Installation of the Shibboleth-Apache Authorisation Module. 2. Obtain and compile the Apache server software

Getting Started with Dynamic Web Sites

Getting started with PrestaShop 1.4

APACHE WEB SERVER. Andri Mirzal, PhD N

Build it with Drupal 8

GestióIP IPAM v3.0 IP address management software Installation Guide v0.1

Setup Local Mail Server Using Postfix, Dovecot And Squirrelmail On CentOS 6.5/6.4

TIMETABLE ADMINISTRATOR S MANUAL

MAMP PRO 3 - User Guide! March 2014 (c) appsolute GmbH!

MassTransit 6.0 Enterprise Web Configuration for Macintosh OS 10.5 Server

SQL Injection Attack Lab

Apache & Virtual Hosts & mod_rewrite

The only skill required really is to locate and edit text-files with a text-editor like Notepad.

FireBLAST Marketing Solution v2

Fermilab Central Web Service Site Owner User Manual. DocDB: CS-doc-5372

Installing Apache, MySQL, PHP, and PECL on Windows

CN=Monitor Installation and Configuration v2.0

Digital Downloads Pro

SIMIAN systems. Setting up a Sitellite development environment on Windows. Sitellite Content Management System

AJ Matrix V5. Installation Manual

Written by: Johan Strand, Reviewed by: Chafic Nassif, Date: Getting an ipath server running on Linux

CTIS486 Midterm Solution 23/07/ Akgül

MOODLE Installation on Windows Platform

INSTALLING, CONFIGURING, AND DEVELOPING WITH XAMPP

Greenstone Documentation

OpenPro ERP Software Installation Guide Talbert Ave Suite 200 Fountain Valley, CA USA Phone Fax

Implementing HTTPS in CONTENTdm 6 September 5, 2012

OpenCATS Documentation

While are you still in Nagios working directory, create a new file for DNS servers monitoring

User Guide Zend Server Community 4.0.3

VERSION 9.02 INSTALLATION GUIDE.

Install & Configure Apache with PHP, JSP and MySQL on Windows XP Pro

SNPsyn documentation. Release 1.1b. Tomaž Curk Gregor Rot Davor Sluga Uroš Lotrič Blaž Zupan

INUVIKA OVD INSTALLING INUVIKA OVD ON RHEL 6

SQL Injection. Blossom Hands-on exercises for computer forensics and security

1. Configuring Apache2 Load Balancer with failover mechanism

vtiger CRM 4.2 Installation Guide for Linux OS

Web Site Content Management Server. Installation Guide Version 4.1 Build 0

See the installation page

Sugar Open Source Installation Guide. Version 4.5.1

Transcription:

LAMP CC ICT-SUD Setting up and integrate Apache, MySQL and PHP on a Linux system

Installation Simple Alternative (for development/testing only): Xampp I will assume MySQL is already installed and configured (see related presentation) Arch Linux: # pacman -S apache php php-apache Fedora: # yum install httpd php php-mysql Ubuntu: $ sudo apt-get install php5 apache2

Start the service Arch Linux: # /etc/rc.d/httpd start Fedora: # service httpd start Ubuntu $ sudo invoke-rc.d apache2 start Test by visiting http://localhost/ in a web browser.

Basic Apache Conf (1) Main configuration file Arch Linux, Fedora: /etc/httpd/conf/httpd.conf Ubuntu: /etc/apache2/apache2.conf If you set a hostname different from localhost edit /etc/hosts, e.g. for a local hostname: 127.0.0.1 localhost.localdomain localhost myhostname

Document root (2) This is the directory where you should put your web pages Arch Linux: /srv/http Fedora: /var/www/html Ubuntu: /var/www Related directive: DocumentRoot path and <Directory "path"> to grant necessary privileges

User directories (3) E.g., ~/public_html on the machine is accessed as http://localhost/~user/.to enable uncomment these lines in /etc/httpd/conf/extra/httpd-userdir.conf: UserDir public_html <Directory "/home/*/public_html"> AllowOverride FileInfo AuthConfig Limit Indexes Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec <Limit GET POST OPTIONS> Order allow,deny Allow from all </Limit> <LimitExcept GET POST OPTIONS> Order deny,allow Deny from all </LimitExcept> </Directory>

User directories (3) You must make sure that your home directory permissions are set properly so that Apache can get there. Your home directory and ~/public_html/ must be executable for others ("rest of the world"). This seems to be enough: $ chmod o+x ~ $ chmod o+x ~/public_html There may be some other, more-secure ways of setting the permissions by creating a special group and allowing only Apache and you to enter there.

Enabling PHP support (4) Add these lines in apache2/httpd.conf: LoadModule php5_module modules/libphp5.so Place this at the end of the "Include" list: Include conf/extra/php5_module.conf Restart the Apache service to make changes take effect. Testing: save this file as test.php and copy to document root or to ~/public_html. Go to http://localhost/test.php or http://localhost/~myname/test.php <?php phpinfo()?> If the php instruction is not executed add this to your apache2/httpd.conf - normally it's already taken care of: AddType application/x-httpd-php.php AddType application/x-httpd-php-source.phps

Basic PHP configuration (1) PHP configuration file: Arch Linux: /etc/php/php.ini Fedora: /etc/php.ini Ubuntu: /etc/php5/apache2/php.ini Restart the Apache service to make changes take effect open_basedir: open_basedir=/srv/http:/home/:/tmp/:/usr/sha re/pear/

Basic PHP configuration (2) enabling extensions: uncomment each line by removing ; ;extensions=mysqli.so ;extension=pdo.so ;extension=pdo_mysql.so Display errors to help debug your php code: display_errors=on don't do it on production web sites!

PhpMyAdmin (1) A PHP web-based tool to administrate MySQL over the WWW Features: create and drop databases, create/drop/alter tables, delete/edit/add fields, execute any SQL statement, manage keys on fields, manage privileges, export data into various formats, etc Installation: Arch Linux: # pacman -S phpmyadmin php-mcrypt Fedora: # yum install phpmyadmin Ubuntu: $ sudo apt-get install phpmyadmin Enable extension=mcrypt.so in php.ini

PhpMyAdmin (2) Install configuration file: cp /etc/webapps/phpmyadmin/apache.example.conf /etc/httpd/conf/extra/httpd-phpmyadmin.conf Add the following line to /etc/httpd/conf/httpd.conf: Include conf/extra/httpd-phpmyadmin.conf Ensure there is not a line in deny from all in /usr/share/webapps/phpmyadmin/.htaccess

PhpMyAdmin (3) Sample httpd-phpmyadmin.conf: Alias /phpmyadmin "/usr/share/webapps/phpmyadmin" <Directory "/usr/share/webapps/phpmyadmin"> AllowOverride All Options FollowSymlinks Order allow,deny Allow from all </Directory> open_basedir in php.ini must include :/usr/share/webapps/:/etc/webapps In config.inc.php: $cfg['servers'][$i]['extension'] = 'mysqli';

PhpMyAdmin (4) Advanced features: Query bookmarks Column comments SQL-history Tracking mechanism PDF-generation Field content transformation Relations (even for MyISAM table type)

PhpMyAdmin (5) Enabling some advanced features: Define a controluser with the proper rights: GRANT SELECT, INSERT, DELETE, UPDATE ON `phpmyadmin`.* TO 'pma'@localhost IDENTIFIED BY 'some_pass'; Create support database: $ mysql -uroot -p <scripts/create_tables.sql Uncomment some lines in config.inc.php: $cfg['servers'][$i]['pmadb'] = 'phpmyadmin' $cfg['servers'][$i]['relation'] = 'pma_relation' $cfg['servers'][$i]['controlpass'] = 'some_pass'; $cfg['servers'][$i]['controluser'] = 'pma';...

LAMP CC ICT-SUD Setting up and integrate Apache, MySQL and PHP on a Linux system 1

Installation Simple Alternative (for development/testing only): Xampp I will assume MySQL is already installed and configured (see related presentation) Arch Linux: # pacman -S apache php php-apache Fedora: # yum install httpd php php-mysql Ubuntu: $ sudo apt-get install php5 apache2 2 php: command line PHP interpreter php-apache: Apache SAPI (Server Application Programming Interface) for PHP XAMPP is an easy to install and to use Apache distribution containing MySQL, PHP and Perl. It is available for all the most common OS's (Linux, Windows and Mac OS X)

Start the service Arch Linux: # /etc/rc.d/httpd start Fedora: # service httpd start Ubuntu $ sudo invoke-rc.d apache2 start Test by visiting http://localhost/ in a web browser. 3

Basic Apache Conf (1) Main configuration file Arch Linux, Fedora: /etc/httpd/conf/httpd.conf Ubuntu: /etc/apache2/apache2.conf If you set a hostname different from localhost edit /etc/hosts, e.g. for a local hostname: 127.0.0.1 localhost.localdomain localhost myhostname 4 If you set a hostname and it does not appear in the static hostnames database, apache will fail to start.

Document root (2) This is the directory where you should put your web pages Arch Linux: /srv/http Fedora: /var/www/html Ubuntu: /var/www Related directive: DocumentRoot path and <Directory "path"> to grant necessary privileges 5

User directories (3) E.g., ~/public_html on the machine is accessed as http://localhost/~user/.to enable uncomment these lines in /etc/httpd/conf/extra/httpd-userdir.conf: UserDir public_html <Directory "/home/*/public_html"> AllowOverride FileInfo AuthConfig Limit Indexes Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec <Limit GET POST OPTIONS> Order allow,deny Allow from all </Limit> <LimitExcept GET POST OPTIONS> Order deny,allow Deny from all </LimitExcept> </Directory> 6 UserDir: The name of the directory that is appended onto a user's home directory if a ~user request is received. Note that you must also set the default access control for these directories, as in the example below. Control access to UserDir directories. The following is an example for a site where these directories are restricted to read-only. UserDir: Directory-filename: location of the user-specific directories <Directory>: enclose a group of directives that apply only to the named file-system directory and sub-directories AllowOverride: type of directives that are allowed in.htaccess files Options: Configures what features are available in a particular directory <Limit>: Restrict enclosed access controls to only certain HTTP methods <LimitExcept>: Restrict access controls to all HTTP methods except the named ones

User directories (3) You must make sure that your home directory permissions are set properly so that Apache can get there. Your home directory and ~/public_html/ must be executable for others ("rest of the world"). This seems to be enough: $ chmod o+x ~ $ chmod o+x ~/public_html There may be some other, more-secure ways of setting the permissions by creating a special group and allowing only Apache and you to enter there. 7

Enabling PHP support (4) Add these lines in apache2/httpd.conf: LoadModule php5_module modules/libphp5.so Place this at the end of the "Include" list: Include conf/extra/php5_module.conf Restart the Apache service to make changes take effect. Testing: save this file as test.php and copy to document root or to ~/public_html. Go to http://localhost/test.php or http://localhost/~myname/test.php <?php phpinfo()?> If the php instruction is not executed add this to your apache2/httpd.conf - normally it's already taken care of: AddType application/x-httpd-php.php AddType application/x-httpd-php-source.phps 8

Basic PHP configuration (1) PHP configuration file: Arch Linux: /etc/php/php.ini Fedora: /etc/php.ini Ubuntu: /etc/php5/apache2/php.ini Restart the Apache service to make changes take effect open_basedir: open_basedir=/srv/http:/home/:/tmp/:/usr/sha re/pear/ 9

Basic PHP configuration (2) enabling extensions: uncomment each line by removing ; ;extensions=mysqli.so ;extension=pdo.so ;extension=pdo_mysql.so Display errors to help debug your php code: display_errors=on don't do it on production web sites! 10 You're strongly advised to use error logging in place of error displaying on production web sites because they could be useful to someone attempting to crack your server.

PhpMyAdmin (1) A PHP web-based tool to administrate MySQL over the WWW Features: create and drop databases, create/drop/alter tables, delete/edit/add fields, execute any SQL statement, manage keys on fields, manage privileges, export data into various formats, etc Installation: Arch Linux: # pacman -S phpmyadmin php-mcrypt Fedora: # yum install phpmyadmin Ubuntu: $ sudo apt-get install phpmyadmin Enable extension=mcrypt.so in php.ini 11

PhpMyAdmin (2) Install configuration file: cp /etc/webapps/phpmyadmin/apache.example.conf /etc/httpd/conf/extra/httpd-phpmyadmin.conf Add the following line to /etc/httpd/conf/httpd.conf: Include conf/extra/httpd-phpmyadmin.conf Ensure there is not a line in deny from all in /usr/share/webapps/phpmyadmin/.htaccess 12 /etc/webapps/phpmyadmin/ is the location for configuration files pertaining to phpmyadmin

PhpMyAdmin (3) Sample httpd-phpmyadmin.conf: Alias /phpmyadmin "/usr/share/webapps/phpmyadmin" <Directory "/usr/share/webapps/phpmyadmin"> AllowOverride All Options FollowSymlinks Order allow,deny Allow from all </Directory> open_basedir in php.ini must include :/usr/share/webapps/:/etc/webapps In config.inc.php: $cfg['servers'][$i]['extension'] = 'mysqli'; 13 Note that if you include a trailing / on the url-path of the Alias directive then the server will require a trailing / in order to expand the alias. That is, if you use Alias /phpmyadmin/ /usr/share/webapps/phpmyadmin/ then the url /phpmyadmin will not be aliased. Select mysqli as extension to use for making phpmyadmin communicating with MySQL, because it is faster than the old mysql extension.

PhpMyAdmin (4) Advanced features: Query bookmarks Column comments SQL-history Tracking mechanism PDF-generation Field content transformation Relations (even for MyISAM table type) 14 Bookmarks are useful for queries you often run. Any query you have executed can be stored as a bookmark on the page where the results are displayed. A bookmark is related to the database you run the query on and single variable support is available. You can store comments to describe each column for each table. These will then be shown on the "printview" or as tool-tips above the column names on the table property pages. SQL history means all queries you entered manually into the phpmyadmin interface are saved across navigation sessions. Tracking allows creating versions of tables and logs both DDL and DML SQL commands. You can create PDF graphics of your Database layout. Transform stored data into any format using a set of predefined functions, like displaying BLOB-data as image or download-link

PhpMyAdmin (5) Enabling some advanced features: Define a controluser with the proper rights: GRANT SELECT, INSERT, DELETE, UPDATE ON `phpmyadmin`.* TO 'pma'@localhost IDENTIFIED BY 'some_pass'; Create support database: $ mysql -uroot -p <scripts/create_tables.sql Uncomment some lines in config.inc.php: $cfg['servers'][$i]['pmadb'] = 'phpmyadmin' $cfg['servers'][$i]['relation'] = 'pma_relation' $cfg['servers'][$i]['controlpass'] = 'some_pass'; $cfg['servers'][$i]['controluser'] = 'pma';... 15