Solved

php security allow_url_include: use cURL() instead?

Posted on 2012-03-31
2
816 Views
Last Modified: 2012-08-13
Hi,

I'm wondering how I would use the curl() in place of something of this code:

require_once('root.php');
require_once(ROOTFORM.'/classes/class.mysql.php');

Open in new window


where root.php is:
    define("ROOTCLASSES", "http://localhost/seokh/co_seokh/seokh/classes/form");
    define("ROOTFORM", "http://localhost/seokh/co_seokh/seokh/test/trunk/jquery/form

Open in new window

");

I receive this warning:
Warning: require_once(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /usr/local/apache/htdocs/seokh/co_seokh/seokh/test/trunk/jquery/form/saveName.php on line 3

This page says to use curl for remote file access:
http://phpsec.org/projects/phpsecinfo/tests/allow_url_include.html

Should I be using curl or something else instead of include() or require()? If so, could you give me some code samples of, perhaps, what you use?

Thank you,
Victor
0
Comment
Question by:Victor Kimura
2 Comments
 
LVL 10

Accepted Solution

by:
acbxyz earned 500 total points
ID: 37791044
require_once needs a local path, nothing starting with http://

This can be either relative (like ./path/to/class.php) or absolute (/var/www/path/to/class.php). Keep in mind windows uses backslashes while linux normal ones. The preset constant DIRECTORY_SEPARATOR has always the right one.

define('DS', DIRECTORY_SEPARATOR);
define('ROOTFORM', '..' . DS . 'jquery' . DS . 'form' . DS);

require_once(ROOTFORM . 'classes' . DS . 'class.mysql.php');
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 37793080
I don't believe you need CURL at all.  Your script needs to include a local file, so HTTP is irrelevant.  The file is already on your server.  The real question is, "Where is your file relative to your script that needs it?"  It might be as simple as this:
require_once('/classes/class.mysql.php');

Open in new window

0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question