ken b Posted September 16, 2009 Posted September 16, 2009 I am trying to call a index.php file like this <?php require( 'http://mydomain.com/index.php'); ?> in another index.php file a subdomain on the same site and I get the following errors in m error log. It seems like oscommerce won't load the page somehow due to something that is missing? [16-Sep-2009 15:51:57] PHP Warning: require(includes/configure.php) [<a href='function.require'>function.require</a>]: failed to open stream: No such file or directory in /home/mydomain/public_html/includes/application_top.php on line 41 [16-Sep-2009 15:51:57] PHP Fatal error: require() [<a href='function.require'>function.require</a>]: Failed opening required 'includes/configure.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/mydomain/public_html/includes/application_top.php on line 41 ANy ideas? It worked on my old host and broke when I moved to my new server.
♥kymation Posted September 17, 2009 Posted September 17, 2009 Try this: <?php require( 'index.php'); ?> That assumes that the file you want to require is in the same directory as the main file you are including it into. If it's not, you need to provide the correct path to that file, like this: <?php require( 'includes/modules/index.php'); ?> Regards Jim See my profile for a list of my addons and ways to get support.
Guest Posted September 17, 2009 Posted September 17, 2009 It worked on my old host and broke when I moved to my new server. Changes are your new host has remote file inclusion turned off in their php install for security. Doing what the previous poster said should fix it but you may have to include /home/username/full/path/to/index.php.
ken b Posted September 17, 2009 Author Posted September 17, 2009 AfterDarkMike you are correct that remote file inclusion is off on the new server. Kymation I tried the code you suggested and it apears to work on a simple php file I created called index1.php. But when I changed it to pull the php file that I really am working on I now get an error. Below is the contect of the the file as suggested by Kymation <?php require( '/home/mydomain/public_html/index.php'); ?> And here is the error I get when I visit the page. It looks to me like oscommerce doesn't like it all though we had no issues pulling the osCommerce home page from the old server. Warning: require(includes/configure.php) [function.require]: failed to open stream: No such file or directory in /home/mydomain/public_html/includes/application_top.php on line 41 Fatal error: require() [function.require]: Failed opening required 'includes/configure.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/mydomain/public_html/includes/application_top.php on line 41
MrPhil Posted September 17, 2009 Posted September 17, 2009 First of all, are you sure you should be including/requiring an "index.php" file? Those files are generally written to "own" the page and be the main driver. Files that are included or required are usually just snippets of code to set some variables or do some small chunk of code. What exactly are you trying to do? Your PHP include_path may need to be updated (in php.ini file) to look in the proper directory for "includes/configure.php". When the error occurs, it is in "/home/mydomain/public_html/includes/", running "application_top.php". It wants to bring in "includes/configure.php", and the available include_paths are ".", "/usr/lib/php", and "/usr/local/lib/php". "." will try to look for "/home/mydomain/public_html/includes/includes/configure.php", and the other two paths don't even come close. You might need to add "/home/mydomain/public_html" to the path list to get it to work.
♥kymation Posted September 17, 2009 Posted September 17, 2009 Sorry, I didn't understand that you were trying to include the osCommerce index.php into another file. That won't work the way you are doing it because osCommerce expects all of its include files to be in a specific directory in relation to the base file. You're changing the base file location (the file that you are adding your include to is now the base file) so that relation no longer holds. You can still do this, but it will need some work. You'll need to put your new main file in the same folder as the osCommerce index.php that you are trying to include. If that new file is also named index.php, rename the osCommerce index.php and change its name in includes/filenames.php. Your include should now work. If you can't do that, please post some more information on the directory structure you have and why you need it that way. Regards Jim See my profile for a list of my addons and ways to get support.
ken b Posted September 17, 2009 Author Posted September 17, 2009 Hey MrPhil Thanks for the suggestion I actually resolved the issue by using Curl instead like this <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://mydomain.com/"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); ?>
Recommended Posts
Archived
This topic is now archived and is closed to further replies.