
include_path를 변경하는 방법은 두 가지가 있습니다.
1. php.ini 파일을 수정하는 방법입니다. php.ini 파일을 열어 include_path 항목을 수정하면 됩니다. 예를 들어, include_path를 /var/www/html/include로 변경하고자 한다면, 다음과 같이 수정할 수 있습니다.
#hostingforum.kr
ini
include_path = "/var/www/html/include"
2. PHP 코드에서 include_path를 변경하는 방법입니다. include_path를 변경하고자 하는 PHP 파일에 다음 코드를 추가하면 됩니다.
#hostingforum.kr
php
ini_set('include_path', '/var/www/html/include');
위 방법 이외에도 include_path를 변경하는 방법으로는, PHP의 set_include_path 함수를 사용하는 방법이 있습니다.
#hostingforum.kr
php
set_include_path('/var/www/html/include');
또한, PHP 5.3 이상부터는 ini_set 함수를 사용하여 include_path를 변경할 수 있습니다.
#hostingforum.kr
php
ini_set('include_path', '/var/www/html/include');
위 방법은 php.ini 파일을 수정하는 것보다 코드 레벨에서 include_path를 변경할 수 있게 해줍니다.
2025-03-26 02:34