473,385 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

URL file-access error when generating a php file with file_put_contents()

bugboy
160 100+
Hi, I'm using PHP to create and save new .php pages using:

Expand|Select|Wrap|Line Numbers
  1. file_put_contents("photo/".$name."/index.php",$file);
the page saves ok but I get this error when i go there:

Warning: require_once() [function.require-once]: URL file-access is disabled in the server configuration in /home/html/new/photo/_MG_1166/index.php on line 5

If I copy the new files content and create a new php file with it manually it works. Does "file_put_contents" set some kind of permissions that don't allow "file access"?

Is there a way to dynamically create new php pages?

Thanks,

Bug boy
May 19 '11 #1

✓ answered by JKing

This is likely because allow_url_fopen and allow_url_include are set to off. This is default in recent versions of PHP.

The reason for it being turned off is that it can cause a major security issue by allowing remote file inclusion.

2 2716
bugboy
160 100+
Ok, have you ever chased an error for 8 hours then realized you had the wrong path all along. As it turns out the require_once function in the new page had the wrong path duh.

I'm not sure why the error says "URL file-access is disabled" - that really through me off and cost me a day.

Thanks for reading.
May 20 '11 #2
JKing
1,206 Expert 1GB
This is likely because allow_url_fopen and allow_url_include are set to off. This is default in recent versions of PHP.

The reason for it being turned off is that it can cause a major security issue by allowing remote file inclusion.
May 20 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Bill | last post by:
I have a string (holding a book title) that contains an apostrophe. This is generating an error when I try to pass it through sql into a table of orders. I retrieve it from the form with ...
3
by: Mike Kennedy | last post by:
I have an XML Snippet <?xml version="1.0" encoding="UTF-8"?> and when I convert the entire xml file to a DOM and then generate a new file from the DOM, results in <?xml version="1.0"?>. Any...
4
by: Michael Kennedy [UB] | last post by:
Hi Everyone, I have this multithreaded C# windows forms application which does a lot of image processing. Occasionally, I get the following error: A generic error occurred in GDI+....
4
by: Doug R | last post by:
Hello, I could use a little help from you Gurus out there. I have an aplication that watches a directory and detects when a PGP encrypted file lands in the directory and starts a process that...
6
by: Thomas Connolly | last post by:
I have 2 pages referencing the same codebehind file in my project. Originally the pages referenced separate code behind files. Once I changed the reference to the same file, everything worked...
6
by: Chad Crowder | last post by:
Getting the following error on my production server whether the file exists or not: "System.IO.IOException: Cannot create a file when that file already exists." Here's the code generating the...
5
by: Nathan Sokalski | last post by:
I am trying to write code to allow my users to upload a file. The code I am using is as follows: Dim upfilename As String = "" If fileDetails.Value <> "" AndAlso...
0
by: reidarT | last post by:
Ugyldig på toppnivået av dokumentet. Feil under behandling av ressursen file:///C:/VB/WebBrowser/WebBrowserControl/TESTFILE... "<?xml version=""1.0""?>","<XMLTest>" ^FileOpen(1,...
1
by: ReidarT | last post by:
The former post was wrong, the lines where concatenated so here it goes again. I am wrriting to a file (XML-format) and using FileOpen(1, "C:\vb\WebBrowser\WebBrowserControl\TESTFILE.XML",...
11
by: ririe | last post by:
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\Inovasi\get_file.php:2) in C:\xampp\htdocs\Inovasi\get_file.php on line 40 Warning: Cannot...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.