Solved

Apache App

Posted on 2012-03-21
9
314 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
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
phpmyadmin 3 33
Load google maps api into wordpress 5 37
Setting up two Raspberry Pi gateways/routers 3 40
Selecting SUM data from mysql table with PHP 4 6
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

911 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

17 Experts available now in Live!

Get 1:1 Help Now