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
Related
I want to call my zend-framework model and use there functions in AuthenticationControllerTest.php but I am getting error when i run it from terminal.
- -MyZendproject
- -application
-model
-testmodel
- +public
- -tests
- aplication
- controller
- .AuthenticationControllerTest.php
Here is my AuthenticationControllerTest.php file
<?php
require_once `PHPUnit/Framework/TestCase.php`;
defined(`APPLICATION_PATH`)
|| define(`APPLICATION_PATH`, realpath(dirname(__FILE__) . `/../application`));
// Define application environment
defined(`APPLICATION_ENV`) || define(`APPLICATION_ENV`, `tests`);
// 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`;
$application = new Zend_Application(
APPLICATION_ENV,
realpath(APPLICATION_PATH .`configs/application.ini`)
);
class AuthenticationControllerTest extends PHPUnit_Framework_TestCase
{
public function testLoginRetriespLogin() {
$testmodel = new Model_testmodel_Object();//my model
}
}
but when run it from terminal "phpunit AuthenticationControllerTest" it give me error:
$ phpunit AuthenticationControllerTest
..FPHP Fatal error: Class 'Model_testmodel_Object' not found in /var/www/versioned/pm160form/tests/application/controllers/AuthenticationControllerTest.php on line 146
Looks like your test suit folder is not resolving towards the actual application folder. See how you have
|| define(`APPLICATION_PATH`, realpath(dirname(__FILE__) . `/../application`));
but your dirname is currently pointing to the test/application/controller directory which, of course, does not have your actual application. Try pointing the application folder that is under the top root instead,
|| define(`APPLICATION_PATH`, realpath(dirname(__FILE__) . `/../../../application`));
Also, take care to follow the standard of using PHP Unit in Zend Framework as described at http://framework.zend.com/manual/1.12/en/zend.test.phpunit.html . The framework needs to be fully bootstraped before the autoloader can work.
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!...
I'm experiencing a problem with my 'include' path on my fresh install of Zend framework. i'm running Ubuntu and using Netbeans. I installed Zend via the terminal and I have copied the appropriate files to my new project.
I am currently getting this while attempting to access localhost/demoZend/public
Warning: require_once(Zend/Application.php): failed to open stream: No such file or directory in /home/mastered/public_html/demoZend/public/index.php on line 18
Fatal error: require_once(): Failed opening required 'Zend/Application.php' (include_path='/home/mastered/public_html/demoZend/library:.:/opt/lampp/lib/php') in /home/mastered/public_html/demoZend/public/index.php on line 18
I have copied the 'Zend' folder with the framework into my project/library folder so the folder structure is /demoZend/library/Zend/
I have also changed the 'include' path in my php.ini from the advice of a tutorial. however this is where I have things confused.
The path reads:
include_path = ".:/usr/share/php:/usr/share/php/libzend-framework-php/"
in my apache2/php.ini aswell as my /etc/php5/cli/php.ini file.
My index.php file in my project reads as thus:
<?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();
I haven't changed that as the file paths seem ok.
I should also point out I have my web documents stored in my '~/public_html' directory, I have checked the permissions on my 'demoZend/library' folder and they have all restrictions off.
It sounds like you're following a tutorial for Zend Framework 1, but you've downloaded Zend Framework 2. There is no Zend/Application.php in ZF2, so that's why PHP isn't finding the file.
You can either head back to the ZF downloads page and grab the latest release of ZF1 (currently 1.12.3), or find a ZF2 tutorial and learn ZF2 instead. If you're just getting started with ZF, I'd go with the latter option.
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();