include_once being ignored - php

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

Related

CakePHP showing include_once warnings

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.

getting error while uploading on server

I am developing opencart application , i installed in on localhost ,and customize it but now i am trying to upload it to server but it get error
Warning: require_once() [function.require-once]: http:// wrapper is
disabled in the server configuration by allow_url_include=0 in
/home/content/29/9716229/html/johndhan/telhemboradz/index.php on line
17
Warning:
require_once(http://249development.us/johndhan/telhemboradz/system/startup.php)
[function.require-once]: failed to open stream: no suitable wrapper
could be found in
/home/content/29/9716229/html/johndhan/telhemboradz/index.php on line
17
Fatal error: require_once() [function.require]: Failed opening
required
'http://249development.us/johndhan/telhemboradz/system/startup.php'
(include_path='.:/usr/local/php5_3/lib/php') in
/home/content/29/9716229/html/johndhan/telhemboradz/index.php on line
17
You need to use paths for your files not HTTP url's. Open your config.php file and admin/config.php file and change
http://249development.us/
to
/home/content/29/9716229/html/
for all of the paths except for those that start HTTP_ or HTTPS_ in the define's
It seems that you are trying to include a remote file via HTTP. If this is intentionally the case, then you need to enable the http:// wrapper - as suggested by the warning you are getting. If this is not the case, then consider removing the URL http://249development.us/ from the require_once statements.

PHP Error when posting RSS feed data

I'm trying to post a blog to my website. I downloaded Simplepie and followed the directions on the website, but I keep getting these errors. Being new to PHP, I'm not exactly sure what they mean. Any help?
Warning: require_once() [function.require-once]: URL file-access is disabled in the server configuration in /hermes/bosweb/web177/b1775/ipg.waldropcom/php/test.php on line 7
Warning: require_once(http://www.waldrop.com/php/autoloader.php) [function.require-once]: failed to open stream: no suitable wrapper could be found in /hermes/bosweb/web177/b1775/ipg.waldropcom/php/test.php on line 7
Fatal error: require_once() [function.require]: Failed opening required 'http://www.waldrop.com/php/autoloader.php' (include_path='.:/usr/local/lib/php-5.2.17/lib/php') in /hermes/bosweb/web177/b1775/ipg.waldropcom/php/test.php on line 7
Probably your application trying to include a remote file but it's failing. You need to enable allow_url_fopen and allow_url_include settings in php.ini to require or include remote files.

PHP Cron Problems - using plesk: dynamic library, open_basedir

I entered the following command through plesk (control panel) crontab, to run a php file once an hour:
php httpdocs/cron/script.php
And I am getting the following 2 error messages (once an hour, to my email):
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/http.so' -
/usr/lib/php/modules/http.so: cannot open shared object file: No such file or directory in
Unknown on line 0
PHP Warning: require_once(): open_basedir restriction in effect.
File(../include/functions.php) is not within the allowed path(s):
(/var/www/vhosts/basedomain.com:/tmp) in /var/www/vhosts/example.com/httpdocs/cron/script.php
on line 2
PHP Warning: require_once(../include/functions.php): failed to open stream: Operation not
permitted in /var/www/vhosts/example.com/httpdocs/cron/script.php on line 2
PHP Fatal error: require_once(): Failed opening required '../include/functions.php'
(include_path='.:') in /var/www/vhosts/example.com/httpdocs/cron/script.php on line 2
Note: Line 2 has require_once(../include/functions.php);
I realized these are 2 different issues. I tried solving each separately and they are both still with me. Any help would be appreciated. Thanks
When you run PHP like this, configuration set in Plesk-specific and Apache-specific places like vhost.conf doesn't apply.
Since your script is already inside httpdocs, why don't you just use wget/curl to invoke the script through HTTP? Something like /usr/bin/curl http://yoursite.com/cron/script.php 2>&1. Might want to consider some additional validation (IP limiting, htpasswd auth) to make sure random visitors (script kiddies) can't run it.
Please check below, maybe it will help you.
http://www.geeklog.net/forum/viewtopic.php?showtopic=28107

Two Errors trying to include .php file: Warning: require(...) AND Fatal error: require() ... (include_path='.;C:\php\pear')

Here is the first error:
Warning: require(/hb/includes/constants.php) [function.require]: failed to open stream: No such file or directory in C:\wamp2\www\hb\includes\connection.php on line 2
And the second error that immediately follows:
Fatal error: require() [function.require]: Failed opening required '/hb/includes/constants.php' (include_path='.;C:\php\pear') in C:\wamp2\www\hb\includes\connection.php on line 2
Here is the line that it doesn't like:
require("/hb/includes/constants.php");
I did install a new version of WAMP, but I know the directories/files are fine and the code worked previously and on another server. It seems like none of my require()'s are working anymore. I tried looking around and some suggested to others that they edit their php.ini, but I don't know what directory I would point to - if you can't tell I'm pretty noobish regarding all things server related.
Any help is appreciated.
First of all, are your really -- really ! -- sure that the file /hb/includes/constants.php, that your are trying to include, exists ?
Considering that the path you requested begins with a /, it looks like you're using an absolute path... that looks like an UNIX path, but you are on a Windows server...
If it exists, and PHP still cannot include it, check :
that it is readable by your webserver (including the directories) -- I'm thinking about UNIX permissions
that there is no open_basedir restriction that would prevent PHP from accessing those files.
BTW, having a warning and a fatal error is the behavior that's to be expected when using require : the warning is normal (it comes from include) ; and the fatal error is the difference between include and require.

Categories