zend framework skeleton application not showing properly - zend-framework2

I have installed the Skeleton Application manually. My application is kept in "D:\xampp\htdocs\zf2". I've created a virtual host in the following way, in httpd-vhosts.conf
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "D:\xampp\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
ServerName zf2
DocumentRoot "D:/xampp/htdocs/zf2/public/index.php"
<Directory "D:/xampp/htdocs/zf2/public/index.php">
#DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
but it does not shown properly and it gives the output
and the remain ing application with module and database shows also not shows in the proper way
but if i slightly modify in virtual host settings of
DocumentRoot "D:/xampp/htdocs/zf2/public/index.php"
to
DocumentRoot "D:/xampp/htdocs/zf2/public"
then, skeleton application shows fine but when i configure module and database it gives error "The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script. zend sleleton application error"
can any one help me i have waste lot of time to set it but didn't.

You need to set document root to the folder not a file. The page looks messed up when pointing to index.php as documentroot because it cannot find the stylesheets.
The issue with configuring the module/database is probably a different issue, and you would have to post your module/database configuration to get help there.

Related

WAMP doesn't seem to be changing IP address to a domain

I'm trying to change how I access my website from WAMP server. I can access it like xxx.xxx.xxx.xxx/name, yes, it works perfectly fine. I searched up on how to change "xxx.xxx.xxx.xxx/name" to a domain name like www.name.com, I got some results but none of them worked. These are the things I did:
First I went to my host file
C:\Windows\System32\drivers\etc
, added a line "127.0.0.1 mytestdomain.com", this is how it looks:
host file
Next, I changed "#Include conf/extra/httpd-vhosts.conf" to "Include conf/extra/httpd-vhosts.conf" from httpd.conf located at:
"D:\wamp64\bin\apache\apache2.4.27\conf"
.
Lastly, I added
<VirtualHost mytestdomain.com>
DocumentRoot "D:/wamp64/www/myTestDomain/"
ServerName mytestdomain.com
ServerAlias mytestdomain.com
<Directory "D:/wamp64/www/myTestDomain/">
Order allow, deny
Allow from all
</Directory>
</VirtualHost>
on "httpd-vhosts.conf" located at:
"D:\wamp64\bin\apache\apache2.4.27\conf\extra"
Oh, and yes, this is inside myTestDomain folder: myTestDomain
After doing all this, I restarted WAMP and went to my domain main, but it doesn't seem to be working, meanwhile "xxx.xxx.xxx.xxx/myTestDomain" does seem to be working.
Your HOSTS file should look like this
127.0.0.1 localhost
127.0.0.1 mytestdomain.com
::1 localhost
::1 mytestdomain.com
Your Virtual Host definition like this
<VirtualHost *:80>
ServerName localhost
DocumentRoot D:/wamp64/www
<Directory "D:/wamp64/www/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:/wamp64/www/myTestDomain/"
ServerName mytestdomain.com
ServerAlias mytestdomain.com
<Directory "D:/wamp64/www/myTestDomain/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
Alternatively open the wampserver home page and use the Add a Virtual Host link under the Tools menu, and it will all be done for you correctly.
NOTE: Using .com is a bad idea unless you actually intend to host your live site from your PC, instead use a .dev for example. Change the HOSTS file accordingly.
Bigger NOTE: Hosting a live site from a PC is a very bad idea. If you are using a desktop OS it is not configured to cope with more than 30 external connections so if your site gets even vaguely popular, users will get a terrible experience, most of them queuing for connections for page parts to be downloaded.

Setup and configure Zend Skeleton Application

I'm new to Zend Framework 2 and have installed the Skeleton Application manually. My application is kept in "D:\xampp\htdocs\zf2". I've created a virtual host but when I point it to the public folder in D:\xampp\htdocs\zf2\public" it gives the error object not found. However, if I have the option other option like "D:\xampp\htdocs\zf2" then it works. I've also tried putting index.php at the end and that also works but it gives output like this.
I've set the virtual host in httpd-vhosts.conf:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "D:\xampp\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
ServerName zf2
DocumentRoot "D:/xampp/htdocs/zf2/public"
<Directory "D:/xampp/htdocs/zf2/public">
#DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
and in C:/Windows/System32/Drivers/etc/hosts file I added the line 127.0.0.1 zf2
Can any one help me on this?

How to change the URL from "localhost" to something else, on a local system using wampserver?

