PHP error require_once(Net/Server.php): failed to open stream:

Posted on 2011-05-13
Last Modified: 2012-05-11
Getting a PHP error when I run this php file on the line require_once ‘net/Server.php’;
php –f check_pear.php
//require_once 'System.php';
require_once 'Net/Server.php';
var_dump(class_exists('System', false));
PHP Warning:  require_once(Net/Server.php): failed to open stream: No such file or directory in /srv/www/htdocs/check_pear.php on line 3
PHP Fatal error:  require_once(): Failed opening required 'Net/Server.php' (include_path='.:/usr/share/php5:/usr/share/php5/PEAR') in /srv/www/htdocs/check_pear.php on line 3
I believe this is an issue with the path for pear/php or I am missing a package. I’m somewhat new to linux and still learning PHP so any help would by great.
When I run this file:
require_once 'System.php';
var_dump(class_exists('System', false));

I get:

My PHP info is:
PEAR path issue
Where PEAR installs .php files:
Configuration file is used by your PHP installation.
      Configuration File (php.ini) Path: /etc/php5/cli
Which php.ini is used by PHP on your web server?
Checked PHP's include_path setting on command line:
PHP Info
PHP Version 5.2.14

System       Linux domU-12-31-39-05-61-35 #1 SMP 2010-09-17 20:28:21 +0200 x86_64
Build Date       Mar 10 2011 17:26:30
Configure Command       '../configure' '--prefix=/usr' '--datadir=/usr/share/php5' '--mandir=/usr/share/man' '--bindir=/usr/bin' '--with-libdir=lib64' '--includedir=/usr/include' '--sysconfdir=/etc/php5/apache2' '--with-config-file-path=/etc/php5/apache2' '--with-config-file-scan-dir=/etc/php5/conf.d' '--enable-libxml' '--enable-session' '--with-mm' '--with-pcre-regex=/usr' '--enable-xml' '--enable-simplexml' '--enable-spl' '--enable-filter' '--disable-debug' '--enable-inline-optimization' '--disable-rpath' '--disable-static' '--enable-shared' '--program-suffix=5' '--with-pic' '--with-gnu-ld' '--with-system-tzdata=/usr/share/zoneinfo' '--with-apxs2=/usr/sbin/apxs2' '--disable-all' '--disable-cli'
Server API       Apache 2.0 Handler
Virtual Directory Support       disabled
Configuration File (php.ini) Path       /etc/php5/apache2
Loaded Configuration File       /etc/php5/apache2/php.ini
Scan this dir for additional .ini files       /etc/php5/conf.d
additional .ini files parsed       /etc/php5/conf.d/ctype.ini, /etc/php5/conf.d/dom.ini, /etc/php5/conf.d/hash.ini, /etc/php5/conf.d/iconv.ini, /etc/php5/conf.d/json.ini, /etc/php5/conf.d/pdo.ini, /etc/php5/conf.d/pdo_sqlite.ini, /etc/php5/conf.d/sqlite.ini, /etc/php5/conf.d/suhosin.ini, /etc/php5/conf.d/tokenizer.ini, /etc/php5/conf.d/xmlreader.ini, /etc/php5/conf.d/xmlwriter.ini, /etc/php5/conf.d/zlib.ini
PHP API       20041225
PHP Extension       20060613
Zend Extension       220060519
Debug Build       no
Thread Safety       disabled
Zend Memory Manager       enabled
IPv6 Support       enabled
Registered PHP Streams       php, file, data, http, ftp, compress.zlib
Registered Stream Socket Transports       tcp, udp, unix, udg
Registered Stream Filters       string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, convert.iconv.*, zlib.*

Question by:pointhigh
    LVL 17

    Accepted Solution

    Where on your server is that file: "net/Server.php" located in relation to your root?

    Your root is /srv/www/htdocs/ - if the file is not inside of your document root or inside your PATH, then it will not find it.

    Author Comment

    Thanks psimation,
    Just ran find / -name Server.php
    It did not find any thing for Server.php or server.php.
    Looks like I still need a pear or php package.
     Where can I find that package and what is it?
    What has been installed for pear is:
    LVL 17

    Expert Comment

    What Distro do you use? How did you install/build PHP (ie, did you just install PHP as part of the install options o the distro, or did you build it from source after the install of the OS?

    On RedHat derivatives, i suggest you use yum or up2date to install and maintain packages.
    As root, you can, for instance, install PHP with yum as follow:

    yum install php*

    This should install PHP and most packages and dependencies.

    Author Comment

    The distro is Suse 11, loaded as an AIM instance on Amazon EC2.
    I install both mySql and Apache2 by:
    zypper in apache2-mod_php5 mysql
    chkconfig apache2 on
    chkconfig mysql on
    service mysql start
    service apache2 start
    Most of PHP was install at the same time.
    I also added pear from yast (I added all the pear packages in listed in yast) and added some php5 packages from yast.
    My guess is that I missed the package, possibly a Pear package for Net_Server.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
    Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
    The viewer will learn how to dynamically set the form action using jQuery.
    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…

    755 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

    Need Help in Real-Time?

    Connect with top rated Experts

    25 Experts available now in Live!

    Get 1:1 Help Now