0

I have just installed propel orm and done the setting, but after including the lib/propel.php file, it couldn't find the propel.php file, here is my code

<?php
$projectPath = realpath( dirname( __FILE__ ) . DIRECTORY_SEPARATOR. '..');
$modelPath = $projectPath . "/model/classes";
// Include the man Propel script
require_once $projectPath . '/propel/lib/Propel.php';

// Initialie Propel with the runtime configuration
Propel::init('model/conf/ehm-conf.php');

// Add the generated 'classes' directory to the include path
//set_include_path("model/classes" . PATH_SEPARATOR . get_include_path());
set_include_path($modelPath . PATH_SEPARATOR . get_include_path());
?>

and here is my error output

[client 127.0.0.1] PHP Warning: require_once(C:\Apache Software Foundation\Apache2.2\htdocs/propel/lib/Propel.php) [function.require-once]: failed to open stream: No such file or directory in C:\Apache Software Foundation\Apache2.2\htdocs\ehm\propel_init.php on line 5 [Tue Nov 12 22:54:42 2013] [error] [client 127.0.0.1] PHP Fatal error: require_once() [function.require]: Failed opening required 'C:\Apache Software Foundation\Apache2.2\htdocs/propel/lib/Propel.php' (include_path='.;C:\php\pear') in C:\Apache Software Foundation\Apache2.2\htdocs\ehm\propel_init.php on line 5

kero
  • 10,647
  • 5
  • 41
  • 51
user1496307
  • 15
  • 1
  • 10

2 Answers2

0

Well your error message is clear enough : file "C:\Apache Software Foundation\Apache2.2\htdocs/propel/lib/Propel.php" was not found. So just check in which path is stored propel and set this path in your code.

Test if $projectPath contains the good path

var_dump($projectPath);
Raphaël Malié
  • 3,912
  • 21
  • 37
  • why is it showing double backward slash line "require_once(C:\\Apache Software Foundation\\Apache2.2\\htdocs\\ehm\\propel\\lib/../stubs/functions.php)" how can i make it have only one forward slash, i think that might be the issue why it is not seeing the path correctly. the propel.php is in propel/lib folder. it exist – user1496307 Nov 13 '13 at 20:14
  • There is now a troubleshooting checklist for this frequent error here : stackoverflow.com/a/36577021/2873507 – Vic Seedoubleyew Apr 12 '16 at 16:45
0

You appear to be looking for this:

propel/lib/Propel.php

when I think in fact you want this:

propel/runtime/lib/Propel.php

I'm assuming here you're using the 1.6.x branch, and not the new 2.0.x alpha.

halfer
  • 19,824
  • 17
  • 99
  • 186
  • director where my Propel.php is ehm/propel/lib. i copy the lib folder into propel folder i created in my ehm project folder. should i copy all the runtime contents into the propel folder? – user1496307 Nov 15 '13 at 19:30
  • That would probably work - so long as you can reliably point to "Propel.php", and everything below that level stays the same, Propel should be able to find everything it needs for runtime operation. Personally I just add _everything_ in the Propel project to a "vendors/propel" directory - I use a git submodule, although I understand Composer is the preferred approach these days. – halfer Nov 15 '13 at 21:16
  • 1
    There is now a troubleshooting checklist for this frequent error here : stackoverflow.com/a/36577021/2873507 – Vic Seedoubleyew Apr 12 '16 at 16:45