· 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.0021 sec