Jump to content

Recommended Posts

Hello, I am new to the forum and do not have a whole lot of experience with coding.

 

I was asked to manage the website for the company I work for. The website needed updating, in particular pricing for the products we sell.

 

The way I was taught to update the site was to select a product. At the bottom of each product page there is a link to "Update product".

 

Typically the first time I use the link, it asks me to log in, and then it takes me to an administrative page where I can change information for the product.

 

I was working on it all day, when towards the end of the day I received this error message once I finished updating a product:

 

Fatal error: require_once(): Failed opening required './Connections/ccgifts.php' (include_path='.:/usr/share/pear:/usr/share/php53/pear') in /webroot/c/r/creat031/primary/www/cms/index.php on line 1

 

It seems like it is telling me to add the include_path on line one of my index.php. And I have, but then I get error messages like this:

 

Parse error: syntax error, unexpected T_STRING in /webroot/c/r/creat031/primary/www/cms/index.php on line 1

 

Please help! Usually after clicking on updating the product it takes me to the main Administrative page on what seems to be the back end of the website. Now it just gives me error messages.

 

Thanks in advance for your help!

Link to comment
https://forums.phpfreaks.com/topic/269324-require_once-help/
Share on other sites

The (include_path='.:/usr/share/pear:/usr/share/php53/pear') part of the error message is just informational, it is letting you know what the include path is at the point in time when PHP tried to find that file. It's not telling you to add it to your script or change it.

 

The issue is that for some reason PHP is unable to open the requested file. Either it can't be found (wrong path, or maybe deleted) or there is a permissions problem.

 

The first step is to make sure the file exists. My guess would be PHP is expecting to find it at /webroot/c/r/creat031/primary/www/cms/Connections/ccgifts.php

Link to comment
https://forums.phpfreaks.com/topic/269324-require_once-help/#findComment-1384336
Share on other sites

oh boy. now the homepage of the website is showing up as a blank page. it doesn't read any errors or anything like before.

 

thoughts on how to fix? did all the syntax/parse errors from before cause this??

 

Also the code from line one is:

<?php require_once('Connections/ccgifts.php'); ?>

Link to comment
https://forums.phpfreaks.com/topic/269324-require_once-help/#findComment-1384822
Share on other sites

The "white page" syndrome is a clear indication on a fatal PHP error, with error reporting turned off. Which it should be, on a production server. You'll find the error messages in the error log.

 

However, in this case I'm pretty sure we know the problem already, and it's the problematic require_once () statement; It will throw a fatal error if it can't include the specified file. There are no parse or syntax errors in either file, or PHP would have told you so.

As Kicken already told you, PHP cannot find/read the file in question. You state that you've verified that the file is located in the defined folder, and that it exists. I don't know if you've verified if the web server has read-access to it (permissions should be 644 in the FTP client, normally), but it never hurts to double-check.

Another thing that you should verify, is that the filenames are cased exactly the same. On Windows upper and lower case letters in the path and/or filename doesn't matter, but on other operating systems (like Linux) they are treated as two different characters. That's why I, and many others, recommend keeping file and folder names lower-case only.

Link to comment
https://forums.phpfreaks.com/topic/269324-require_once-help/#findComment-1384984
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.