· KLDP.org · KLDP.net · KLDP Wiki · KLDP BBS ·
xampp

xampp


  • /opt/lampp/etc/
    • httpd.conf
    • locales.conf
    • my.cnf
    • php.ini

apache


  • /opt/lampp/etc/httpd.conf
    • LoadModule php4_module modules/libphp4.so
    • LoadModule php5_module modules/libphp5.so
    • ServerName localhost

    • Include etc/extra/httpd-xampp.conf

  • /opt/lampp/etc/extra/httpd-xampp.conf
    • AddType application/x-httpd-php .php .php3 .php4
    • .htm Ãß°¡ extension ÀÌ htm ÀÎ ÆÄÀÏ¿¡¼­ php ±¸¹®À» ó¸®ÇÏÁö ¸ø ÇÔ.
    • AddType application/x-httpd-php .php .php3 .php4 .htm

php


  • /opt/lampp/etc/php.ini
    • & ~E_NOTICE ¼³Á¤µÇÁö ¾ÊÀº º¯¼ö¸¦ ¿À·ù·Î ó¸®
    • error_reporting=E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT

PHP mostly runs on the web sever to generate HTML web pages, but is also used for command line scripting for Unix, Linux or even Windows, and less often, for GUI-based desktop applications.

PHP is HTML embedded script which facilitates developers to write dynamically generated pages quickly. PHP is primarily used on Server-side (and JavaScript on Client Side) to generate dynamic web pages over HTTP, however you will be surprised to know that you can execute a PHP in a Linux Terminal without the need of a web browser.

After PHP and Apache2 installation, we need to install PHP command Line Interpreter.
# apt-get install php5-cli 			[Debian and alike System)
# yum install php-cli 				[CentOS and alike System)

  • php-GTK
  • PHP Desktop

  • short open tag
    • <?= 'string' ?>
Short tags (example three) are only available when they are enabled via the short_open_tag php.ini configuration file directive, or if PHP was configured with the --enable-short-tags option.

  • session
Cookies are text files stored on the client computer and they are kept of use tracking purpose. PHP transparently supports HTTP cookies.

There are three steps involved in identifying returning users &#8722;

Server script sends a set of cookies to the browser. For example name, age, or identification number etc.

Browser stores this information on local machine for future use.

When next time browser sends any request to web server then it sends those cookies information to the server and server uses that information to identify the user.

An alternative way to make data accessible across the various pages of an entire website is to use a PHP Session.

A session creates a file in a temporary directory on the server where registered session variables and their values are stored. This data will be available to all pages on the site during that visit.

The location of the temporary file is determined by a setting in the php.ini file called session.save_path. Before using any session variable make sure you have setup this path.

When a session is started following things happen &#8722;

PHP first creates a unique identifier for that particular session which is a random string of 32 hexadecimal numbers such as 3c7foj34c3jj973hjkop2fc937e3443.

A cookie called PHPSESSID is automatically sent to the user's computer to store unique session identification string.

A file is automatically created on the server in the designated temporary directory and bears the name of the unique identifier prefixed by sess_ ie sess_3c7foj34c3jj973hjkop2fc937e3443.

When a PHP script wants to retrieve the value from a session variable, PHP automatically gets the unique session identifier string from the PHPSESSID cookie and then looks in its temporary directory for the file bearing that name and a validation can be done by comparing both values.

A session ends when the user loses the browser or after leaving the site, the server will terminate the session after a predetermined period of time, commonly 30 minutes duration.

  • version 5.3.0 ÀÌÈÄ ¼¼¼Ç ½ÃÀÛ¿¡ ½ÇÆÐÇϸé FALSE¸¦ ¹ÝȯÇÕ´Ï´Ù. ÀÌÀü¿¡´Â Ç×»ó TRUE¸¦ ¹ÝȯÇß½À´Ï´Ù.
  • version 4.3.3 ÀÌÈÄ ¼¼¼ÇÀÌ ÀÌ¹Ì ½ÃÀ۵Ǿî ÀÖÀ» ¶§ session_start()¸¦ È£ÃâÇϸé E_NOTICE µî±Þ ¿À·ù°¡ ¹ß»ýÇÕ´Ï´Ù. ¶ÇÇÑ, µÎ¹ø° ¼¼¼Ç ½ÃÀÛÀº ¹«½ÃµË´Ï´Ù.
  • ÄíÅ° ±â¹Ý ¼¼¼ÇÀ» »ç¿ëÇϸé, ºê¶ó¿ìÀú¿¡ Ãâ·ÂÇϱâ Àü¿¡ session_start()¸¦ È£ÃâÇØ¾ß ÇÕ´Ï´Ù.

