The purpose of this guide is to help experienced and novice. This step by step guide for the more inexperienced. This Zend configuration will not effect your previous project and setting at root directory c:/wamp/www.
- Enable virtual hosts, mod_rewrite, and override in ‘httpd.conf’
- Set up virtual host in ‘httpd-vhosts.conf’
- Follow the Directory Structure
- Check include paths for the Zend library
- Add Custom URLs in host file
1. Enable virtual hosts, mod_rewrite, and override in ‘httpd.conf’
Make sure Wamp server is running. The apache configuration file can be found at ‘C:\wamp\bin\apache\Apache2.2.11\conf\httpd.conf’ or you can get from WampServer icon in the system tray and go to Apache > httpd.conf.
After making a backup, open it in notepad and search for “vhosts”. Make sure the line
# Include conf/extra/httpd-vhosts.conf
is uncommented by removing the “#” in front.
Next, look for the line
# LoadModule rewrite_module modules/mod_rewrite.so
and uncomment it too by just removing “#” .
Lastly, look for
# Deny from all
replace the Above code with below
# Deny from all
and make sure AllowOverride is set to All instead of none. This prompts Apache to apply rules found in the .htaccess files in sub directories. Save and close.
2. Set up virtual host in ‘httpd-vhosts.conf’
Look for the file in ‘ C:\wamp\bin\apache\Apache2.2.11\conf\extra ’ folder . Make a copy for backup and open it in notepad. Remove all code and simply paste the below code.
# Define localhost NameVirtualHost localhost:80 DocumentRoot c:/wamp/www ServerName localhost ServerAlias localhost #First Domain for zend NameVirtualHost dev.local ServerName dev.local ServerAlias dev.local DocumentRoot c:/zendproject/inventory/public ErrorLog c:/zendproject/inventory/public/error.log CustomLog c:/zendproject/inventory/public/access.log common Options -Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny Allow from all
# as you can see i have created two local domains and you might create as much as you want each domain for each Zend Framework projects.
I was getting the “You don’t have permission to access” error when accessing the page, so i have included the above directory tags and define the permissions before </VirtualHost> tag:
3. Follow the Directory Structure
4. Check include paths for the Zend library
Make sure you have copied the Zend library into your /library folder and also paste your bin folder your index.php actually combines it with the PHP include path. So for keeping it simple you just paste the below code in c:/zendproject/inventory/public/index.php
<?php // Define path to applications or projects 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();
5. Add Custom URLs in host file
Your host file is located at ‘C:/Windows/System32/drivers/etc/host’. Its a file without extension, but you can open it with notepad just the same. Add the following line to the end:
Now you can easily access your zend server by just typing. http://dev.local in any browser.
If you still have any problem in configuring here the Source Code of zendproject. just don’t forget to add the zend library.
That’s it. If you are stilling faceing any problem comment below. Good Luck.DOWNLOAD SOLUTION HERE