Tuesday, May 22, 2012

of PEAR and includes in PHP

note: the post will not make sense  if you are not familiar with PHP.


The Problem:
php scripts are not working. the scripts which did not contain any include or require functions within it are working fine.
everytime you try to run the code some fatal error shown below comes,


Fatal error: require_once() [function.require]: Failed opening required 'Mail.php' (include_path='.:/usr/share/psa-pear/:/usr/share/pear:/local/PEAR/') 


THE Solution:
the solution is to set "include_path(path to PEAR)" in php.ini file correctly.  here is some description about what it means,

What is PEAR?
it is the PHP Extension and Application Repository, or PEAR, is a repository of PHP software code.you can say that PEAR is responsible for all that modules or reusable PHP files you include in your code.
means if your PEAR gets fucked up...the PHP code which uses includes and require functions will not work.

get more information about it from here and here.


What is php.ini ?
it is configuration file for PHP. all the settings of PHP installed on your server are stored on php.ini file.
"dont play with it."
it contains the "include_path" variable which has value of path to PEAR module. you can get value of include_path by running the command "pear config-get php_dir" in php shell or command prompt.


some other resources:


http://in2.php.net/manual/en/ini.core.php#ini.include-path


http://au.answers.yahoo.com/question/index?qid=20080518003328AAPhVto


http://stackoverflow.com/questions/62658/getting-pear-to-work-on-xampp-apache-mysql-stack-on-windows


http://stackoverflow.com/questions/4858009/why-doesnt-php-pear-work-even-with-the-correct-include-path


i hope the solution works for you, otherwise you can always try re-installing  PEAR module or whole LAMP or WAMP if above solution doesnt work for you.


ciao!









2 comments:

  1. The catched copy of website is very interestingly presented...
    Good work :)

    ReplyDelete