Is there a problem with a Zend framework site and windows web hosting?
Is there a problem with a Zend framework site and windows web hosting?
The web hosting guy at the company I work for said that there is a problem and the site will 开发者_如何学Conly work on a linux based hosting. He gave me the credentials and told me to try.
PHP5 using Zend framework and with some modifications on the index.php in the wamp server. (I programmed it on the wamp server 2 on my pc). Zend Studio if it is important.
ZF will run just fine on Windows. You don't even have to have your index.php file in the "public" directory.
If your project structure looks like the following and their Windows hosting uses Apache you can just rename your public folder to htdocs (common apache public folder):
-- application/
-- library/
-- public/
---- index.php
Your host may not be willing to alter certain settings for public folders because they have an automated script that does it for them and makes it difficult to modify it per account, but you can also edit the index.php file to fit any structure.
The stock index.php file looks like this:
<?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();
If you just change the defines for APPLICATION_PATH and the library folder in the set_include_path, then you should have no problem using ZF with your host's stock settings.
The default path assumes your public directory sits in the same folder as your application and library folders, but this is changed easily by editing the paths above.
精彩评论