[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 765
  • Last Modified:

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

Getting a PHP error when I run this php file on the line require_once ‘net/Server.php’;
php –f check_pear.php
<?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:
<?php
require_once 'System.php';
var_dump(class_exists('System', false));
?>

I get:
bool(true)

My PHP info is:
PEAR path issue
Where PEAR installs .php files:
/usr/share/php5/PEAR
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?
      /etc/php5/apache2
Checked PHP's include_path setting on command line:
      .:/usr/share/php5:/usr/share/php5/PEAR:/etc/php5/apache2
PHP Info
PHP Version 5.2.14

System       Linux domU-12-31-39-05-61-35 2.6.32.19-0.3-ec2 #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.*

0
pointhigh
Asked:
pointhigh
  • 2
  • 2
1 Solution
 
psimationCommented:
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.
0
 
pointhighAuthor Commented:
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:
php5-pear
php5-pear-auth-sasl
php5-pear-date
php5-pear-db
php5-pear-file
php5-pear-log
php5-pear-mail
php5-pear-mail_mime
Thanks
Pointhigh
0
 
psimationCommented:
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.
0
 
pointhighAuthor Commented:
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.
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now