Partner and Community Forums
relative path after PHP upgrade
Last post Jul 18, 2017 03:44 PM by tippet
Jul 03, 2017 03:48 PM|tippet|LINK
running version php5.5 site load fine but after extracting php 7 to c:\php I get the error below
Warning: require(/common/php/scripts/noCache.inc): failed to open stream: No such file or directory in C:\inetpub\test\index2.php on line 2
Fatal error: require(): Failed opening required '/common/php/scripts/noCache.inc' (include_path='.;C:\php\pear') in C:\inetpub\test\index2.php on line 2
the site does have a common folder with the file it needs.
<?php require "/common/php/scripts/noCache.inc"; ?>
Jul 05, 2017 05:21 AM|HostingASPNet|LINK
You can use dirname(__FILE__) to get the absolute path of the directory where the current file resides.
require(dirname(__FILE__) . '/common/php/scripts/noCache.inc');
Jul 05, 2017 12:45 PM|tippet|LINK
Has something changed with the new PHP7? currently using the php.ini that was working under php5
if I modify the php from
<?php require "./common/php/scripts/noCache.inc"; ?>
it seems to work.
Jul 18, 2017 03:44 PM|tippet|LINK
unfortunately the dev guys don't want to modify their existing pages with new code. not sure what broke when the c:\php was replaced.