Zend framework 2 LAMP returns 404 error while it was working on windows

I have an application running perfectly on my windows as well as CentOS server, but recently I have changed my OS from windows to Ubuntu. Now public folder is called it triggers onBootStrap where I have custom logic to check if not logged in then redirect to loginAction of default Controller. Which redirects fine but none of the controller is working they returns 404 error.

Even my public controllers are not accessible.

Am I missing any dependent extension?

Could it be some directory separators are / and not / ? If these are hard coded in, try replacing them with PHP constant DIRECTORY_SEPARATOR anywhere you have them, like so:

require_once 'path'.DIRECTORY_SEPARATOR.'to'.DIRECTORY_SEPARATOR.'file';

instead of:

require_once 'path/to/file';

There are several issues when developing in windows, and that’s just one of them. Case insensitivity and character encoding are other problems you will face.

An easier solution than re-configuring everything in your site (or wamp/xampp etc) would be a portable development server setup you can share with your team, so I recommend you try a VM!

Download Vagrant and VirtualBox first. Then if you go to puphpet.com, you can fill in a form to configure your development server. Make it match as closely to your production server as possible.

Once you finish filling in the form, download the configuration zip, unzip it, cd into the folder, and type vagrant up. It takes a while first time araound, but when it’s ready, you will have a full Linux server, and if you share the zip, everyone on your team will have identical setups, whether on Windows, Linux, or Mac.

Anyway, if you intend to keep devving natively in windows, check your php error_log