반응형

PHP 46

windows에 apache + php + mysql 따로 설치

windows에 apache + php + mysql 따로 설치를 해봤습니다. ​Windows 10 Home Windows Server 2022 Standard ​두개의 윈도우 버젼에 설치를 했습니다.​ 1. Apache 설치 ​Apache 다운로드 https://www.apachelounge.com/download/ Apache VS17 binaries and modules download www.apachelounge.com httpd-2.4.57-win64-VS17을 다운받고 C:\APM 폴더를 만들고 압축을 풀었습니다. C:\APM\Apache24\conf httpd.conf를 열어서 수정하기 Define SRVROOT "c:/APM/Apache24" ​ ​ DocumentRoot "c:/APM/..

PHP 2024.03.07

PHP 에서 root (sudo) 권한 실행 (system, exec)

PHP 에서 프로세스를 실행할때 system 이나 exec 함수로 실행을 root 권한으로 사용하기 위해서는 다음의 파일에서 아래쪽에 다음과 같은 내용을 넣습니다. sudo vi /etc/sudoers www-data ALL=NOPASSWD: ALL 웹 권한에서 모든 명령어가 실행 가능합니다. 그런데 보안에 문제가 발생하겠지요. ㅎㅎ 만약 모든명령어가 아닌 특정명령어만 실행하도록 하고 싶다면 아래와 같이 입력을 해주면 된다. www-data ALL=NOPASSWD: /sbin/iptables, /usr/bin/du web 에서 root 실행 권한 확인 방법 php로 아래 코드를 작성하고 웹에서 실행 root 가 나오면 성공 !!

PHP 2023.09.15

[PHP] Return type of CI_Session_files_driver::open($save_path, $name) should either be compatible with SessionHandlerInterface::open(string $path, string $name): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the ..

Return type of CI_Session_files_driver::open($save_path, $name) should either be compatible with SessionHandlerInterface::open(string $path, string $name): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice /system/libraries/Session/drivers/Session_driver.php #[\ReturnTypeWillChange] public function open($save_path, $name) { ... } #[\ReturnTypeWillC..

PHP 2023.09.11

[php] Message: Creation of dynamic property CI_URI::$config is deprecated 에러 해결

php 8.2에 CodeIgniter v3.0.6 (Current version) 을 설치하고 session을 좀 쓰려고 하니 에러가 났습니다. Message: Creation of dynamic property Auth::$ci is deprecated A PHP Error was encountered Severity: 8192 Message: Creation of dynamic property Auth::$ci is deprecated Filename: libraries/Auth.php Line Number: 9 Backtrace: File: C:\APM\Apache24\htdocs\application\libraries\Auth.php Line: 9 Function: _error_handler Fi..

PHP 2023.09.11

Message: ftp_get(): Illegal PORT range rejected. 해결

FTP로 뭘 서버로 가져와야 하는데 에러가 났다. 방화벽에서 inbound outbound 다 해결을 해주고 접속 확인후에도 에러가 났다. 확인을 해보니 Message: ftp_get(): Illegal PORT range rejected. 요런 에러가 나면 passive 모드로 접속을 하면 된다. ftp_pasv($conn_id, true) or die("Unable switch to passive mode"); 이걸 추가하면 된다. $conn_id = ftp_connect($ftp_server); $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); ftp_pasv($conn_id, true) or die("Unable switch..

PHP 2023.09.07

PHP 8.2 phpExcel 대체 phpSpreadsheet 설치

PHP 8.2 에서 phpExcel을 사용하려고 했더니 {0} 를 [0] 로 바꾸고 해도 계속 에러와 경고가 떠서 phpExcel 대신 사용할 라이브러리를 찾던중 phpSpreadsheet가 있어서 사용하려고 한다. https://github.com/PHPOffice/PhpSpreadsheet GitHub - PHPOffice/PhpSpreadsheet: A pure PHP library for reading and writing spreadsheet files A pure PHP library for reading and writing spreadsheet files - GitHub - PHPOffice/PhpSpreadsheet: A pure PHP library for reading and writ..

PHP 2023.09.06

windows 10 composer 설치

Composer 설치 http://getcomposer.org/download Composer-Setup.exe 다운로드 후 실행 Install for all users (recommended) Next 설치완료 !!! 설치 테스트는 명령 프롬프트에서 composer 를 입력하고 엔터를 치면 저렇게 나오면 설치 성공 C:\Users\PC-075>composer ______ / ____/___ ____ ___ ____ ____ ________ _____ / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/ / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ / \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/ /..

PHP 2023.09.06

Array and string offset access syntax with curly braces is no longer supported in 에러 해결

php 8.* 에서 phpExcel 라이브러리를 사용하려다가 다운로드 하는 부분에서 에러가 났다. Array and string offset access syntax with curly braces is no longer supported in C:\APM\Apache24\htdocs\application\third_party\PHPExcel\Shared\String.php on line 529 저 파일을 찾아가보자 !! $c0 = ord($str{0}); $c1 = ord($str{1}); if( $bom_be ) { $val = ord($str{$i}) cyclicFormulaCount _raiseFormulaError('Cyclic Reference in Formula'); } elseif (($t..

PHP 2023.09.06

[PHP] 파일 확장자, 파일명, 폴더 파일리스트 구하기

파일 확장자 파일명 구하기 basename($filename); // path를 제외한 파일명 aaa.txt pathinfo($filename, PATHINFO_FILENAME); // 확장자를 제외한 파일명 aaa pathinfo($filename, PATHINFO_EXTENSION); // 파일 확장자 txt - 폴더안에 원하는 확장자 파일 리스트만 배열로 구하기 function getCurrentFileList($dir){ $valid_formats = array("jpg","png",'gif'); // 이미지 파일만 $handle = opendir($dir); $result = array(); while ($filename = readdir($handle)) { if($filename == '.'..

PHP 2023.08.17

[PHP] 외부서버의 파일 가져오기

외부 서버의 파일을 가져오려면 우선 php.ini에서 "allow_url_fopen"이 "on" 되어 있어야 한다. 아니면 힘든 과정을 거쳐야 한다. 1. copy 함수 이용 $url = "http://t1.daumcdn.net/daumtop_chanel/op/20200723055344399.png"; $file_name = basename($url); copy($url, "./upload/".$file_name); 2. file_get_contents, file_put_contents 함수 이용 $url = "http://t1.daumcdn.net/daumtop_chanel/op/20200723055344399.png"; $file_name = basename($url); $file = file_get..

PHP 2023.08.17
반응형