Link to home
Start Free TrialLog 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
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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