Url File-access Is Disabled In The Server Configuration

free web hosting
Free Web Hosting > Astahost > Hosted Members Support > Misc. Issues with no other forum

Url File-access Is Disabled In The Server Configuration

turbopowerdmaxsteel
As per the php documentation:-

CODE
// Won't work; looks for a file named 'file.php?foo=1&bar=2' on the
// local filesystem.
include 'file.php?foo=1&bar=2';

// Works.
include 'http://www.example.com/file.php?foo=1&bar=2';


So, I used the following code to include the header.php file which I use to draw the top navigation menu on my site.

CODE
<? include "http://" . $_SERVER['HTTP_HOST'] . "/includes/header.php?d=../../" ?>


It worked before, but now I see the following errors on my page.

QUOTE

Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/ntek/public_html/products/pikabot/index.php on line 31

Warning: include(http://ntek.astahost.com/includes/header.php?d=../../) [function.include]: failed to open stream: no suitable wrapper could be found in /home/ntek/public_html/products/pikabot/index.php on line 31

Warning: include() [function.include]: Failed opening 'http://ntek.astahost.com/includes/header.php?d=../../' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ntek/public_html/products/pikabot/index.php on line 31


I suppose disabling URL file access was meant for security purposes. Is there any workaround?

 

 

 


Reply

pyost
Correct me if I am wrong, but you want to include a PHP file that will, depending on the d parameter, display some data. Instead of including a file along with the parameter (header.php?d=value), all you need to is execute include('header.php');, while having the value assigned to a certain variable.

A bit confusing? Maybe. Here's how the code would look:

CODE
<?php
// Some PHP code
$d = value;
include('header.php');
//More PHP code
?>


Since include means copying one file's contents to the current page, you would be able to use $d in header.php instead of $_GET['d']. That's at least how I do it.

Reply

vujsa
I'm not entirely sure that I understand you issue since what you are talking about doesn't really make any sense to me. sad.gif

If you include a file, you include ALL of it's contents into the script requesting it!
So, $foo and $bar don't need to be passed in the url!, you can set them as normal!

header.php:
CODE
<?php
if(isset($foo) && isset($bar)){
    $foobar = $foo + $bar;
    echo $foobar;
}
else{
    echo "You forgot to set Foo and Bar";
}
?>


index.php:
CODE
<?php
$foo = 2;
$bar = 3;
include('header.php');
?>


I think a better option for you would be to create a function for your header area! For best results, you should place all of your functions in a single include file and then call the functions as needed!

I will be happy to discuss this further in the PHP forums! As it is, I really don't see that the server should be reconfigured to allow your method of file inclusion.
There is a work around available for your issue at php.net if you wish to continue with this method of coding!

vujsa

 

 

 


Reply

turbopowerdmaxsteel
QUOTE(pyost @ Mar 14 2007, 04:33 AM) *
Correct me if I am wrong, but you want to include a PHP file that will, depending on the d parameter, display some data. Instead of including a file along with the parameter (header.php?d=value), all you need to is execute include('header.php');, while having the value assigned to a certain variable.

A bit confusing? Maybe. Here's how the code would look:

CODE
<?php
// Some PHP code
$d = value;
include('header.php');
//More PHP code
?>


Since include means copying one file's contents to the current page, you would be able to use $d in header.php instead of $_GET['d']. That's at least how I do it.


Sorry for the unclear clarification. I thought the example ought to make it clear. Anyways, what you've said is exactly what I want to do. I had no idea that variables are passed across files in such a fashion. Kinda, overrides the variable scope thingy we learn in the other programming languages, doesn't it? I was aware that such a thing could be done in the same file but still couldn't guess this comming.

QUOTE(vujsa @ Mar 14 2007, 05:54 AM) *
I'm not entirely sure that I understand you issue since what you are talking about doesn't really make any sense to me. sad.gif

If you include a file, you include ALL of it's contents into the script requesting it!
So, $foo and $bar don't need to be passed in the url!, you can set them as normal!

header.php:
CODE
<?php
if(isset($foo) && isset($bar)){
    $foobar = $foo + $bar;
    echo $foobar;
}
else{
    echo "You forgot to set Foo and Bar";
}
?>


index.php:
CODE
<?php
$foo = 2;
$bar = 3;
include('header.php');
?>


I think a better option for you would be to create a function for your header area! For best results, you should place all of your functions in a single include file and then call the functions as needed!

I will be happy to discuss this further in the PHP forums! As it is, I really don't see that the server should be reconfigured to allow your method of file inclusion.
There is a work around available for your issue at php.net if you wish to continue with this method of coding!

vujsa


My appologies to you too. I prefer to have different header files, more so because they contain a lot of plain HTML codes and having to resort to echo is really trecherous.

I wouldn't ask for server re-configuration either, just something that does the job.

Thank You guys, you were of tremendous help. smile.gif

Reply

Quatrux
You don't really need to resort your html code to echo or print if you program in a "good' way, here is an example how you can do it:

CODE
<?php

function print_header($array = NULL) {

?>

<html>
...
This is my HEADER!

<?php    
    
    }

# parse my Header
print_header();

?>


Furthermore, about the remote including, as Astahost is running on PHP5 now, there is a new option in the settings which doesn't exist on PHP4, even though allow_url_fopen is On by default on Astahost, the new setting allow_url_include is Off, and this is logical, a lot of people needs to open remote files and they don't want to have the inclusion for remote files, also this setting adds more security, due to there are a lot of novice php programmers, which lets their site include remote files through the get method, with this setting this will be impossible to do, they will get an error and no php code could be executed! It is recommended only to read the remote files and not to include anything. wink.gif

Reply

pyost
QUOTE(Quatrux @ Mar 14 2007, 07:25 AM) *
You don't really need to resort your html code to echo or print if you program in a "good' way, here is an example how you can do it:


You can do this in another way, which doesn't require opening PHP code (again) when you want to inserta variable:

CODE
<?php
// PHP code

$titleVariable = 'Untitled document';

$html = <<<EOF

<!-- Here you would put pure HTML code, but would also be able to add variable -->

<html>
<head>
<title> $titleVariable </title>
</head>
</html>

EOF;

echo $html;
?>

Reply

vujsa
Well, from a hosting support point of view, this issue has been resolved.
Closing topic. Please feel free to discuss it further in the PHP forum!

vujsa

Reply

iGuest
Replying to vujsaeasy add this line to "/php-bin/your php.Ini":
Allow_url_include = On

Best regardz
---

-reply by vodafogne

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Recent Queries:-
  1. url file configuration - 1.54 hr back. (1)
  2. cpanel url file-access is disabled in the server configuration - 5.22 hr back. (1)
  3. php5 url file-access is disabled - 13.44 hr back. (1)
  4. [function.include]: url file-access is disabled in the server configuration - 18.47 hr back. (1)
  5. html:: access a link to file on a server - 19.14 hr back. (1)
  6. url file-access is disabled in the server configuration in - 1.10 hr back. (5)
  7. "url file-access is disabled in the server configuration" - 20.31 hr back. (1)
  8. url file-access cpanel - 22.26 hr back. (1)
  9. getimagesize(): url file-access is disabled in the server configuration in (removed server info).php - 22.66 hr back. (3)
  10. url file-access is disabled in the server configuration - 3.38 hr back. (10)
  11. url file-access is disabled in the server config - 23.84 hr back. (1)
  12. warning: include() [function.include]: url file-access is disabled in the server configuration - 25.06 hr back. (1)
  13. set url file access php - 29.14 hr back. (1)
  14. php url access - 30.24 hr back. (2)
Similar Topics

Keywords : url, file, access, disabled, server, configuration

  1. Server Status Page Gone
    (1)
  2. File Types
    What File Type are allowed (7)
    Hi, can I know what file types are allowed because the FAQ is down. I need the .htc .sh for ADR
    RPG Mod for phpBB. xxxx-jozh-xxxx PS: If all are allowed, just say all file types allowed,
    don't stress yourself by typing every file type!....
  3. 123flashchat Server
    Startup Problem (0)
    I have been encountering several problems while attempting to use the 123FlashChat Server on my
    hosting account here at Astahost. (www.123flashchat.com) I tried to start the server by passing a
    command via the SSH Telnet utility on port 22, and received the following error- QUOTE
    omkar@gamma # ./fcserver.sh start Starting server ...... omkar@gamma # Error occurred during
    initialization of VM Could not reserve enough space for object heap I request Admins to look
    into the matter and respond to me. I need to start this service to my visitors as soon as p....
  4. AW Stats: Love em! Can't access them :(
    Love em! Can't access them! (4)
    Hi Guys, New to hosting here and SO HAPPY especially to see that you have AWStats. Had them at my
    old host and they are terrific! Can't believe how many features are offered here for FREE
    hosting /smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
    However, I didn't have to configure my AWSTATS at my old host so I don't know how. When I
    try to access the stats, I get the following error message: QUOTE Error: Couldn't open
    config file "awstats.welcometothefair.com.conf" nor "awstats.conf" after searching in pa....
  5. File Size Limits?
    Issue with SWF Files (2)
    I didn't see anything in the FAQ or with the search about filesizes, so I'll ask about it
    here: I have a radio.blog (for those of you who don't know what that is, it's a flash
    player that converts MP3 files into SWF's for faster streaming) and it's been acting up
    lately. I asked for help on the RB support forums, and someone suggested that it could be my
    host's filesize limit or non-permittance of certain filetypes. So my question is this - How big
    is too big for Astahost, and is there a problem with hosting SWF files? I'd say that most ....
  6. Cant Access My Account
    (1)
    ve uploaded all the files via FTP to my site but for some reason whever I try to view the pages in a
    browser it simply comes up with an error message. The only page I can get is the defaul AstaHost
    page you get when you first goto your site and havent made a new website to take its place? My url
    is: http://tazum.astaplace.com I should have a page at: http://tazum.astaplace.com/index.php
    But it wont work? I simply get this error message: Not Found The requested URL /index.php was not
    found on this server. Additionally, a 404 Not Found error was encountered whil....
  7. Is There Anyway To Get Telnet Access?
    (3)
    Is There Anyway To Get Telnet Access? Here is another crazy request. I would like to run the
    Entropy Search index builder every couple of days or so. Is there any way to schedule this as a
    CRON job?....
  8. Ssh Access - Could I Get It Back
    (0)
    I posted this to the requests forum a while ago but nothing happened... So I though to try here. I
    can't log on using SSH, so could I get it back enabled. I need SSH access for SCP file
    transfers. I'm FTPhobic.....
  9. Are Server Changes Being Made?
    (2)
    This afternoon I entered my site and got an SQL error, so I went to the cPanel and the phpMyAdmin is
    now green (it used to be blue). One of my tables could not be repaired so I dropped it then I
    recreated it and refilled from my backup copy, but I contined to have the same problem, so I dropped
    all the tables and did a reinstall. Now it is working again but there is one problem, When using the
    Firefox with the forums I get a prompt to enter data instead of just bolding or underlining or
    really anything like code or quote, and it will only take a limited amout of data int....
  10. Server Issues Again?
    (2)
    Anyone else having problems with having credit days and yet they can't access their site? Mine
    was fine til a couple minutes ago....another server hiccup, I guess.....
  11. Public Access To Subdirs In Public_html
    what is the security? (7)
    I know that subdirectories in public_html are accessible to the public on the web if you know their
    name (the name of the subdirectory). The question is whether there is any easy way to get at them
    if you do not know their name. Files in these subdirectories are conveniently accessible to you on
    the web, but how secure are they? Do web crawlers find them and make them accessible to a search
    even if they contain no html files?....
  12. Need Help With Music File
    need help on getting music file to work (11)
    I was wondering if anyone can please help me with uploading a music file. I got my first hosting
    package and logged in without a problem. So when i'm in my cpanel account I went under the
    section "Site management tools" then to "file manager" Then on the file manager I uploaded a music
    file. so now, i clicked on properties and then found the URL and when i tried playing the music
    file on another site, i cant hear any music?? is their some other step i need to do? or did i do
    something wrong??....
  13. Get Server Timeout Error Msg
    i try to update my site with frontpage (0)
  14. Is There A Max File Size Limit When Uploading?
    (4)
    I just tried uploading a 23 MB .wmp file. It started to upload but then after about 6 minutes a box
    popped up in the corner. It said "Page Cannot Be Displayed" so I tryed it again assuming there was
    an error, but I got the same thing. So I'm wondering if there is a file size limit or if there
    are file types that are restricted. I couldn't find this information anywhere else so I'd
    appreciate someone letting me know.....
  15. Installing Programs On The Server Via Cpanel
    (2)
    Hi I was wondering if I could install php applications on the Cpanel? SDK....
  16. Another e-mail question
    pop 3 access (7)
    Hi, I'm still trying to find out how I can get e-mail through my pop3 email client. Where can I
    find the pop3 server addr, smpt server addr and why not imap server addr. Please help me...:-)
    Brgds Jens....
  17. cpanel help file
    (0)
    hi, i'm not sure where to post this, but the cPanel theme is missing a link to the help file.
    The help file is located at http://stickboarder.info:2082/docs/cpanel/index.html or
    http://astahost.com:2082/docs/cpanel/index.html For everyone that doesn't understand cPanel,
    the help file is REALLY handy....

    1. Looking for url, file, access, disabled, server, configuration

Searching Video's for url, file, access, disabled, server, configuration
advertisement




Url File-access Is Disabled In The Server Configuration



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE