Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Proper Way To Include PEAR CSV Extension

Posted on 2011-10-04
2
Medium Priority
?
277 Views
Last Modified: 2012-05-12
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

0
Comment
Question by:Ryan Bayne
2 Comments
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 200 total points
ID: 36913746
someone has issues

Who, what issues?  It looks like the only difference between the function calls is a semi-colon vs a colon.
0
 
LVL 2

Author Comment

by:Ryan Bayne
ID: 36913943
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
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month21 days, 3 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question