On a Windows machine, there's a system running on the local wampserver, but while the application is running on localhost, the URL says otherwise.
While I would expect the URL to be like this based on the directory structure:
http://localhost/pro/include/db_report.php
The developer has managed to do this:
http://ap-mispro/pro/include/db_report.php
So instead of localhost, the URL says ap-mispro.
And both URLs work fine.
How is the second URL made? I tried checking out the wampmanager.ini and wampmanager.tpl but maybe I didn't know what to look for?
WINDOWS + WAMP solution
Step 1
Go to C:\wamp\bin\apache\Apache2.2.17\conf\ open httpd.conf file and change #Include conf/extra/httpd-vhosts.conf to Include conf/extra/httpd-vhosts.conf i.e. uncomment the line so that it can includes the virtual hosts file.
Step 2
Go to C:\wamp\bin\apache\Apache2.2.17\conf\extra and open httpd-vhosts.conf file and add the following code
<VirtualHost myWebsite.local>
DocumentRoot "C:/wamp/www/myWebsite/"
ServerName myWebsite.local
ServerAlias myWebsite.local
<Directory "C:/wamp/www/myWebsite/">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
change myWebsite.local and C:/wamp/www/myWebsite/ as per your requirements.
Step 3
Open hosts file in C:/Windows/System32/drivers/etc/ and add the following line ( Don't delete anything )
127.0.0.1 myWebsite.local
change myWebsite.local as per your name requirements
Step 4
restart your server. That's it
WINDOWS + XAMPP solution
Same steps as that of WAMP just change the paths according to XAMPP which corresponds to path in WAMP
Copy the hosts file and add 127.0.0.1 and name which you want to show or run at the browser link. For example:
127.0.0.1 abc
Then run abc/ as a local host in the browser.
They are probably using a virtual host (http://www.keanei.com/2011/07/14/creating-virtual-hosts-with-wamp/)
You can go into your Apache configuration file (httpd.conf) or your virtual host configuration file (recommended) and add something like:
<VirtualHost *:80>
DocumentRoot /www/ap-mispro
ServerName ap-mispro
# Other directives here
</VirtualHost>
And when you call up http://ap-mispro/ you would see whatever is in C:/wamp/www/ap-mispro (assuming default directory structure). The ServerName and DocumentRoot do no have to have the same name at all. Other factors needed to make this work:
You have to make sure httpd-vhosts.conf is included by httpd.conf for your changes in that file to take effect.
When you make changes to either file, you have to restart Apache to see your changes.
You have to change your hosts file
http://en.wikipedia.org/wiki/Hosts_(file) for your computer to know
where to go when you type http://ap-mispro into your browser. This
change to your hosts file will only apply to your computer - not
that it sounds like you are trying from anyone else's.
There are plenty more things to know about virtual hosts but this should get you started.
please refer http://complete-concrete-concise.com/web-tools/how-to-change-localhost-to-a-domain-name
this is best solution ever
for new version of Wamp
<VirtualHost *:80>
ServerName domain.local
DocumentRoot C:/wamp/www/domain/
<Directory "C:/wamp/www/domain/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
After another hour or two I can actually answer my own question.
Someone on another forum mentioned that you need to keep a mention of plain ol' localhost in the httpd-vhost.conf file, so here's what I ended up with in there:
ServerName localhost
DocumentRoot "c:/wamp/www/"
DocumentRoot "C:/wamp/www/pocket/"
ServerName pocket.clickng.com
ServerAlias pocket.clickng.com
ErrorLog "logs/pocket.clickng.com-error.log"
CustomLog "logs/pocket.clickng.com-access.log" common
<Directory "C:/wamp/www/pocket/">
Options Indexes FollowSymLinks Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Exit WAMP, restart - good to go. Hope this helps someone else :)
go to C:\Windows\System32\drivers\etc and open hosts file and add
this
127.0.0.1 example.com
127.0.0.1 www.example.com
then go to C:\xampp\apache\conf\extra open httpd-ajp.conf file and add
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/pojectroot"
ServerName example.com
ServerAlias www.example.com
<Directory "C:/xampp/htdocs/projectroot">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
WINDOWS + MAMP solution
Step 1
Go to S:\MAMPenter code here
\bin\apache\conf\ open httpd.conf file and change
#Include conf/extra/httpd-vhosts.conf
to
Include conf/extra/httpd-vhosts.conf i.e. uncomment the line so that it can includes the virtual hosts file.
Step 2
Go to S:\MAMP\bin\apache\conf\extra and open httpd-vhosts.conf file and add the following code
<VirtualHost myWebsite.local>
DocumentRoot "S:\MAMP\htdocs/myWebsite/"
ServerName myWebsite.local
ServerAlias myWebsite.local
<Directory "S:\MAMP\htdocsmyWebsite/">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
change myWebsite.local and S:\MAMP\htdocs/myWebsite/ as per your requirements.
Step 3
Open hosts file in C:/Windows/System32/drivers/etc/ and add the following line ( Don't delete anything )
127.0.0.1 myWebsite.local
change myWebsite.local as per your name requirements
Step 4
restart your server. That's it
This method will work for xamp/wamp/lamp
1st go to your server directory, for example, C:\xamp
2nd go to apache/conf/extra and open httpd-vhosts.conf
3rd add following code to this file
<VirtualHost myWebsite.local>
DocumentRoot "C:/wamp/www/php-bugs/"
ServerName php-bugs.local
ServerAlias php-bugs.local
<Directory "C:/wamp/www/php-bugs/">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
For DocumentRoot and Directory add your local directory
For ServerName and ServerAlias give your server a name
Finally go to C:/Windows/System32/drivers/etc and open hosts file
add 127.0.0.1 php-bugs.local and nothing else
For the finishing touch restart your server
For Multile local domain add another section of code into httpd-vhosts.conf
<VirtualHost myWebsite.local>
DocumentRoot "C:/wamp/www/php-bugs2/"
ServerName php-bugs.local2
ServerAlias php-bugs.local2
<Directory "C:/wamp/www/php-bugs2/">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
and add your host into host file 127.0.0.1 php-bugs.local2

Phusion Passenger + Apache 2 + Rails 3. Works on local network, not when accessed externally

The problem:
I have created a Rails project skeleton using rails new TestApp in the /var/www/ directory of my server. The Rails default index.html displays and works properly (i.e., you see the rails logo and when you click on "About your application's environment" you get a correct listing of the environment specifications used on the server) when I access the site from the same network on which the server is running. However, if I access the site from a machine on a different network than the server's, the page displays but I do not get the rails logo image, and clicking on "About your application's environment" results in the following error display on the page:
Not Found
The requested URL /TestApp/rails/info/properties was not found on this server
And that URL shouldn't be found, because it doesn't exist. However, TestApp/public/rails/info/properties does exist.
Configuration:
The site resides in /var/www/TestApp and I access it from a Sub-URI. I have created a symbolic link in /var/www/ called rails as follows: rails -> /var/www/TestApp/public, such that the project can be accessed from www.mydomain.com/rails. My Apache configuration is the following, note that I've omitted,changed, or shortened some parts within the <VirtualHost> tag for brevity:
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/ex$
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p194/ruby
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName www.mydomain.com
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
.
.
.
#Rails Configuration
RailsBaseURI /rails
RailsEnv development
PassengerUserSwitching off
PassengerDefaultUser www-data
<Directory /TestApp/public>
Options FollowSymLinks -MultiViews
AllowOverride All
Allow from all
</Directory>
#End Rails Configuration
.
.
.
</VirtualHost>
A couple of things: the appropriate folders are owned by www-data with the appropriate permissions as defined by the Passenger documentation. When setting up the symlink and RailsBaseURI settings I followed the Passenger documentation.
I guess I'm at a loss here since everything seems to be working when accessing the website from the same network on which the server resides. I'm not sure why things aren't working out when accessing the site from a different network, but I feel like paths to certain resources/assets (like the rails logo) aren't resolving properly. Perhaps my symlink is configured inappropriately, or something is wrong with my Apache configuration?
Any help would be appreciated.
The issue of a somewhat broken default Rails page is not totally abnormal, it turns out.
I removed the default Rails page and replaced with another page that included some Rails code and everything worked like a charm.

Apache and passenger setup virtualhost restart failing

I have installed passenger on my Ubuntu 10.x server and I am running Apache2. I have followed the instruction "I think" pretty well. After setting up my virtual host and trying to restart I am getting a failed to start apache error because Documentroot takes one argument. I have the document root set is the thing so I am wondering if you guys could offer some suggestions as to what I may be doing wrong.
I have all my virtual hosts in separate files by domain name, so the directory structure on the server is something like this
/etc/apache2/sites-available/dev.mydomain.com
/etc/apache2/sites-enabled/dev.mydomain.com
both files have the following in them but restarting apache only fails when I put the vhost info in the enabled file.
<VirtualHost *:80>
ServerName dev.mydomain.com
DocumentRoot /home/myfolder/dev/vb/public # <-- be sure to point to 'public'!
<Directory /home/myfolder/dev/vb/public>
AllowOverride all # <-- relax Apache security settings
Options -MultiViews # <-- MultiViews must be turned off
</Directory>
</VirtualHost>
Thanks for any help you can offer.
Comments in httpd.conf must go on their own line.
have you given before defining VirtualHost
NameVirtualHost *:80
if this given remove those commented line after document root and try

Resources