jojo80 Posted February 11, 2008 Share Posted February 11, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/90475-php5-include-problem/ Share on other sites More sharing options...
aschk Posted February 11, 2008 Share Posted February 11, 2008 Post your php.ini file here, because until you do we can't tell you what settings you have wrong. Quote Link to comment https://forums.phpfreaks.com/topic/90475-php5-include-problem/#findComment-463853 Share on other sites More sharing options...
cedre Posted February 11, 2008 Share Posted February 11, 2008 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" Quote Link to comment https://forums.phpfreaks.com/topic/90475-php5-include-problem/#findComment-463855 Share on other sites More sharing options...
jojo80 Posted February 11, 2008 Author Share Posted February 11, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/90475-php5-include-problem/#findComment-463862 Share on other sites More sharing options...
cedre Posted February 11, 2008 Share Posted February 11, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/90475-php5-include-problem/#findComment-463903 Share on other sites More sharing options...
wildteen88 Posted February 11, 2008 Share Posted February 11, 2008 Just download the zipped binaries package from php.net and copy the php.ini-recommended file from the zip file. Rename it php.ini (overwriting/deleting your existing one) and configure PHP to your liking. Retest your script. Quote Link to comment https://forums.phpfreaks.com/topic/90475-php5-include-problem/#findComment-464102 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.