Page 1 of 1
PHP installation/path issues
Posted: Fri Jun 29, 2007 9:34 am
by Natas007
I work for a medium sized company and we have decided to host our website internally from now on. The transfer is in the preliminary stages. Most of the site is static html but there are a couple of php pages. I've installed php 5.2.1 (ISAPI for IIS) and made sure php is registered within IIS but I'm having no luck loading the pages. Below is the error I'm receiving when trying to load...Main.php is the page I'm trying to load and I can post code if needed:
PHP Warning: include(/websites/html/frstcapital.com/WEB-INF/classes/phpmvc/utils/ClassPath.php) [function.include]: failed to open stream: No such file or directory in C:\Web\www.firstcapital.com\HTML\Main.php on line 55 PHP Warning: include() [function.include]: Failed opening '/websites/html/frstcapital.com/WEB-INF/classes/phpmvc/utils/ClassPath.php' for inclusion (include_path='.;C:\php5\pear') in C:\Web\www.firstcapital.com\HTML\Main.php on line 55 PHP Warning: include(/websites/html/frstcapital.com/WEB-INF/GlobalPaths.php) [function.include]: failed to open stream: No such file or directory in C:\Web\www.firstcapital.com\HTML\Main.php on line 58 PHP Warning: include() [function.include]: Failed opening '/websites/html/frstcapital.com/WEB-INF/GlobalPaths.php' for inclusion (include_path='.;C:\php5\pear') in C:\Web\www.firstcapital.com\HTML\Main.php on line 58 PHP Fatal error: Class 'GlobalPaths' not found in C:\Web\www.firstcapital.com\HTML\Main.php on line 59
Any help would be appreciated....Thank you!!
Posted: Fri Jun 29, 2007 9:58 am
by volka
Looks like your php app has e.g. a configuration file where you have to set some paths.
Main.php code
Posted: Mon Jul 02, 2007 3:11 pm
by Natas007
feyd | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Code: Select all
/* ---------- Application Paths ---------- */
// Set php.MVC library root directory
$appServerRootDir = '/websites/html/frstcapital.com'; // no trailing slash
// Set the application path
$moduleRootDir = '/websites/html/frstcapital.com'; // no trailing slash
/* ---------- Application Paths ---------- */
// Setup the application specific ActionDispatcher (RequestDispatcher)
$actionDispatcher = 'ActionDispatcher';
// Set the OS Type [Optional] [UNIX|WINDOWS|MAC] if we have
// trouble detecting the server OS type. Eg: path errors.
$osType = '';
// Relative path to the phpmvc configuration files
$configPath = './WEB-INF'; // no trailing slash
// Setup application class paths first
include $appServerRootDir.'/WEB-INF/classes/phpmvc/utils/ClassPath.php';
// Setup the app server paths
include $appServerRootDir.'/WEB-INF/GlobalPaths.php';
$globalPaths = GlobalPaths::getGlobalPaths();
$gPath = ClassPath::getClassPath($appServerRootDir, $globalPaths, $osType);
// Setup the module paths
// Note: In standalone modules, these paths will be in ModulePaths.php file
// Eg: "kooka/WEB-INF/ModulePaths.php"
$subAppPaths = array();
$subAppPaths[] = 'WEB-INF/classes/firstcapital';
$subAppPaths[] = 'WEB-INF/classes/firstcapital/action';
$subAppPaths[] = 'WEB-INF/classes/firstcapital/configRules';
$mPath = ClassPath::getClassPath($moduleRootDir, $subAppPaths, $osType);
$cPath = ClassPath::concatPaths($gPath, $mPath, $osType);
// And set the 'include_path' variables, as used by the file functions
ini_set('include_path', $cPath);
define('CLASSPATH', True);
$globalPrependFiles = $appServerRootDir.'/WEB-INF/globalPrepend.php';
include_once $globalPrependFiles;
include_once $actionDispatcher.'.php';
$start = FileUtils::utime();
// Startup configuration information for an php.MVC Web app
$appServerConfig = new AppServerConfig;
$appServerContext = new AppServerContext;
$appServerContext->setInitParameter('ACTION_DISPATCHER', $actionDispatcher);
$appServerConfig->setInitParameter('mapping', 'ActionMappingXXX');
$appServerConfig->setAppServerContext($appServerContext);
// Setup the php.MVC Web application controller
$actionServer = new ActionServer;
// Load Application Configuration
$oApplicationConfig = '';
$bootUtils = new BootUtils;
$oApplicationConfig = $bootUtils->loadAppConfig($actionServer, $appServerConfig,
$configPath);
if($oApplicationConfig == NULL) {
exit;
}
// Setup HTTP Request and add request attributes
$request = new HttpRequestBase;
$request->setAttribute(Action::getKey('APPLICATION_KEY'), $oApplicationConfig);
$request->setRequestURI($_SERVER['PHP_SELF']);
// Note: $_REQUEST was introduced in 4.1.0. There is no
// equivalent array in earlier versions.
$actionID = 'do';
if($_REQUEST != '') {
// Retrieve the 'action path'. Eg: index.php?do=[logonForm]
$doPath = BOOTUtils::getActionPath($_REQUEST, $actionID);
} else {
// kill !!!
}
// See: RequestProcessor->processPath(...) !!!
// <action path = "/stdLogon" ...> => "LogonAction"
// Note: We should catch any dodgy 'do=badHackerFile' path hacks
// in RequestProcessor->processMapping(...)
$request->setAttribute('ACTION_DO_PATH', $doPath);
// Setup HTTP Response and add request attributes
$response = new HttpResponseBase;
// Start processing the php.MVC Web application
// Note: Usage of depreciated $HTTP_POST_VARS type variables
// will be eventually replaced with the new PHP Superglobals.
// Eg: $_GET, $_POST, $_FILES. See: PHP manual- Predefined Variables
// Note: Consider ALL input data as tainted (insecure). All inputs should be
// checked for correctness and valid character/numeric ranges.
// Eg: "username "=> "^[a-z0-9]{8}$". See: /classes/DemoForm.php
if( isset($HTTP_SERVER_VARS['CMDLINE']) ) {
$request->setMethod('POST');
$actionServer->doPost($request, $response,
$HTTP_POST_VARS, $HTTP_POST_FILES);
} else {
if( $HTTP_SERVER_VARS['REQUEST_METHOD'] == 'GET' ) {
$actionServer->doGet($request, $response,
$HTTP_GET_VARS);
} elseif( $HTTP_SERVER_VARS['REQUEST_METHOD'] == 'POST' ) {
$actionServer->doPost($request, $response,
$HTTP_POST_VARS, $HTTP_POST_FILES);
}
}
$end = FileUtils::utime();
$run = $end - $start;
//echo substr($run, 0, 5) . " secs.";
feyd | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Posted: Mon Jul 02, 2007 3:13 pm
by Natas007
Just in case the title wasn't noticed...my last post is all of the code contained in Main.php...the file that is throwing the error in my initial post.
Re: Main.php code
Posted: Mon Jul 02, 2007 3:39 pm
by volka
Natas007 wrote:/* ---------- Application Paths ---------- */
// Set php.MVC library root directory
$appServerRootDir = '/websites/html/frstcapital.com'; // no trailing slash
// Set the application path
$moduleRootDir = '/websites/html/frstcapital.com'; // no trailing slash
/* ---------- Application Paths ---------- */
you have to provide the new valid paths here.
New Error
Posted: Thu Jul 05, 2007 9:10 am
by Natas007
Thank you very much!! That definitely got me further. I'm now receiving the below error...the local valid path to the site is C:\Web\www.firstcapital.com\HTML.
tcapital.com\HTML\Main.php on line 80 PHP Fatal error: Class 'FileUtils' not found in C:\Web\www.firstcapital.com\HTML\Main.php on line 81
Posted: Thu Jul 05, 2007 10:43 am
by superdezign
Have you included the file that holds the class 'FileUtils?'
File Path
Posted: Thu Jul 05, 2007 5:42 pm
by Natas007
FileUtils.php is in C:\Web\www.firstcapital.com\HTML\WEB-INF\classes\phpmvc\utils. I tried modifying the $appServerRootDir path but obviously that wasn't it because it didn't work. What do I need to modify? Thx again for all of you help.
Posted: Thu Jul 05, 2007 6:29 pm
by superdezign
You have to include the class prior to making the object of that class.
Including FileUtils
Posted: Mon Jul 09, 2007 9:30 am
by Natas007
This was the exact code that is currently functional on our production site that is hosted externally. I wouldn't think that I would have to modify the code...but if I need to include this class, where should I do it and what should the syntax look like? Thx.
Posted: Mon Jul 09, 2007 9:37 am
by superdezign
$Appserverconfig
Posted: Tue Jul 10, 2007 9:54 am
by Natas007
This seems to be one thing after another. I've added the include statement for FileUtils.php and it doesn't seem to be erroring out on that line anymore but now its something else...of course. The current error is...
tcapital.com\HTML\Main.php on line 81 PHP Fatal error: Class 'AppServerConfig' not found in C:\Web\www.firstcapital.com\HTML\Main.php on line 86
Line 81...(this line is directly above where FileUtils is called)
include_once $actionDispatcher.'.php';
Line 86...
$appServerConfig = new AppServerConfig;
Any ideas??? Thx!
Posted: Tue Jul 10, 2007 10:57 am
by superdezign
It means that it's going to take more than just the FileUtils file to be included. Every class must be defined before you can use it, which requires that you include the class file for every class that you use.