Link to home
Create AccountLog in
Avatar of Ryan Bayne
Ryan BayneFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Proper Way To Include PEAR CSV Extension

Hi

I've been using this function for a year now. It does work I know that but occasionally, someone has issues with it on their server.

I'm just wondering if anyone can spot an issue or can suggest a better approach. This approach is far older than a year so I thought it might be worth a try.

Thanks
function wtgpt_pearcsv_include(){
    if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'){
        ini_set('include_path',rtrim(ini_get('include_path'),';').';'.dirname(__FILE__).'/pear/');
    }else{
        ini_set('include_path',rtrim(ini_get('include_path'),':').':'.dirname(__FILE__).'/pear/');
    }
    require_once 'File/CSV.php';
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Ryan Bayne

ASKER

Customers. Information is vague, I would need access to their hosting php ini. This question is in response to a year of use on my software.

If you think it looks good then I'm sticking with it. I'm just checking because I was still really new to PHP when I started using this.

Thanks