Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 12th, 2011, 02:06 PM
Registered User
 
Join Date: Dec 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Failed opening Required

How to go nuts:
Running newly modified RGSTRTN_07_7a.php script on my ISP's unix machine, from my PC, throws this error.

PHP Warning: require_once(/cnnct2mysql.php): failed to open stream: No such file or directory in /home/.../HTMLpages/RGSTRTN_07_7a.php on line 41
PHP Fatal error: require_once(): Failed opening required '/cnnct2mysql.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/.../RGSTRTN_07_7a.php on line 41

Of course '/cnnct2mysql.php' exists as stated (as will be seen) but doesn't get past the compiler, so no commands are executed.

When I run the script from my PC using Mozilla Firefox (via putty.exe) the program executes w/o throwing an error. It passes the compiler and gets near the end of the script where it locks up in the my-script to PalPal's sandbox and back echo loop. But I think that's another problem. Hence, I'm trying to solve the compiler error first.

Can anyone suggest how to diagnose my problem?

Thnx in advance.
ntelleck
 
Old December 12th, 2011, 02:22 PM
Registered User
 
Join Date: Dec 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OOPS!
This may be the wrong forum. Perhaps it should go to PRO PHP. I didn't see the comment on distinction.
How do I get it to the correct forum?
thnx
Ntelleck
 
Old December 13th, 2011, 03:57 AM
Friend of Wrox
 
Join Date: May 2011
Posts: 125
Thanks: 0
Thanked 24 Times in 24 Posts
Default

Greetings,

Going on the error alone it looks like php is looking in the root dir of where your running the script from. If it's in the same dir as the file you're running use:
Code:
require_once('./cnnct2mysql.php');
notice the . preceeding the / ;)
 
Old December 13th, 2011, 11:35 AM
Registered User
 
Join Date: Dec 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default re Failed opening Required

neither
require_once $_SERVER['DOCUMENT_ROOT']."/cnnct2mysql.php";
nor
require_once (."/cnnct2mysql.php");
work.
They both throw the same error when the script is run from unix

e.g., u-sit@lsh1001:~/www/.../ RGSTRTN_07_7a.php;

Thanks for your interest.
This one is a bummer. Gotta be some simple oversight on my part or pure misunderstanding of php

ntelleck
 
Old December 13th, 2011, 11:58 AM
Friend of Wrox
 
Join Date: May 2011
Posts: 125
Thanks: 0
Thanked 24 Times in 24 Posts
Default

Greetings,

Where is 'cnnct2mysql.php' in relation to 'RGSTRTN_07_7a.php'?

If it's in the same dir then try:
Code:
require_once('cnnct2mysql.php');
if that also does not work it could be because your running the script from the root of the drive in which case you'd have to use something like;
Code:
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'cnnct2mysql.php');
 
Old December 13th, 2011, 02:27 PM
Registered User
 
Join Date: Dec 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

cnnct2mysql.php is located 3 levels below
RGSTRTN_07_7a.php
at
require_once $_SERVER['DOCUMENT_ROOT']."/cnnct2mysql.php"
hence shouldn't the correct address be
$_SERVER['DOCUMENT_ROOT']."/cnnct2mysql.php"
as compared with the script requiring it at
$_SERVER['DOCUMENT_ROOT']."auxlib/../../RGSTRTN_07_7a.php"
?

ntelleck
 
Old December 13th, 2011, 04:42 PM
Registered User
 
Join Date: Dec 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

may it should be past tense: 'gone nuts!'

played around with two browsers using
$_SERVER['DOCUMENT_ROOT']."/cnnct2mysql.php"
shut down each browser between runs
suddenly
it's working!!

i don't get it, but i'll take it

thanks for your interest

ntelleck





Similar Threads
Thread Thread Starter Forum Replies Last Post
Help required zaeem SQL Server 2000 2 May 28th, 2008 12:48 AM
Some help required ! codenet C# 2005 1 September 24th, 2007 04:01 PM
Urgent help required! mani84 ADO.NET 1 May 19th, 2006 02:34 AM
Guidance required whyvenky General .NET 0 February 26th, 2006 03:03 AM
Failed opening required 'elements.php' (include_p paddy PHP Databases 3 July 31st, 2003 02:13 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.