Warning: require_once(): http:// wrapper is disabled in the server configuration by allow_url_include=0
The warning is generated because you are using a full URL for the file that you are including. This is NOT the right way because this way you are going to get some HTML from the webserver. Use:
require_once('../web/a.php');
so that webserver could EXECUTE the script and deliver its output, instead of just serving up the source code (your current case which leads to the warning).
require_once(): http:// wrapper is disabled in the server configuration by allow_url_include=0
index.php is not included at all, this is the entry point to PHP code execution and it is defined in your webserver config (not really precise, but should give you an idea).
The PHP file you want to include, is it on the same server? If so, you need to include it by its filename, and not by its URL. I understand you want to include another PHP file which is part of your theme.
I don't know much about wordpress and what helper functions it defines, but this seems to be the one you need to use: https://developer.wordpress.org/reference/functions/get_template_directory/.
If it is not placed an the same server, then you just should not do this.
Warning: require_once(): http:// wrapper is disabled
Never mind I just found the answer. Took me a total of 5 hours to figure this out. I guess I should have held off on posting the question here a little longer.
The answer:
<?php
$include = get_pages('include=154');
$content = apply_filters('the_content',$include[0]->post_content);
echo $content;
?>
http:// wrapper is disabled in the server?
From the PHP docs on include
:
If "URL include wrappers" are enabled in PHP, you can specify the file to be included using a URL (via HTTP or other supported wrapper - see Supported Protocols and Wrappers for a list of protocols) instead of a local pathname. If the target server interprets the target file as PHP code, variables may be passed to the included file using a URL request string as used with HTTP GET. This is not strictly speaking the same thing as including the file and having it inherit the parent file's variable scope; the script is actually being run on the remote server and the result is then being included into the local script.
By obvious inference, you are supposed to use a local pathname!
Change this line
<?php include("http://localhost/ubergallery/multiple_image_upload/upload.php"); ?>
to this
<?php include($_SERVER['DOCUMENT_ROOT']."/ubergallery/multiple_image_upload/upload.php"); ?>
The reason that allow_url_include=On
doesn't work is because you probably didn't restart your Apache server after changing your php.ini
get around allow_url_include=0 error
You're using a full URL as you include path, which tells PHP to attempt to do an HTTP request to fetch that file. This is NOT how you do this. Unless that ...100/index.php
outputs PHP code, you are going to get some HTML or whatever as the include result, NOT the php code in the file. Remember - you're fetching via URL, which means it's an HTTP request, which means the webserver will EXECUTE that script and deliver its output, not simply serve up its source code.
There's no way for the webserver to tell that the HTTP request for that script is an include call from another PHP script on the same server. It could just as easily be a request for that script from some hacker hiding in Russia wanting to steal your source code. Do you want your source code visible to the world like this?
For local files, you should never use a full-blown url. it's hideously inefficient, and will no do what you want. why not simply have
include('/path/to/templates/100/index.php');
instead, which will be a local file-only request, with no HTTP stage included?
Warning: include(): http:// wrapper is disabled in the server configuration
Dont use plugins_url. Try this:
include plugins_dir_path("/imp-file/admin/partials/imp-file-admin-
display.php");
Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by all
First, check your PHP file with this code and then enable the fopen in your php.ini file
<?php
if( ini_get('allow_url_fopen') ) {
die('allow_url_fopen is enabled. file_get_contents should work well');
} else {
die('allow_url_fopen is disabled. file_get_contents would not work');
}
?>
Edit the php.ini file and enable using below code
allow_url_fopen = 1 //0 for Off and 1 for On Flag
Related Topics
How to Display an Blob Image Stored in MySQL Database
Sent Mails with PHPmailer Don't Go to "Sent" Imap Folder
Why PHP Iteration by Reference Returns a Duplicate Last Record
Laravel Checking If a Record Exists
Doctrine - How to Print Out the Real SQL, Not Just the Prepared Statement
Accessing an Associative Array by Integer Index in PHP
Codeigniter: Try Catch Is Not Working in Model Class
PHP Simple Foreach Loop with HTML
A Recursive Remove Directory Function for PHP
Sending Mail with PHP & Escaping Hotmails Junk Folder
Reflectionexception: Class Classname Does Not Exist - Laravel
Laravel Compact() and ->With()
How Are Associative Arrays Implemented in PHP
Get Last Modified File in a Directory
In MVC, Where Do You Draw the Line Between a Controller and Model