Solved

Apache App

Posted on 2012-03-21
9
313 Views
Last Modified: 2012-04-09
Hi, i have moved an app to a new VM.  one section of the site is not working.  I am receiving this error in the apache2 log:

PHP Fatal error:  require_once():  Failed opening required '../../../lib/init.php'
(include_path='/usr/share/php:/usr/share/pear') in /var/www/directory/index.php on line 8

Thanks,

Jackson
0
Comment
Question by:Jack_son_
  • 4
  • 4
9 Comments
 
LVL 3

Assisted Solution

by:Charlie2012
Charlie2012 earned 125 total points
ID: 37749649
Hi Jackson,

When you open file:

/var/www/directory/index.php

what configuration is on line 8?

Are you running a 64 bit or 32 bit system?

Where is your php.ini file located?

When you moved your app to the new VM did you recompile apache and php with the same modules as on the previous server?

What version of PHP are you running on the original server and on the new server?

If you create a phpinfo.php file on both servers in the /var/www/appfolder with the following content:

<?php phpinfo(); ?>

You can then go to URL/phpinfo.php This will give you your PHP information for each server so you can compare modules. (remember to remove this after as it is a security risk giving everyone your PHP information).

For apache you can check loaded modules by locating your apachectl file and running /path/apachectl -M or /path/httpd -M this will show loaded modules.
0
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 375 total points
ID: 37750220
Line 8 of index.php probably says something like this:

require('../../../lib/init.php');

The fatal error means that the path to the init.php script does not point to the right place.  The script may be missing or it may be in a different directory tree.
0
 

Author Comment

by:Jack_son_
ID: 37752236
You are correct about how the line reads.  Where should the init.php file be located?
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 37752417
Anywhere you want!  Just be sure the require() function calls for the correct path.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:Jack_son_
ID: 37752481
I'm a bit new to php, how do I know where it is looking for it.  I see the prefix of the location
.../.../.../lib/init.php

What directory does the .../ represent?
0
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 375 total points
ID: 37752662
I believe that it is two dots between the directory separators.  A google search for ../ relative path turns up this.
http://en.wikipedia.org/wiki/Path_%28computing%29

So I guess that the ../../../ is telling the machine to look "up" three parent directories above the existing directory.
0
 

Author Comment

by:Jack_son_
ID: 37753141
Okay, thanks - also one other issue in that error undefined variable:  user in /var/www/website.com/html/public/index.php
0
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 375 total points
ID: 37753204
Undefined variable messages are "Notice" level messages.  These are suppressed in PHP by default, thus allowing you to use undefined variables as if they were NULL, FALSE or zero.  So it may be that the old version of the error reporting was something like this:

error_reporting(E_ALL ^ E_NOTICE);

Personally, I always use error_reporting(E_ALL) so that I can see the Notice messages, because when I encounter an undefined variable, it is usually a typographical error on my part.  But if your script is designed to use undefined variables silently, you may want to change the error reporting to stop the Notice messages.
0
 

Author Closing Comment

by:Jack_son_
ID: 37825813
Thanks, these posts resolved the issue
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
The viewer will learn how to dynamically set the form action using jQuery.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

758 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

22 Experts available now in Live!

Get 1:1 Help Now