xcoaster1 Posted September 18, 2008 Share Posted September 18, 2008 I have a puzzeling situation that I cannot solve. After having our OS reinstalled, all our old PHP scripts are no longer retrieving the include or required files in the scripts. The OS is CentOS 5.2 and it seems when the sites subdomains listed under /var/www/vhosts/site.com/subdomains/domain.name/httpdocs/ cannot retrieve any files from outside that directory. This was working before the reload, which was in response to a hardware issue. The OS'es are the same and nothing has been adjusted. OS: CentOS 5 Web: Apache 2.2.3 PHP: PHP 5.2.6 MySQL: 5.0.58 PERL: 5.8.8 Link to comment https://forums.phpfreaks.com/topic/124800-includerequire-not-pulling-file/ Share on other sites More sharing options...
JasonLewis Posted September 18, 2008 Share Posted September 18, 2008 No errors are displayed? I cannot think of any reason, so try putting this at the top above where you include/require the file. ini_set("display_errors","1"); error_reporting(E_ALL); Link to comment https://forums.phpfreaks.com/topic/124800-includerequire-not-pulling-file/#findComment-644698 Share on other sites More sharing options...
nabeel21 Posted September 18, 2008 Share Posted September 18, 2008 I am not sure if I understand your concern, but if you are trying to access a remote file (that is not in folder "httpdocs") then: 1. edit php.ini and set allow_url_fopen setting to "on" 2. in your code use: <?php include 'http://www.example.com/file.php?foo=1&bar=2'; ?> More help here: http://us.php.net/manual/en/function.include.php Link to comment https://forums.phpfreaks.com/topic/124800-includerequire-not-pulling-file/#findComment-644703 Share on other sites More sharing options...
xcoaster1 Posted September 18, 2008 Author Share Posted September 18, 2008 I get an error now, not sure why it wasn't reporting prior and have checked the php.ini for the allow_url_fopen, which is on but still being refused: Warning: require() [function.require]: URL file-access is disabled in the server configuration in /var/www/vhosts/domain.tld/httpdocs/dev/events.php on line 86 Warning: require(http://www.domain.tld/dev/scripts/left_sidebar.php) [function.require]: failed to open stream: no suitable wrapper could be found in /var/www/vhosts/domain.tld/httpdocs/dev/events.php on line 86 Fatal error: require() [function.require]: Failed opening required 'http://www.domain.tld/dev/scripts/left_sidebar.php' (include_path='.:') in /var/www/vhosts/domain.tld/httpdocs/dev/events.php on line 86 I adjusted this to use require_once and include_once with the same results .. I am not sure what is going on since there are two php.ini files (on in /etc and one for Zend, both of which have the allow on). Link to comment https://forums.phpfreaks.com/topic/124800-includerequire-not-pulling-file/#findComment-644705 Share on other sites More sharing options...
JonnoTheDev Posted September 18, 2008 Share Posted September 18, 2008 Create a php page with the following code: print phpinfo(); View the page and the location of the php.ini will be displayed near the top. Remember you must restart the webserver after making changes to the ini file Link to comment https://forums.phpfreaks.com/topic/124800-includerequire-not-pulling-file/#findComment-644826 Share on other sites More sharing options...
xcoaster1 Posted September 18, 2008 Author Share Posted September 18, 2008 yup .. i checked and it's reading the normal /etc/php.ini .. also both files have allow_url_fopen=on .. I have restarted both Apache and the server (for another reason_) with no luck. Would this have anything to do with the chrooted environment on CentOS? Link to comment https://forums.phpfreaks.com/topic/124800-includerequire-not-pulling-file/#findComment-644860 Share on other sites More sharing options...
JonnoTheDev Posted September 18, 2008 Share Posted September 18, 2008 Is the URL that you are trying to include on your own webserver. allow_url_fopen is for incoming requests, not outgoing. If it is on your own server then why do you not use the full server path i.e. include("/var/www/html/domain.com/docs/sidebar.php"); Link to comment https://forums.phpfreaks.com/topic/124800-includerequire-not-pulling-file/#findComment-644864 Share on other sites More sharing options...
xcoaster1 Posted September 18, 2008 Author Share Posted September 18, 2008 Again, allow_url_fopen is on .. in both, however, when looking at the phpinfo, I see this: allow_url_fopen On On allow_url_include Off Off I cannot locate the allow_url_include in any of the ini files at all .. was this removed or renamed in 5.2? Link to comment https://forums.phpfreaks.com/topic/124800-includerequire-not-pulling-file/#findComment-644865 Share on other sites More sharing options...
JonnoTheDev Posted September 18, 2008 Share Posted September 18, 2008 Add it in or add the line in an .htaccess document php_flag allow_url_include on I would also disable SELINUX on the server as it is a pain in the arse Link to comment https://forums.phpfreaks.com/topic/124800-includerequire-not-pulling-file/#findComment-644868 Share on other sites More sharing options...
xcoaster1 Posted September 18, 2008 Author Share Posted September 18, 2008 FIXED .. looks like the new line for the allow_url_include on fixed the problem ... very odd however. Link to comment https://forums.phpfreaks.com/topic/124800-includerequire-not-pulling-file/#findComment-644871 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.