I built a small website using Joomla 3.4.0./ Wampserver 2.4 on Windows 8.1 Pro.
Now I've upgraded the computer to Windows 10 Pro and Wamp 3.1.7 (64 bit). I've rebuilt the website with latest version of Joomla 3.9.3 from scratch, and its working fine EXCEPT all those custom modules which access the user object. I havent changed anything yet. I'm getting error as below:
( ! ) Warning: require_once(C:/wamp64/www\includes\defines.php): failed to open stream: No such file or directory in C:\wamp64\www\clib\custom\CreateNewAcc.php on line 9
Call Stack
# Time Memory Function Location
1 0.0162 404168 {main}( ) ...\CreateNewAcc.php:0
( ! ) Fatal error: require_once(): Failed opening required 'C:/wamp64/www\includes\defines.php' (include_path='.;C:\php\pear') in C:\wamp64\www\clib\custom\CreateNewAcc.php on line 9
Call Stack
# Time Memory Function Location
1 0.0162 404168 {main}( ) ...\CreateNewAcc.php:0
Each of my custom code files such as 'CreateNewAcc.php' begin like this:
<?php
#uncomment in joomla
$mf1="";
define( '_JEXEC', 1 );
define( 'DS', DIRECTORY_SEPARATOR );
define( 'JPATH_BASE', $_SERVER[ 'DOCUMENT_ROOT' ] );
require_once( JPATH_BASE . DS . 'includes' . DS . 'defines.php' );
require_once( JPATH_BASE . DS . 'includes' . DS . 'framework.php' );
require_once( JPATH_BASE . DS . 'libraries' . DS . 'joomla' . DS . 'factory.php' );
$mf1 = JFactory::getApplication('site');
date_default_timezone_set("Asia/Calcutta");
$user = JFactory::getUser();
$uname=$user->name;
$uid=$user->id;
$date= JFactory::getDate();
?>
What I have tried:
I've checked the location of defines.php & CreateNewAcc.php files, they're ok. Earlier site was in the root of www folder, now its in a folder of its own named 'elib' within www.
I've tried to get rid of the back-slashes by making following changes:
require_once( JPATH_BASE . '/clib/' . 'includes' . '/' . 'defines.php' );
require_once( JPATH_BASE . '/clib/' . 'includes' . '/' . 'framework.php' );
require_once( JPATH_BASE . '/clib/' . 'libraries' . '/' . 'joomla' . '/' . 'factory.php' );
Now I'm having this error:
( ! ) Warning: require_once(C:/wamp64/www\libraries/import.legacy.php): failed to open stream: No such file or directory in C:\wamp64\www\clib\includes\framework.php on line 15
Call Stack
#
Time
Memory
Function
Location
1 0.0013 403944 {main}( ) ...\CreateNewAcc.php:0
2 0.0014 405552 require_once( 'C:\wamp64\www\clib\includes\framework.php' ) ...\CreateNewAcc.php:10
( ! ) Fatal error: require_once(): Failed opening required 'C:/wamp64/www\libraries/import.legacy.php' (include_path='.;C:\php\pear') in C:\wamp64\www\clib\includes\framework.php on line 15
Call Stack
#
Time
Memory
Function
Location
1 0.0013 403944 {main}( ) ...\CreateNewAcc.php:0
2 0.0014 405552 require_once( 'C:\wamp64\www\clib\includes\framework.php' ) ...\CreateNewAcc.php:10