[PHP] require/include fails with APC enabled
I have one server that is acting up whenever I try to enable APC. PHP scripts execute normally as long as there are no calls to include(), include_once(), require(), or require_once(). Any file (no matter the size) that can be included while APC is disabled will cause the script to silently fail at the point of include when APC is enabled. There is no output in the PHP error_log, even when logging all message types. This feels like it's probably a really simple fix, but we're stumped. Any help you can provide would be greatly appreciated. Server software combinations: PHP 5.2.9 with APC 3.0.18 and ZTS PHP 5.2.6+lenny3 with APC 3.1.2 PHP 5.2.6+lenny3 with APC 3.0.18 Apache 2.2.9 in all cases APC is configured for pthread mutex locks. mmap disabled.
RE: [PHP] require/include from a different directory
If the includes are within the website, using $_SERVER[DOCUMENT_ROOT]/pathtofile/file is a good way to go. -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED] Sent: Saturday, March 29, 2003 2:10 PM To: 'Greg Macek'; [EMAIL PROTECTED] Subject: RE: [PHP] require/include from a different directory > > try using an absolute path. > > I've considered that route, but an issue I have with that is I do most > of my development work on a machine that a different directory structure > than the production server (currently a Cobalt RaQ4), so the paths are > different. Accommodating both would be a time consuming project for me. I always put it into a variable. $_CONF['path'] = '/home/web/www/'; and then use that variable in all of your includes or requires. I also make an HTML variable that's used in all links and images. $_CONF['html'] = 'http://www.mysite.com/'; Sure, you have to get used to using this variable everywhere, but it makes switching server pretty easy. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] require/include from a different directory
The call to include() must be relative to one of the directories listed in open_basedir, regardless of which file the call is made from. Usually the dir mentioned in open_basedir is the docroot, so in your case require "include/inc_file.php"; should work from any file, in any folder. - Original Message - From: "Greg Macek" <[EMAIL PROTECTED]> Newsgroups: php.general To: <[EMAIL PROTECTED]> Sent: Saturday, March 29, 2003 3:37 PM Subject: Re: [PHP] require/include from a different directory > It seems I have found my problem. It has to do with the files I'm trying > to include. They also include other files and the directories it's > trying to include files from aren't working. I've found a workaround for > my situation for the time being. It's not pretty, but functional. > > On Sat, 2003-03-29 at 14:19, Greg Macek wrote: > > Hi, > > > > I'm having a problem hopefully can be easily answered. I'm trying to > > organize parts of my site into different directories so that they're all > > not in the "main" folder so to speak; basically breaking out by what > > part of the application it is. I also have an "include" folder for all > > my main functions and such... > > > > / (main directory) > > /include (global functions, includes) > > /app_sect1 > > /app_sect2 > > > > what I'm trying to do from /app_sect1 is include a file from the > > "include" directory, but with little success. The line looks like this: > > > > require "../include/inc_file.php"; > > > > But my page just doesn't work for me now.. any ideas what I'm missing? > > > > - Greg > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] require/include from a different directory
> > try using an absolute path. > > I've considered that route, but an issue I have with that is I do most > of my development work on a machine that a different directory structure > than the production server (currently a Cobalt RaQ4), so the paths are > different. Accommodating both would be a time consuming project for me. I always put it into a variable. $_CONF['path'] = '/home/web/www/'; and then use that variable in all of your includes or requires. I also make an HTML variable that's used in all links and images. $_CONF['html'] = 'http://www.mysite.com/'; Sure, you have to get used to using this variable everywhere, but it makes switching server pretty easy. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] require/include from a different directory
I've considered that route, but an issue I have with that is I do most of my development work on a machine that a different directory structure than the production server (currently a Cobalt RaQ4), so the paths are different. Accommodating both would be a time consuming project for me. On Sat, 2003-03-29 at 14:47, Jason Paschal wrote: > try using an absolute path. > > > > > > > >From: Greg Macek <[EMAIL PROTECTED]> > >To: [EMAIL PROTECTED] > >Subject: [PHP] require/include from a different directory > >Date: 29 Mar 2003 14:19:41 -0600 > > > >Hi, > > > >I'm having a problem hopefully can be easily answered. I'm trying to > >organize parts of my site into different directories so that they're all > >not in the "main" folder so to speak; basically breaking out by what > >part of the application it is. I also have an "include" folder for all > >my main functions and such... > > > >/ (main directory) > >/include (global functions, includes) > >/app_sect1 > >/app_sect2 > > > >what I'm trying to do from /app_sect1 is include a file from the > >"include" directory, but with little success. The line looks like this: > > > >require "../include/inc_file.php"; > > > >But my page just doesn't work for me now.. any ideas what I'm missing? > > > >- Greg > > > > > > > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > > > > > _ > Help STOP SPAM with the new MSN 8 and get 2 months FREE* > http://join.msn.com/?page=features/junkmail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] require/include from a different directory
It seems I have found my problem. It has to do with the files I'm trying to include. They also include other files and the directories it's trying to include files from aren't working. I've found a workaround for my situation for the time being. It's not pretty, but functional. On Sat, 2003-03-29 at 14:19, Greg Macek wrote: > Hi, > > I'm having a problem hopefully can be easily answered. I'm trying to > organize parts of my site into different directories so that they're all > not in the "main" folder so to speak; basically breaking out by what > part of the application it is. I also have an "include" folder for all > my main functions and such... > > / (main directory) > /include (global functions, includes) > /app_sect1 > /app_sect2 > > what I'm trying to do from /app_sect1 is include a file from the > "include" directory, but with little success. The line looks like this: > > require "../include/inc_file.php"; > > But my page just doesn't work for me now.. any ideas what I'm missing? > > - Greg > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] require/include from a different directory
Hi, I'm having a problem hopefully can be easily answered. I'm trying to organize parts of my site into different directories so that they're all not in the "main" folder so to speak; basically breaking out by what part of the application it is. I also have an "include" folder for all my main functions and such... / (main directory) /include (global functions, includes) /app_sect1 /app_sect2 what I'm trying to do from /app_sect1 is include a file from the "include" directory, but with little success. The line looks like this: require "../include/inc_file.php"; But my page just doesn't work for me now.. any ideas what I'm missing? - Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] require & include
http://www.php.net/manual/en/function.require.php require() pulls in the target file when the source file is parsed/compiled, include() pulls in the target file when the source file is executed. So an include() nested in an if statement will only be included if the if statement evaluates to true, a require() nested in an if statement will be included regardless. Also check out include_once() and require_once(). -Steve On Monday, October 22, 2001, at 05:15 PM, jtjohnston wrote: > Coverting from perl ... > What's the differencw between require and include? Where, when, why? > > John? > > > Email post & reply always appreciated > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] require & include
Coverting from perl ... What's the differencw between require and include? Where, when, why? John? Email post & reply always appreciated -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]