CakePHP showing include_once warnings - php

Suddenly, this website stop working and this errors appeared:
Warning: include_once(///controllers/site/default.php) [function.include-once]: failed to open stream: No such file or directory in /var/www/html/sitename.com/web/index.php on line 54
Warning: include_once() [function.include]: Failed opening '///controllers/site/default.php' for inclusion (include_path='.:/usr/share/pear') in /var/www/html/sitename.com/web/index.php on line 54
I don't know how CakePHP works, this is why I need help to figure out what happened (without anyone messing the code). The indicated files, that says that they're not there (No such file or directory), are exactly where the path describes.
I appreciate any help!
Error from line 54 in index.php:
include_once sprintf('%s/%s%s/%s.php', ROOT_PROJECT, CONTROLLERS_DIR, $url->tipo, 'default');

I believe the problem lies in the variables inserted through sprintf.
There are some empty ones causing a lot of backslashes to be added to the string;
Basically it says
include('///controllers/site/default.php');
(This is also visible in the generated php warning)
Try catching empty variables or parsing the resulting string (making sure only 1 backslash exists between every parameter).
If I'm right the next php command should work:
include('/controllers/site/default.php');
Hope this helps.

Related

Weird PHP fatal error with one letter change

We recently started having this problem; really odd.
The error code is:
[15-Nov-2018 13:29:50 UTC] PHP Warning:
require(blasses/class-woocommerce-product-finder-widget.php): failed
to open stream: No such file or directory in
/home/naturesp/public_html/shop/wp-content/plugins/woocommerce-product-finder/woocommerce-product-finder.php
on line 73
The file hasn't been changed, so we assumed it was a caching error - but deactivating and deleting caching plugins led to no change. So we're at a loss.
It happens randomly on different plugins. They are usually the same line within each plugin however, and never more than 2 at once.
It just changes one letter to 'blasses' or 'dlasses' from 'classes' or similar.
If anyone has any idea, would be amazing...

Can't access Front end in oscommerce

I am newbie in oscommerce. I have site which was crashed before some days and for start my site I restore database backup which is in Godaddy.
Now the problem is that I can't access my front end but I can access back end properly.
whenever I try to access front page then its displayed Blank page.
Anybody have idea why its happening?
When I turn on error reporting then I got following errors
Warning: require(includes/languages/affiliate.php) [function.require]: failed to open stream: No such file or directory in /home/content/17/10028317/html/includes/affiliate_application_top.php on line 72
Fatal error: require() [function.require]: Failed opening required 'includes/languages/affiliate.php' (include_path='.:/usr/local/php5/lib/php') in /home/content/17/10028317/html/includes/affiliate_application_top.php on line 72
As steve said your are missing a file. The missing file is affiliate.php wich should be stored in 'includes/languages/', please check to have it.
To my knowledge languages files should be kept insead in 'includes/languages/yourlanguagefolder/'
You might have either a mistake in your config.php file or in the script 'includes/affiliate_application_top.php' in this case path for language file could be wrong in require function

include_once being ignored

Okay.
So on line 37 on this script http://ideone.com/grapQ the include_once command is basically just being ignored and the content I am trying to show is not showing up at all, not even a error message.
I tried enabled error reporting and not one a single error is being shown.
Also i tried using Echo and the same issue persist.
Does anyone have any ideas on why its being ignored and not even a error message is being shown? More than luck just its just something basic!
You are missing a semi-colon on the end of that include statement:
include_once('http://outside-resources.ultimatesphider.com/us-resources/2.0.1/2.0.1announce.php');
Additionally, when I tested it (just that line) here on my local machine, I got the following errors:
Warning: include_once(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /var/www/test.php on line 5
Warning: include_once(http://outside-resources.ultimatesphider.com/us-resources/2.0.1/2.0.1announce.php): failed to open stream: no suitable wrapper could be found in /var/www/test.php on line 5
Warning: include_once(): Failed opening 'http://outside-resources.ultimatesphider.com/us-resources/2.0.1/2.0.1announce.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/test.php on line 5
Deepak's answer has more information on allowing external files that probably applies to your question.
You cannot include remote files as it is in PHP 5.2.0 and later versions. If you want to use remote URL allow_url_include must be enabled for these. Refer Link
follow the link
http://php.net/manual/en/function.include-once.php

PHP: weird usort bug

Everything works fine on my local machine. But when uploading this piece of code to my live server I'm getting a weird warning ...
usort($modules, array('util_SortItem', 'ByOrder'));
Causes this warning:
Warning: include_once(sc3lycp6hmyab.php) [function.include-once]: failed to open stream: No such file or directory in /opt/www/xxx/web/private/Zend/Loader.php on line 146
Warning: include_once() [function.include]: Failed opening 'sc3lycp6hmyab.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /opt/www/xxx/web/private/Zend/Loader.php on line 146
When I remove the usort from my code the warnings disapear.
Any ideas on how I can get rid of this warning?
This has nothing to do with the usort, but with the ByOrder method of the Util_SortItem class that you are telling usort() to call.
You should take a look into the file where that class is defined to see what it does to trigger the error.
One possibility is that it tries to include a class that doesn't exist, which triggers Zend's Autoloader; the other that Zend is trying to create some sort of cache file.
To me it looks like those spammer names. I'd guess it's not related whatsoever. I think you might have something unescaped in your application and it results in someone trying to exploit it ;)
I haven't been able to sort out the isue but I got rid of it by merging two queries and sorting on my SQL server.

Troubleshooting PHP Login connection

I have encountered a problem that I have not come accross yet when setting up a log in page using php.
The page has a error message that relates to line 1 ( require_once('../Connections/Login.php)
that states
[function.require-once]: failed to open stream: No such file or directory
Fatal Error: require_once() [function.require]: failed opening required ... (include_path='.:/usr/share/pear-php5')
I know it is probably really simple and stupid, but I'm really struggling to self-troubleshoot and would really value some help please?
This is where I have been so confused. I also thought the same, that it just couldn't find the file; however the structure is just as you have said:
htdocs/comparison.php (the log in page)
htdocs/Connections/connComparisonLogin.php
Sorry this is going to confuse you, I simplified the actual script in my original question and here is the actual error message:
Warning: require_once(../Connections/connComparisonLogin.php) [function.require-once]: failed to open stream: No such file or directory in /home/fhlinux135/s/suzukigenuine.com/user/htdocs/comparison.php on line 1
Fatal error: require_once() [function.require]: Failed opening required '../Connections/connComparisonLogin.php' (include_path='.:/usr/share/pear-php5') in /home/fhlinux135/s/suzukigenuine.com/user/htdocs/comparison.php on line 1
Have I done it all wrong?
I think your require statement should be:
require_once 'Connections/connComparisonLogin.php';
Where is your "Connections/Login.php" relative to the currrent php file.
php will look for the file relative to the current file, or, in one of the directories specified in the "include_path" php.ini setting.
The error just means php can't find the Login.php file. Assuming the page you are calling is index.php you should have a director structure like
-Dir1
|-index.php
-Connections
|-Login.php
Why are you going up a directory in your require statement? Remove the "../" from the beginning of your require_once path.

Categories