Fatal error: Uncaught exception 'UnexpectedValueException' with message
'DirectoryIterator::__construct(/modules) [<a href='directoryiterator.--construct'>directoryiterator.--construct</a>]:
failed to open dir: No such file or directory' in
/home/www/zf/library/Zend/Controller/Front.php:289 Stack trace:
#0 /home/www/zf/library/Zend/Controller/Front.php(289): DirectoryIterator->__construct('/modules')
#1 /home/www/zf/library/Zend/Application/Resource/Frontcontroller.php(72): Zend_Controller_Front->addModuleDirectory('/modules')
#2 /home/www/zf/library/Zend/Application/Bootstrap/BootstrapAbstract.php(683): Zend_Application_Resource_Frontcontroller->init()
#3 /home/www/zf/library/Zend/Application/Bootstrap/BootstrapAbstract.php(626): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('frontcontroller')
#4 /home/www/zf/library/Zend/Application/Bootstrap/BootstrapAbstract.php(586): Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap(NULL)
#5 /home/www/zf/library/Zend/Application.php(355): Zend_Application_Boot in /home/www/zf/library/Zend/Controller/Front.php on line 292
That is the error I'm getting. I have checked all the paths and looks like its all correct. I have no clue what this error is all about. Please help.
This is my index.php
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/home/www/mf/application'));
//path for public
defined('PUBLIC_PATH')
|| define('PUBLIC_PATH', realpath(dirname(__FILE__) . '/home/www/iops.axeleron.biz'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/home/www/zf/library'),
get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/home/www/mf/application/configs/application.ini'
);
$application->bootstrap()
->run();
Your APPLICATION_PATH looks wrong. If you're happy hardcoding it, you probably want:
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', '/home/www/mf/application'));
Apply the same change to the PUBLIC_PATH line below as well.
Generally you don't want to hardcode paths though, and what you probably had before was:
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
which should still work. This works out the application path using the path to the current file.
Thank you everyone for the response. I solved the problem myself. My server needs to have hardcoded path everywhere, so I made those changes in config and index.php and its working like a charm.
Thanks for all your help!...
Related
I am trying to change the path of index.php.
I have a boot strap zend structure.
So I created a new folder named newapp, its path is root path where our index.php lies.
Then I copied the index.php to newapp so that I can load the application from newapp directory.
But problem is that I can't load configuration file from index.php that I copied. It thorws error which is given below.
Fatal error: Uncaught exception 'Zend_Config_Exception' with message
'parse_ini_file(E:\xampp\htdocs\..../configs/application.ini) [<a href='function.parse-
ini-file'>function.parse-ini-file</a>]: failed to open stream: No such file or directory'
in E:\xampp\htdocs\ZendFramework-1.12.0\library\Zend\Config\Ini.php:182
Note my folder structure
- trunk
- index.php
- application
- bootstrap.php
- configs
- config.ini
- newapp
- index.php (copy of above)
My actual index.php is given below
<?php
ini_set('memory_limit', '-1');
set_time_limit(0);
defined('BASE_PATH')|| define('BASE_PATH', realpath(dirname(__FILE__)));
define('APPLICATION_PATH', BASE_PATH . '/application');
set_include_path('../../library1.12.0/'. get_include_path());
require_once 'Zend/Loader/Autoloader.php';
$loader = Zend_Loader_Autoloader::getInstance();
$loader->setFallbackAutoloader(true);
defined('APPLICATION_ENV')|| define('APPLICATION_ENV',(getenv
('APPLICATION_ENV') ? getenv('APPLICATION_ENV'): 'staging_mysql'));
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap();
$application->run();
What should I change in index.php ?
I tried change the path of config file as
APPLICATION_PATH . '/../../configs/application.ini'
but didn't work
- Zend library is available beacuse I have set path variable to it from
enviornment variable settings of windows.
I tried this also realpath(dirname(__FILE__))."/.."
But application is not loaded.
try adding
set_include_path(
APPLICATION_PATH.'/../library1.12.0'.PATH_SEPARATOR.
APPLICATION_PATH.'/../library1.12.0/Zend'
);
defined('BASE_PATH') || define('BASE_PATH', realpath(dirname(__FILE__)));
define('APPLICATION_PATH', BASE_PATH . '/application');
set_include_path('../../library1.12.0/'. get_include_path());
Should be this in newapp/index.php with the lines below
defined('BASE_PATH')|| define('BASE_PATH', realpath(dirname(__FILE__)));
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', BASE_PATH . '/../../application');
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library1.12.0'),
get_include_path()
)));
NOTE:
folder 'library1.12.0' shoould be in application folder level and Zend folder should be inside it. Hope this will help you, i have tested it and its working.
After hosting my website, I had some configuration issues.
Warning: require_once (Zend/application.php) [function.require-once]: failed to open stream: No such file or directory in //www/***.com/public/index.php on line 22
I placed the Zend Framewotk library in www/library
www/application/
www/library/ <--- Zend Framework
www/public/
but after the addition of library another problem occurs:
HTTP Error 500 (Internal Server Error): An unexpected condition has occurred while the server was attempting to fulfill the request.
Script of public/index.php
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
defined('TMP_PATH')
|| define('TMP_PATH', realpath(APPLICATION_PATH . '/../tmp/'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
APPLICATION_PATH . '/models',
APPLICATION_PATH . '/models/generated',
get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
->run();
$application->bootstrap()->run(); does nothing Comeback
Do you have a .htaccess configured corretly for that new hosting?
Error 500 is normally a server error, try to take a look in the
.htaccess.
Cheers,
Hugo
Warning: require_once (Zend/application.php) [function.require-once]: failed to open stream: No such file or directory in //www/*.com/public/index.php on line 22
At first glance, it seems like a case-sensitivity issue: note the lowercase a in Zend/application.php.
However, your public/index.php seems to contain the correct:
require_once 'Zend/Application.php'
and the correct instantiation
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
so there would be no need for the autoloader to try and load a class with the lower-case a.
Have you faithfully copied/pasted all the errors and code? Or might there be a transcription error in there somewhere?
I get the following error when I try to run the project created by Zend Framework. Its looking for Zend/Application.php and that is available in the directory that is in my include_path. I do have read permissions on the directory.
PHP Fatal error: require_once() [function.require]:
Failed opening required 'Zend/Application.php'
(include_path='/var/www/vhosts/moderncloud.net/om/library:.:/var/www/vhosts/moderncloud.net/om
/library:') in /var/www/vhosts/moderncloud.net/om/public/index.php on
line 24
<?php
// Define path to application directory
//defined('APPLICATION_PATH')
// || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', dirname(__FILE__) . '/../application');
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
('/var/www/vhosts/moderncloud.net/om/library'),
get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
->run();
SOLUTION:
I found it myself today. Its a problem with the option
"php_admin_value open_basedir" in my httpd configuration. I set it to
none and it started working. Alternatively, I guess I can append the Zend library
directory to the open_basedir option in my web server configuration instead of setting it to none.
Can you try replacing:
set_include_path(implode(PATH_SEPARATOR, array(
('/var/www/vhosts/moderncloud.net/om/library'),
get_include_path(),
)));
with
$siteRootDir = dirname($_SERVER['DOCUMENT_ROOT']);
set_include_path(
$siteRootDir . '/library' . PATH_SEPARATOR
. $siteRootDir . '/application' . PATH_SEPARATOR
. get_include_path()
);
Hope it works for you
If possible, remove the existing zend framework installation and install ZF using PEAR. It will be easier to update later on:
pear channel-discover zend.googlecode.com/svn
pear install zend/zend
It will also use PEAR's include_path, so it should solve your problem.
If you can't use pear, try to use relative path with your include path:
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
This problem generated due to :
Inside Public folder in index.php file.
or
Inside library folder :- Just check in library folder there is a folder of Zend present in library folder or not.If not present zend folder then download from zend framework and save in library folder.
=> In index.php copy the following code and replace it.
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
/** Zend_Application */
//require_once 'Zend/Application.php';
require_once 'library/Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
->run();
I'm trying to move my zend application from local to remote.After I uploaded all of my folders on my GoDaddy host this is my folders structure :
/html
/application
/configs
/controllers
/models
/views
bootstrap.php
/library
/public
/css
/images
/js
.htaccess
index.php
my index.php :
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH',realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV')|| define('APPLICATION_ENV',
(getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV'): 'production'));
//add library directory to include path
set_include_path(implode(PATH_SEPARATOR, array(
dirname(dirname(__FILE__)) . '/library',dirname(dirname(__FILE__)) .
'/application/models',dirname(dirname(__FILE__)) .
'/application/forms',dirname(dirname(__FILE__)) . '/application/views/scripts',
get_include_path())));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini');
$application->bootstrap()->run();
Now if I try to go type this URL : "www.mysite.com/public/index/index" I receive this error :
The requested URL /public/index/index/ was not found on this server.
Additionally, a 404 Not Found error was encountered while trying
to use an ErrorDocument to handle the request.
And if I just type : "www.mysite.com/public/" I receive this warning :
Warning: require_once(/home/content/66/6902756/html/application/Bootstrap.php
[function.require-once]: failed to open stream: No such file or directory
in /home/content/66/6902756/html/library/Zend/Application.php on line 320
Fatal error: require_once() [function.require]: Failed opening
required '/home/content/66/6902756/html/application/Bootstrap.php'
(include_path='/home/content/66/6902756/html/application/../library:
/home/content/66/6902756/html/library:
/home/content/66/6902756/html/application/models:
/home/content/66/6902756/html/application/forms:
/home/content/66/6902756/html/application/views/scripts:
.:/usr/local/php5/lib/php')
in /home/content/66/6902756/html/library/Zend/Application.php on line 320
In local everything was working properly
UPDATE
In my index.php I tried :
//it output "exists"
echo file_exists( '/home/content/66/6902756/html/application/Bootstrap.php' )?'exists':'no file found';
//where '/home/content/66/6902756/html' is my absolute hosting path
thanks
I'll wager that a major part of your problem is that you're using \ in your include path. Try replacing those with the constant DIRECTORY_SEPARATOR. Personally, I would get rid of all of those dirname(dirname(__FILE__)). Instead use the built in APPLICATION_PATH:
set_include_path(implode(PATH_SEPARATOR, array(
dirname( APPLICATION_PATH ) . DIRECTORY_SEPARATOR . 'library', //note one exception
APPLICATION_PATH. DIRECTORY_SEPARATOR . 'models',
APPLICATION_PATH. DIRECTORY_SEPARATOR . 'forms',
APPLICATION_PATH. DIRECTORY_SEPARATOR . 'views'. DIRECTORY_SEPARATOR .'scripts',
get_include_path())));
I shifted the site from shared server to dedicated server but the site is not working correctly. I am getting the error as "Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with message 'The PDO extension is required for this adapter but the extension is not loaded' in ";
Result for:
if (extension_loaded('pdo') and extension_loaded('pdo_mysql')) {
print "Success";
} else {
print "Failure";
}
is also false.
------Index File------
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
->run();
Link of the site: http://voxsun.com
phpinfo of site: http://voxsun.com/public/info.php
Thanks,
Lalit
In the first line of your phpinfo() we can read:
'./configure' '--disable-pdo'
Well, it's self-explanatory.
If you compiled PHP yourself, I really advise you to use your package manager to do so (aptitude, yum, etc.), it'll ease your system upgrade and avoid you to compile it hand each time you need to update PHP.
Do it only if you've very good reasons.
From the you're info.php ... Configure Command './configure' '--disable-pdo' so put it simple, php wasn't compiled with pdo in mind .
One option would be to try and load the extensions manualy in public/index.php at the start of you're script ( i don't expect it to work but it's worth giving it a try ) :
dl('pdo.so');
dl('pdo_mysql.so');
PHP: dl - Loads a PHP extension at runtime