javascript


  • HTML to define the content of web pages

  • CSS to specify the layout of web pages

  • JavaScript to program the behavior of web pages


JavaScript is a high-level, dynamic, untyped, and interpreted programming language.
Alongside HTML and CSS, JavaScript is one of the three core technologies of World Wide Web content production;

JavaScript is also used in environments that are not Web-based, such as PDF documents, site-specific browsers, and desktop widgets. Newer and faster JavaScript virtual machines (VMs) and platforms built upon them have also increased the popularity of JavaScript for server-side Web applications. On the client side, developers have traditionally implemented JavaScript as an interpreted language, but more recent browsers perform just-in-time compilation. Programmers also use JavaScript in video-game development, in crafting desktop and mobile applications, and in server-side network programming with run-time environments such as Node.js.

When the browser encounters a block of JavaScript, it generally runs it in order, from top to bottom. 

<p id="demo">JavaScript can change HTML content.</p>

<button type="button" onclick="document.getElementById('demo').innerHTML = 'Hello JavaScript!'">Click Me!</button>

<button onclick="document.getElementById('myImage').src='pic_bulbon.gif'">Turn on the light</button>

<img id="myImage" src="pic_bulboff.gif" style="width:100px">

<button onclick="document.getElementById('myImage').src='pic_bulboff.gif'">Turn off the light</button>

<p id="demo">JavaScript can change the style of an HTML element.</p>

<button type="button" onclick="document.getElementById('demo').style.fontSize='35px'">Click Me!</button>

<p id="demo">JavaScript can hide HTML elements.</p>

<button type="button" onclick="document.getElementById('demo').style.display='none'">Click Me!</button>

<p id="demo" style="display:none">Hello JavaScript!</p>

<button type="button" onclick="document.getElementById('demo').style.display='block'">Click Me!</button>

  • javascripy function
    • When an event occurs (when a user clicks a button)
    • When it is invoked (called) from JavaScript code
      • The () Operator Invokes the Function
      • Accessing a function without () will return the function definition
    • Automatically (self invoked)

  • JavaScript can be placed in the <body> and in the <head> section of any HTML page.
    • JavaScript code must be inserted between <script> and </script> tags.
  • Scripts can also be placed in external files:
    • used in many different web pages.
    • <script src="myScript.js"></script>

  • If you re-declare a JavaScript variable, it will not lose its value.

mysql


  • /opt/lanpp/etc/my.conf
    • Ãß°¡ ÇѱÛÀ» ? ·Î Ãâ·Â
    • character-set-server = utf8
    • skip-character-set-client-handshake

korean language

ÇѱÛ

  • xampp/mysql/bin/my.ini (À©µµ¿ìÁî)

  • http://recoveryman.tistory.com/193
  • xampp/apache/conf/extra/httpd-languages.conf
    • AddDefaultCharset utf-8

  • xampp/php/php.ini

  • linux ¿¡¼­ iconv ¸¦ »ç¿ëÇÏ¿© euckr À» utf8 ·Î º¯°æ


  • ÀÛ¾÷¼ø¼­
  • Èæ¼®À» unzip
  • source directory
  • destination directory
    • rm image dir to temp
    • rm seditor2 dir to temp
    • rm /common/print/°¢¼­µî.txt to temp
    • /common/print/image/title32 - º¹»çº».jpg
    • rm /admin/service/print_reg - º¹»çº».php to temp
  • source directory ¿¡¼­ encoding
  • Èæ¼®¿¡¼­ Áö¿î ÆÄÀÏ, µð·ºÅ丮¸¦ º¹»ç

  • save common/db_info.php and cp for passwd

  • find euc-kr
    • /opt/lampp/htdocs/admin/service/print_reg
    • /opt/lampp/htdocs/common/print/image/title32

  • php
    • iconv
