Jump to content

PHP5 include problem


jojo80

Recommended Posts

I'm having a problem with PHP5 include and require functions

I can't include any file in my script

for example

config.php

-------------------

<?php

echo "we are in config<br />";

?>

 

index.php

---------------------

<?php

include("config.php");

echo "we are in index<br />";

?>

 

the output will be:

we are in index

 

the two scripts are in the same directory

error reporting is turned on

php give no error nor warning,

it just ignores any include,require statement

 

If I delete the php.ini and restart the server, the include works fine, so I think it has something to do with PHP configuration, but I could not find anything in php.ini that relates to this problem

 

PHP Version 5.2.2

 

any idea how to solve this?

thanks

Link to comment
Share on other sites

Try to take a look at the following section in php.ini and check the presence of the "." (current directory) in the include path variable.

 

;;;;;;;;;;;;;;;;;;;;;;;;;

; Paths and Directories ;

;;;;;;;;;;;;;;;;;;;;;;;;;

 

; UNIX: "/path1:/path2"

;include_path = ".:/php/includes"

;

; Windows: "\path1;\path2"

include_path = ".;c:\php\includes"

Link to comment
Share on other sites

thanks for the reply, here is part of my php.ini.... the dot is there

 

;;;;;;;;;;;;;;;;;;;;;;;;;

; Paths and Directories ;

;;;;;;;;;;;;;;;;;;;;;;;;;

 

; UNIX: "/path1:/path2"

;include_path = ".:/php/includes"

;

; Windows: "\path1;\path2"

include_path = ".;c:\php\includes"

 

; The root of the PHP pages, used only if nonempty.

; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root

; if you are running php as a CGI under any web server (other than IIS)

; see documentation for security issues.  The alternate is to use the

; cgi.force_redirect configuration below

doc_root = 'c:\Server\www'

 

; The directory under which PHP opens the script using /~username used only

; if nonempty.

user_dir =

 

; Directory in which the loadable extensions (modules) reside.

extension_dir = "./"

 

; Whether or not to enable the dl() function.  The dl() function does NOT work

; properly in multithreaded servers, such as IIS or Zeus, and is automatically

; disabled on them.

enable_dl = On

 

; cgi.force_redirect is necessary to provide security running PHP as a CGI under

; most web servers.  Left undefined, PHP turns this on by default.  You can

; turn it off here AT YOUR OWN RISK

; **You CAN safely turn this off for IIS, in fact, you MUST.**

; cgi.force_redirect = 1

 

; if cgi.nph is enabled it will force cgi to always sent Status: 200 with

; every request.

; cgi.nph = 1

 

; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape

; (iPlanet) web servers, you MAY need to set an environment variable name that PHP

; will look for to know it is OK to continue execution.  Setting this variable MAY

; cause security issues, KNOW WHAT YOU ARE DOING FIRST.

; cgi.redirect_status_env = ;

 

; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI.  PHP's

; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok

; what PATH_INFO is.  For more information on PATH_INFO, see the cgi specs.  Setting

; this to 1 will cause PHP CGI to fix it's paths to conform to the spec.  A setting

; of zero causes PHP to behave as before.  Default is 1.  You should fix your scripts

; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.

; cgi.fix_pathinfo=1

 

; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate

; security tokens of the calling client.  This allows IIS to define the

; security context that the request runs under.  mod_fastcgi under Apache

; does not currently support this feature (03/17/2002)

; Set to 1 if running under IIS.  Default is zero.

; fastcgi.impersonate = 1;

 

; Disable logging through FastCGI connection

; fastcgi.logging = 0

 

; cgi.rfc2616_headers configuration option tells PHP what type of headers to

; use when sending HTTP response code. If it's set 0 PHP sends Status: header that

; is supported by Apache. When this option is set to 1 PHP will send

; RFC2616 compliant header.

; Default is zero.

;cgi.rfc2616_headers = 0

 

Link to comment
Share on other sites

include_path = ".;c:\php\includes"

Try to comment this line. (Add ";" in front of it) If still won't work you should try using the default php.ini configuration or you could try getting a new php package and using it instead of the one you're using now.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.