-1

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 only 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.

Vadiklk
  • 3,696
  • 5
  • 28
  • 44
  • Can't you switch to Linux? I mean if you need to do what the hosting guy at the company you work for says, what would you do? What are you concerned about? There can be a hundred reasons why he says so - true or false, so nobody can really answer your question. – hakre Sep 28 '11 at 14:07
  • Okay, started to figure out what happens. In the Zend framework folder structure the index.php is in the /public folder and the guy didn't know that he needs to somehow tell the server to look for this file there. How do I do that? – Vadiklk Sep 28 '11 at 14:12
  • First of all that's not specifically a Zend Framework problem (if it helps), but a question about server configuration and somewhat related to the webserver (and not specifically to the operating system). If your company only offers linux support, what's so bad? PHP can run on linux as well (I would even recommend it for production). So better think twice if you really have an issue with running on linux. If not, why care? – hakre Sep 28 '11 at 14:16
  • I would rather work with linux. But the company pays for a windows based hosting and there is nothing I can change. But I think I can fix it so it will work. – Vadiklk Sep 28 '11 at 14:19
  • There is a problem with index.php, you say. Is there a [PHP module](http://www.microsoft.com/web/gallery/install.aspx?appid=PHP53) installed in IIS? Is index.php configured as a default document? Does a simple file with `` work? – CodeCaster Sep 28 '11 at 22:34

1 Answers1

2

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.

drew010
  • 68,777
  • 11
  • 134
  • 162