string iconv ( string $in_charset , string $out_charset , string $str )
Performs a character set conversion on the string str from in_charset to out_charset.

  • admin_check.htm charset=UTF-8

  • mysql À» phpdbadmin ¿¡¼­ export ¸¦ utf8 ·Î ÇÔ.
  • import ÇÒ ¶§ table »ý¼ºÀ» euckr ·Î ÇÏ´Â °ÍÀÌ ¾Æ´Ò±î?

  • sys_code place_x ºÀ¾È1 ash ash2
  • sys_code place_y ºÀ¾È¹¦ ash

  • /opt/lampp/etc/php.ini
    • default_charset = "utf--8"
  • /opt/lampp/etc/my.cnf
[mysqld]

collation-server = utf8_unicode_ci
character-set-server = utf8
skip-character-set-client-handshake

  • /opt/lampp/etc/extra/httpd-xampp.conf
    • AddType application/x-httpd-php .php .php3 .php4 .htm

  • UTF-8 ÆÄÀÏÀ» iconv ÇÏ¸é ´ÙÀ½ ¿À·ù°¡ ¹ß»ý
    • iconv -f EUCKR -t UTF-8 readme.txt -o tst
    • iconv: 2 À§Ä¡¿¡ À߸øµÈ ÀÔ·Â ¼ø¼­¿­ÀÌ ÀÖÀ½

windows 7

  • make db
    • Èæ¼®
  • ¿ëÀο¡¼­ Èæ¼® db export
  • localhost/phpmyadmin ¿¡¼­ import

  • sql ÆÄÀÏÀÇ euckr À» utf8 ·Î º¯°æ

  • Èæ¼®À» htdocs ·Î º¹»ç

  • restart xampp

Warning: mysql_connect(): Access denied for user 'park_heukseok'@'localhost' (using password: YES) in C:\xampp\htdocs\common\util\db.php on line 14
Access denied for user 'park_heukseok'@'localhost' (using password: YES)

  • htdocs - common - db_info.php
<?php
/**
*  1. Program CD : db_info.php
*  2. Program NM : db &#65533;&#65533;&#65533;&#65533; &#65533;&#65533;&#65533;&#65533; 
*  3. Start Date : 
*  4. Last Date : 
*  5. Start Author : 
*  6. Last Author : 
*/
	$dbInfo=array("dbHost"=>"localhost", "dbUser"=>"park_heukseok", "dbPass"=>"park_heukseok!@#$", "dbName"=>"park_heukseok");
?>

  • yMqTvV5xyRYWwRjD

  • heukseok DB ¿¡ »ý¼ºÇÑ user park_heukseok Á¦°Å

  • localhost/phpmyadmin ¿¡¼­ »ç¿ëÀÚ°èÁ¤ »ý¼º

  • 2KuDp3ZBUTBeSYQT

  • ¿À·ù ÇѱÛ

  • sys_user table ÀÇ Æнº¿öµåÀÇ ¹®Á¦

  • SfmLHHtNXf7UeSGZ

  • admin - common - index.php
<?
	require_once("../../common/inc_manage.php");
			<!--input type="hidden" name="srchGroup" value="<?=$srchGroup?>"srchGroup´Â Ç÷¡½¬¸Þ´º¿¡¼­¸¸ »ç¿ë-->

  • test33 µÚ¿¡ ´ÙÀ½ ¿¡·¯
  • Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/5.6.28

