appwiki:xampp

XAMPP Quick Setup walkthrough

Official Method

  • download and install XAMPP
  • open xampp-control software, and run Apache server and SQL server
  • open http://localhost to make sure everything runnning
  • open http://localhost/phpmyadmin, to make sure database running
  • check password.txt in the install directory for defaut SQL server password and ftp password
  • now you can start work on your web project in htdoc directory under install directory
    • http://localhost/ is pointing to htdoc directory, so use your sub directory to separate project folders.

Portable Method

Default Password for MySQL

  • it is under xampp folder, password.txt file

Create a Database for Wordpress site

  • name as wp_test01, collation as choice, create

xampp setup

Download from http://www.apachefriends.org

click on the xampp-control application to go. start web

xampp start apache

start sql

xampp start mysql

start web

xampp stop apache

start sql

xampp stop mysql

in Linux, extract the LAMPP with sudo, or “MySQL couldn't start” error will pop-up later.

sudo tar xvfz xampp-linux-1.7.3a.tar.gz -C /opt
 
# or if you want to extract here
sudo tar xvfz xampp-linux-1.7.3a.tar.gz

Enter in Browser like

ServerName.local

or

192.168.1.machineIP

or

ServerName
Apache configuration /Applications/xampp/etc/httpd.conf,
/Applications/xampp/etc/*.conf
Apache logs /Applications/xampp/xamppfiles/logs/access_log,
/Applications/xampp/xamppfiles/logs/error_log
PHP configuration /Applications/xampp/etc/php.ini like upload_max_filesize
MySQL configuration /Applications/xampp/etc/my.cnf

xampp customize htdoc location path

  1. go to directory : xampp/apache/conf;
  2. backup httpd.conf;
  3. edit httpd.conf, search and replace “DocumentRoot” as following
     
    # DocumentRoot "/App/xampp/htdocs"
    DocumentRoot "/SiteDir"
  4. and search and replace the <Directory “/xampp/htdocs”> configure setting as following
    # <Directory "/App/xampp/htdocs">
    <Directory "/SiteDir">
  5. server root (optional, only if yours apache server not working, just check path to apache server)
    # ServerRoot "/xampp/apache"
    ServerRoot "/PATHTOHERE/xampp/apache"
  6. to add extra directory into server alias list, means, you can ask apache server to use a short name to find other directory on your computer.
    • basically, when people use url ServerName/web2/index.htm, it doesn't look at defaut root directory for web2 folder, but go /Dev/WebSys computer folder to find index.htm
    • here is example code to add in httpd.conf, and shut down and restart server to make it work
      <Directory "/Dev/WebSys2">
          Require all granted
      </Directory>
      Alias /web2 "/Dev/WebSys2"
    • if you want allow htaccess for url rewrite, make sure like this
      <Directory "/Dev/WebSys2">
          AllowOverride All
          Require all granted
      </Directory>
      Alias /web2 "/Dev/WebSys2"
    • also make your rewrite module for php is loaded in httpd.conf
      LoadModule rewrite_module modules/mod_rewrite.so

xampp customize local domain for a local web path

Steps:

  1. use hosts file to point the domain to local 127.0.0.1, example “test.com”, also include localhost to be safe
    127.0.0.1       localhost
    127.0.0.1       test.com
  2. in xampp/apache/conf/extra/httpd-vhosts.conf, add your local domain solver “test.com”, and since localhost is default domain name for root dir, be sure add it as well to use localhost as usual
    <VirtualHost *>
        DocumentRoot "/App_Server/xampp/htdocs/wp_site_test_com"
        ServerName test.com
        <DIRECTORY "/App_Server/xampp/htdocs/wp_site_test_com">
        Order allow,deny
        Allow from all
        </DIRECTORY>
        ServerAlias www.test.com
        ErrorLog "logs/test.com-error.log"
        CustomLog "logs/test.com-access.log" common
    </VirtualHost>
    <VirtualHost *>
        DocumentRoot "/App_Server/xampp/htdocs"
        ServerName localhost
    </VirtualHost>
  3. now, restart apahce server, type “test.com” should visit your local path for test.com
  4. extra tips:
    1. for wordpress install at that path, it will pop up ask database server setting in wordpress initial step,
    2. since wordpress alone dont create database for itself, you need go http://localhost/phpmyadmin/ to create a database for wordpress, i would suggest name as “wpdb_test_com” with collation setting
    3. then, continue wordpress db connection with the db name you created, default db for xampp is root/no pass. rest as default should finish wordpress initialization

xampp customize http broadcast port

  1. edit xampp/apache/conf/httpd.conf;
  2. search and replace “80” to your port number
    ServerName localhost:80
  3. and search and replace “80” in
    Listen 80

Security and Site Protection

ref: http://blog.foxxtrot.net/2010/02/blocking-domain-smacks-in-apache.html

RewriteEngine on
RewriteCond %{HTTP_REFERER} smackingdomain.com
RewriteRule .+ [F] # Return 403 Forbidden
RewriteRule .+ http://jokestersite.com/ [R] # Redirect back on the joker. 
  • run command in terminal:
    xampp security

ref: http://robsnotebook.com/xampp-builtin-security

MySQL Server Guide

  • MySQL database server configuration is stored in the “mysql” database inside itself.
    • the server user is stored in DB: “mysql” > Table: “user”
  • phpmyadmin control panel system is a front interface for the database server
tables MySQL access control
user host name + user name + password select,insert,update,delete rights which means knowing user and pass wont grant access,
and possible to set local only access from its php server;
also it mean sets foreign server call possible with maybe coincided names
db database level access control
table priv table level access control
columns_priv column level access control
procs_priv procs access control
  • SHOW GRANTS FOR 'joe'@'office.example.com';
  • limits of MyServer server:
    • A password applies globally to an account. You cannot associate a password with a database, table

Error and Solution

  • error: Apache cant start,
    • solution 1: run setup_xampp.bat after copy, to auto set root directory correctly
    • solution 2: make sure the website folder that defined in \xampp\apache\conf\httpd.conf portion DocumentRoot directory exists.
      • also check httpd.conf and change to 82 if 80 port in use.
    • solution 3: just go to \xampp\apache\logs folder, and delete all 4 files, so it can generate itself again.
    • solution 4: run with admin rights
  • error: MySQL cant start, access right
    • solution: delete the file that has no access right
  • error: php time out, especially when do install type of script
    • go php.ini configure file, and search and update “max_execution_time = 300” (5min)
  • error: upload failed
    • make sure php.ini allow the big size upload, search and replace these 2 line in php.ini from configure button menu
      upload_max_filesize = 50M
      post_max_size = 50M
  • appwiki/xampp.txt
  • Last modified: 2021/11/14 18:05
  • by ying