FIRST NORMAL FORM NO repeating columns containing same type of data ALL columns contain a single value Unique PRIMARY KEY for each row SECOND NORMAL FORM Table must be in First Normal Form Create new tables for any data that is repeated in columns Each new table needs a unique PRIMARY KEY for each row. can do this.THIRD NORMAL FORM Table must be in First and Second Normal Form. This is usually all that is necessary. Any data that is not dependent on a primary key, but is dependent on another value, should be removed to another table. This is a very strict use of normalization. |
Apache Cheat Sheet
The Apache HTTP Server is a free and open-source cross-platform web server software, released under the terms of Apache License 2.0.
Apache General
Database normalization
Database Access Information
Directory for include files |
[docroot]/inc |
MySQL Login file |
db_conn.php |
PHP include line |
|
[docroot]/inc/db_conn.php
<?php
// credentials for connecting to database
$host = 'hostname'; //database hostname
$user = 'db_user'; //database username
$pw = 'db_user_pw'; //database user password
$db = 'database'; //mysql database name
?>
If you lock yourself out of phpmyadmin:
...by turning on no password IN phpmyadmin: At the command line:
Now use username root and password letmein |
Install phpmyadmin
- Download phpmyadmin - Make new directory in the document root:
- Make it writeable by owner (which could be root):
- Unzip or unpack the zip file and copy to new directory Also see: phpmyadmin setup doc - From , create a new server connection by clicking New server- Under Authentication tab, enter as user and new password for rootThen click Save. - Now navigate to
|
Install MySQL
- Download from https://dev.mysql.com/downloads/mysql - Choose the version for your OS - Click “No thanks, just start my download” - Go through the download process - Make sure you copy the password for root@localhost - Start MySQL Server - Add to path in
To update password, see "If you lock yourself out of phpmyadmin" |
Turn on PHP
At the terminal, type: $>
Uncomment:
Save file then restart apache: $>
In the document root: $>
Enter:
Save file then restart apache: $>
In a browser, type:
|
Apache General Information
Apache Doc Root Directory |
/Library/WebServer/Documents |
httpd.conf lives in: |
/etc/apache2/httpd.conf |
localhost web access |
http://localhost/index.php |
Other docs and dirs in Document Root |
phpinfo.php, phpmyadmin, php.ini, inc/ |
bash alias |
|
Turn on apache
- At the terminal, type: >
- In a browser type: or
- If you see: It Works!, it works. |
Directives
RewriteBase |
specifies the URL prefix to be used for per-directory (htaccess) directives that substitute a relative path |
RewriteCond |
These directives may precede . For rule that matches URL it will trigger rewriting only if all it's conditions evaluate to true |
RewriteEngine |
Enable or disable rewriting |
RewriteMap |
Used for values mapping in substitutions of . Map values from files, databases, external functions etc. |
RewriteOptions |
Specifies rewriting options for server of directory |
RewriteRule |
Manch the URL, make substitution(s). This directive only used for matching against URL path. For matching port, scheme, query string use
|
Logging
logging can be enabled in apache configuration file with directive. Possible levels are from to . Log levels higher than 2 should be used only for debugging. Config example:
|
RewriteRule flags
B |
Escape non-alphanumerical characters before substitution |
BNP |
Escape space as %20 and not + |
C |
Chain the rules. It this rule fails, the chained one will be skipped |
CO |
Set a cookie |
DPI |
Discard path info of the URL |
END |
Stop all rewriting imeediately |
F |
Return 403 Forbidden |
G |
Return 410 Gone |
H |
Send to specific content handler |
L |
Stop rewriting on this rule |
N |
Re-run rewriting from the first rule |
NC |
Case-insensitive |
NE |
Do not hex-escape special characters |
NS |
Skip rule if it's a subrequest |
P |
|
PT |
|
QSA |
Add query string |
QSD |
Discard query string |
QSL |
Treat the last ? as QS delimiter |
R |
Redirect with code |
S |
Skip next N rules |
T |
Set the MIME-type |
Multiple flags should be comma-separated
RewriteRule substitutions
path |
When rule is configured in server context and file system path does exist |
URL |
A relative path to the resource to be served |
- |
Do not substitute anything |
$N |
Reference to capturing group in pattern |
%N |
Reference to capturing group in
|
%{VARNAME} |
Server variable |
${map:key|default} |
Mapping function |
RewriteRule syntax
|