db class

  • common/util/db.php
    • define class util_db

  • admin/common/login_ok.php
	include '../../common/inc_manage.php';
	function fncGetMenuAuth($user_cd, &$menuAuth, &$menuCategory, &$defaultCategory, $default_cd) {
		global $db;

  • common/inc_manage.php
    • common/inc_db.php
      • $db=new util_db;

ubuntu


  • /opt/lampp
  • sudo /opt/lampp/lampp start

  • cd /opt/lampp
  • sudo ./manager-linux.run
  • Èæ¼®À» /opt/lampp/htdocs ¹Ø¿¡ º¹»ç
  • localhost/index.htm
Warning: mysql_connect(): Access denied for user 'park_heukseok'@'localhost' (using password: YES) in /opt/lampp/htdocs/common/util/db.php on line 14
Access denied for user 'park_heukseok'@'localhost' (using password: YES)

  • db »ý¼º park_heukseok
  • import
  • »ç¿ëÀÚ Ãß°¡
  • common/db_info.php dbPass º¹»ç(»ç¿ëÀÚÃß°¡½Ã »ý¼ºµÈ Æнº¿öµå)
    • atom ¿¡¼­´Â ±ÇÇѹ®Á¦ ¹ß»ý(save)

  • localhost/index.htm
Notice: Undefined variable: srchGroup in /opt/lampp/htdocs/admin/common/index.php on line 16

Notice: Undefined variable: leftUrl in /opt/lampp/htdocs/admin/common/index.php on line 63

Notice: Undefined variable: mainUrl in /opt/lampp/htdocs/admin/common/index.php on line 67

  • admin/common/inc_form..php ¼öÁ¤ ÇØ°á¾ÈµÊ.

php.ini

* /opt/lammp/etc/php.ini

; This directive determines whether or not PHP will recognize code between
; <? and ?> tags as PHP source which should be processed as such. It's been
; recommended for several years that you not use the short tag "short cut" and
; instead to use the full <?php and ?> tag combination. With the wide spread use
; of XML and use of these tags by other languages, the server can become easily
; confused and end up parsing the wrong code in the wrong context. But because
; this short cut has been a feature for such a long time, it's currently still
; supported for backwards compatibility, but we recommend you don't use them.
; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/short-open-tag
short_open_tag=Off
; XAMPP for Linux is currently old fashioned
short_open_tag=On

  • error_reporting=E_ALL & ~E_DEPRECATED & ~E_STRICT
  • E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT

Áú¹®


  • PHP files can contain text, HTML, CSS, JavaScript, and PHP code
  • PHP files have extension ".php"

  • html file is a web page?
  • The purpose of a web browser (Chrome, IE, Firefox, Safari) is to read HTML documents and display them.
    • html file À» php file ó·³ ÇÁ·Î±×·¥ÇÏ´Â °æ¿ì°¡ ÀÖ´Ù.
    • server ¿¡¼­ htm ÆÄÀÏÀ» php ó·³ ó¸®Çϵµ·Ï ¼³Á¤ÇØ¾ß ÇÑ´Ù.

  • html ÆÄÀÏ¿¡´Â html tag ¿Í javascript ¸¸À» »ç¿ëÇÏ´Â °ÍÀÌ ÁÁÀ» °Í °°´Ù.
    • html ÆÄÀÏÀÇ html tag ÀÇ attribute ÀÇ value ¿¡ º¯¼ö¸¦ assignÇÏ´Â °ÍÀº?
    • html ÆÄÀÏ¿¡¼­ javascript function »ç¿ë
    • html ÆÄÀÏ¿¡¼­ php ÆÄÀÏÀ» include ÇÏ°í, php function À» »ç¿ëÇÏ´Â °ÍÀº?

  • php ÆÄÀÏ¿¡¼­´Â html tag ¿Í attribute ¿¡ º¯¼ö¸¦ assignÇÒ ¼ö ÀÖ´Ù.
  • php ÆÄÀÏ¿¡¼­ html tag ¿Í attribute ¿¡ php º¯¼ö¿Í function À» assign ÇÏ´Â °Í¿¡ Àͼ÷ÇØÁ® ÀÖ´Ù.
    • html ÆÄÀÏ¿¡¼­µµ °°Àº ¹æ½ÄÀ» »ç¿ëÇÑ´Ù.





sponsored by andamiro
sponsored by cdnetworks
sponsored by HP

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2016-12-26 12:57:07
Processing time 0.0117 sec