본문 바로가기

프로그램 경험/PHP

[PHP] Windows + Apache + MsSql 연동하기 자리에서 PHP를 사용하여 MsSql 서버로 접근할 필요가 생겼다.내 자리엔 BitNami Redmine Stack 을 설치해 놔서 이미 아파치랑 PHP가 설치되어 있는 상태다.MsSql만 연결 하면 되는것이다. -PHP Version 5.3.13-Apache2 20051115 자료를 찾던중 php 5.2 이상 버전부터는 기존의 PDO_MSSQL 등등을 사용할 수 없고 새 버전인 SqlSrv를 사용해야 된다고 한다. http://www.microsoft.com/en-us/download/details.aspx?id=20098 여기서 sqlsrv30.exe 다운 받아서 실행하면 압축을 푼다. 압축풀면 몇개의 DLL들이 보이는데 자신의 버전에 맞게 설치 하면 된다. 내자리는 php 5.3 버전에 스레드 세이..
PhpStorm 디버깅 하기 1. php.ini 파일을 열어서 zend_extension 부분의 주석을 해제 한다. zend_extension="C:/BitNami Redmine Stack/php\ext\php_xdebug.dll"xdebug.remote_enable=truexdebug.remote_host=127.0.0.1xdebug.remote_port=9000xdebug.remote_handler=dbgpxdebug.profiler_enable=1xdebug.profiler_output_dir=C:\Windows\Temp 2. 아파치 재시작한다.
PhpStorm 테마
[PHP] 한달이 몇일 까지인지 알아내기 echo date("t", mktime (0,0,0,4,1,2012));  // return 30//date("t", mktime (0,0,0,월,1,년));
[PHP] UTF-8 을 EUC-KR로 변환 하기 iconv 함수 쓸때 //IGNORE 를 안붙여주면 내용이 짤리는 경우가 있다. 꼭 넣어주자.
[PHP] 파일 UTF-8로 저장하기 출처 : http://www.codingforums.com/showthread.php?t=129270
[PHP] 파일 다운로드 $justfilename = 'abc.pdf';       $filefullpath = '/home/you/file/path/'. justfilename;header('Content-type: application/x-unknown');header("Content-Disposition: attachment; filename=\"".$justfilename."\";");readfile($filefullpath);
[PHP] 파일 사이즈 단위 출력하기 $filesize = 17878788; $result = null;    if ($filesize         $result = round(($filesize / 1024), 2) . 'KB';     else if ($filesize         $result = round(($filesize / 1048576), 2) . 'MB';    else        $result = round(($filesize / 1073741824), 2) . 'GB';    echo $result;