PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, August 30, 2022

[FIXED] How to use my server's PEAR package from site root

 August 30, 2022     centos, linux, pear, php     No comments   

Issue

First things first, my site is hosted on a Linux CentOS server and it already has the complete PEAR package in /usr/share/PEAR. I have written a send mail script using smtp and I want to include the server's PEAR/Mail.php in sendMail.php. Below is the site root structure:

Site: /var/www/html/buxx/
  SendMail/
   index.php
   sendMail.php

PEAR on Server
/usr
   /share
    /PEAR
     /Mail.php

I've tried to use set_include_path(".:/usr/share/PEAR/"), realpath(/usr/share/PEAR/Mail.php) and include_once("/usr/share/PEAR/")

but I keep getting errors like

[ERROR] include_once(): Failed opening '' for inclusion (include_path='.:/usr/share/pear') in /var/www/html/buxx/SendMail/sendMail.php

how do I include the absolute path to Mail.php in sendMail.php or is there any other way around this?

Many Thanks


Solution

It looks like your include path is already correct.

include "Mail.php" should do it.



Answered By - Farkie
Answer Checked By - Timothy Miller (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing