Error on line 22

Hello,

First of all im not a web designer and have very little knowledge of this subject other then what i can find out on google. All the google search’s show that this error has occurred when people add a template to there website. My website was developed for me and isent associated with a template.

I have switch web hosting company’s and i have moved my website over to the new host. After i have uploaded the site i am getting this error:

Warning: include_once(/usr/local/apache/htdocs/functions/functions.php) [function.include-once]: failed to open stream: No such file or directory in /home/ausplayg/public_html/includes/all.php on line 22

Warning: include_once() [function.include]: Failed opening ‘/usr/local/apache/htdocs/functions/functions.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/ausplayg/public_html/includes/all.php on line 22

Fatal error: Call to undefined function connect() in /home/ausplayg/public_html/includes/all.php on line 22

I have found line 22 in the all.php and it has:

[php]include_once($_SERVER[‘DOCUMENT_ROOT’]."/functions/functions.php"); connect();[/php]

Inside the functions file the only thing i can see from my very little knowledge is a mysql database that has

[php]function connect(){
$connection = mysql_connect(‘localhost’, ‘databaseuser’, ‘databasepassword’);
$db = mysql_select_db(‘databasename’, $connection) or die(mysql_error());
return $db;
}[/php]

If you have a idea how to fix it please reply or you can add me on skype - destero_au

Any help will be hugely appreciated.

Try this instead

[php]include_once(dirname(FILE) . “/functions/functions.php”);[/php]

[php]Warning: include_once(/home/ausplayg/public_html/includes/functions/functions.php) [function.include-once]: failed to open stream: No such file or directory in /home/ausplayg/public_html/includes/all.php on line 22

Warning: include_once() [function.include]: Failed opening ‘/home/ausplayg/public_html/includes/functions/functions.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/ausplayg/public_html/includes/all.php on line 22

Warning: include_once(/home/ausplayg/public_html/includes/functions/sessions.php) [function.include-once]: failed to open stream: No such file or directory in /home/ausplayg/public_html/includes/all.php on line 24

Warning: include_once() [function.include]: Failed opening ‘/home/ausplayg/public_html/includes/functions/sessions.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/ausplayg/public_html/includes/all.php on line 24

Fatal error: Call to undefined function sql_form() in /home/ausplayg/public_html/includes/all.php on line 40[/php]

Well I’m not sure what your actual structure should be. Perhaps you can use relative paths

include_once("…/functions/functions.php");

Is this your structure?

/home/ausplayg/public_html
/home/ausplayg/public_html/includes
/home/ausplayg/public_html/includes/all.php
/home/ausplayg/public_html/functions
/home/ausplayg/public_html/functions/functions.php

??

I believe so.

if you wish to sharescreen add me on skype destero_au

If that is your structure then using the relative path should work. Try using it on all.php and see if it returns the same error.

include_once("…/functions/functions.php");

[php]include_once($_SERVER[‘DOCUMENT_ROOT’]."…/functions/functions.php"); connect();

include_once($_SERVER[‘DOCUMENT_ROOT’]."…/includes/sessions.php");[/php]

getting error

[code]Warning: include_once(/usr/local/apache/htdocs…/functions/functions.php) [function.include-once]: failed to open stream: No such file or directory in /home/ausplayg/public_html/includes/all.php on line 22

Warning: include_once() [function.include]: Failed opening ‘/usr/local/apache/htdocs…/functions/functions.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/ausplayg/public_html/includes/all.php on line 22

Fatal error: Call to undefined function connect() in /home/ausplayg/public_html/includes/all.php on line 22[/code]

If you have skype add me destero_au and u can have a fiddle.

You should not be using DOCUMENT_ROOT still.

[php]
include_once("…/functions/functions.php");
include_once("…/includes/sessions.php");
[/php]

[php]include_once("…/functions/functions.php");
include_once("…/includes/sessions.php");[/php]

getting this error

[code]Warning: include_once(…/functions/functions.php) [function.include-once]: failed to open stream: No such file or directory in /home/ausplayg/public_html/includes/all.php on line 22

Warning: include_once() [function.include]: Failed opening ‘…/functions/functions.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/ausplayg/public_html/includes/all.php on line 22

Warning: include_once(…/includes/sessions.php) [function.include-once]: failed to open stream: No such file or directory in /home/ausplayg/public_html/includes/all.php on line 23

Warning: include_once() [function.include]: Failed opening ‘…/includes/sessions.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/ausplayg/public_html/includes/all.php on line 23

Fatal error: Call to undefined function sql_form() in /home/ausplayg/public_html/includes/all.php on line 39[/code]

Well that means we either still don’t know the correct structure, or you are actually missing files.

When you login to your FTP you are most like in this directory:
/home/ausplayg/public_html

What do you see there?

Do you see a folder called ‘includes’?

And a folder called ‘functions’?

soon as i log in have
.cpanel
.htpasswds
etc
mail
public_ftp
public_html

ect

I then click on public_html and then i can view the folder
includes
functions

Hm… that is what I thought it was. There must be something else going on. If you are willing to PM me your FTP login I’ll try to take a look tomorrow if I have time.

add me on skype

destero_au

The only other thing I can recommend is using absolute paths. This is not a common practice, but should work. For example:

[php]
include_once("/home/ausplayg/public_html/functions/functions.php");
include_once("/home/ausplayg/public_html/includes/sessions.php");
[/php]

PS: I do not have skype… I am boycotting them until they shut down the MSN messenger network :wink:

Its displaying more now

Why was this all working on my previous webhosting fine we just uploaded it and changed the database options but this new host we are having to change alot just to make it work?

[code]Warning: include_once(/usr/local/apache/htdocs/functions/display.php) [function.include-once]: failed to open stream: No such file or directory in /home/ausplayg/public_html/functions/functions.php on line 85

Warning: include_once() [function.include]: Failed opening ‘/usr/local/apache/htdocs/functions/display.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/ausplayg/public_html/functions/functions.php on line 85

Warning: opendir(/usr/local/apache/htdocs/functions/lib/) [function.opendir]: failed to open dir: No such file or directory in /home/ausplayg/public_html/functions/functions.php on line 95

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/ausplayg/public_html/functions/functions.php:85) in /home/ausplayg/public_html/includes/sessions.php on line 20

Fatal error: Call to undefined function timeto() in /home/ausplayg/public_html/index.php on line 44[/code]

The functions file line 85

[php]include_once("$root_dir/functions/display.php");[/php]

sessions line 20

[php]session_start();[/php]

index line 44

[php] $query_text = “SELECT * FROM ap_threads WHERE t_type = ‘1’ AND t_time2 > '” .timeto(time()-(606024*90)) /90 days/ ."’ ORDER BY t_id DESC";[/php]

Most likely your old host had configured an include_path in the php.ini

From your errors:
include_path=’.:/usr/lib/php:/usr/local/lib/php’

If your host has support, you should certainly contact them and see if they can fix it so you don’t have to modify every include.

This is what you need to tell your host.

That your DOCUMENT_ROOT is coming up as ‘/usr/local/apache/htdocs’

When it should be ‘/home/ausplayg/public_html’

Sponsor our Newsletter | Privacy Policy | Terms of Service