Trouble with installion of zend framework 2 on wamp 2.5 - php

So becaue I do not have a clue whats wrong I give you full information about what I did before and all determining factors. (The Problem is specified at the bottom)
wamp was already installed. My localhost path is:
F:\Program Files\wamp\www
So the Space could lead to a fail somewhere.
Downloaded SendSkeletonApplication from GitHub (because Tut. told me to) and extract it to my created folder zf2. So its everything in:
F:\Program Files\wamp\www\zf2
and only that you now I extract it right here is the path to the public folder:
F:\Program Files\wamp\www\zf2\public
Downloaded Composer-Setup.exe from:
https://getcomposer.org/download/
enable php_openssl.dll in php.ini so here is the line (without semicolon):
extension=php_openssl.dll
open Windows PowerShell and do following things:
going to this directory:
PS F:\Program Files\wamp\www\zf2> composer self-update
PS F:\Program Files\wamp\www\zf2> composer install
both worked so I checked php -v:
PS F:\Program Files\wamp\www\zf2> php -v
PHP 5.5.12 (cli) (built: Apr 30 2014 11:20:58)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
Now it gets confused because of different Tuts. I did following things to:
Open Windows System -> Advanced system settings -> Environmental Variables -> System variables -> Path -> Edit
Edit the php5.5.15 and zf2 (Composer was already there):
;F:\Program Files\wamp\bin\php\php5.5.12;C:\ProgramData\ComposerSetup\bin;F:\Program Files\wamp\www\zf2
Open and Editing:
F:\Program Files\wamp\bin\apache\apache2.4.9\conf\httpd.conf
uncomment: Include conf/extra/httpd-vhosts.conf
so the line now looks like (without #):
Include conf/extra/httpd-vhosts.conf
Well I followed one tutorial but it did not worked so I did following thinks not in the exact order:
Editing following things to
F:\Program Files\wamp\bin\apache\apache2.4.9\conf\httpd.conf
and also to
F:\Program Files\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf
<VirtualHost *:80>
ServerName dev.zf2.com
DocumentRoot "F:\Program Files\wamp\www\zf2\public"
SetEnv APPLICATION_ENV "development"
<Directory "F:\Program Files\wamp\www\zf2\public">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
Order Allow,Deny
Allow from all
</IfModule>
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName localhost
DocumentRoot "F:\Program Files\wamp\www"
SetEnv APPLICATION_ENV "development"
<Directory "F:\Program Files\wamp\www">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Going to C:\Windows\System32\drivers\etc\hosts and add this code:
127.0.0.1 dev.zf2.com
So now if I am going to dev.zf2.com I get to localhost of wamp, so there is no Skeleton Applications. I tried to open the public folder in zf2 because there is a index.php:
http://localhost/zf2/public
but it says: Internal Server Error.
So what is wrong? Do I installed it right?
Also, why is there no library in zf2 ?
And what are the next steps to start with zend ?

I've never used wamp, however, for step 8, your vhosts probably want to look more like this:
<VirtualHost *:80>
ServerName dev.zf2.com
DocumentRoot "F:\Program Files\wamp\www\zf2\public"
SetEnv APPLICATION_ENV "development"
<Directory "F:\Program Files\wamp\www\zf2\public">
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName localhost
DocumentRoot "F:\Program Files\wamp\www"
<Directory "F:\Program Files\wamp\www">
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
You don't need them in both httpd.conf and httpd-vhosts.conf (although that isn't likely to cause a problem). Just do one or the other to avoid confusion.
You have a random </IfModule> in your example, and the Order allow,deny stuff changed a bit in Apache 2.4 (which you appear to be using - the tutorial you're following may have been correct for the Apache version at the time). These two things are likely to be why you're getting an internal server error.
You have to restart Apache after making configuration changes or they won't have any effect (as per drew010's comment).
You want to be viewing http://dev.zf2.com in your browser, not localhost.
If it still doesn't work after that:
If you are still getting 'Internal Server Error', you need to figure out where the Apache error logs are, as each server error should have a corresponding log entry which will give you some clue as to the cause.
You've not mentioned anything about mod_rewrite - I don't know if this is something that's enabled by default in wamp, but if not, that would be an issue. If the error log has something about not recognising 'RewriteEngine', then enabling mod_rewrite should fix that.

Related

Symfony 5: 404 page for /lucky/number application

I just started learning Symfony and try create 1th application by article https://symfony.com/doc/current/page_creation.html
WebServer: Apache 2.4.41
Server: Ubuntu 20
PHP: 7.4.3
I created domain on server symfony.
Installed in /var/www/html/symfony/ by command symfony new --full ./
Add required files (controller and write route to config/routes.yaml). Installed composer require symfony/apache-pack.
Execute $ php bin/console debug:router:
Name
Method
Scheme
Host
Path
...
app_lucky_number
ANY
ANY
ANY
/lucky/number
Opened in browser http://server.ip/symfony/lucky/number and get 404 Apache error.
Opened in browser http://server.ip/symfony/public/ and OK.
Opened in browser http://server.ip/symfony/public/index.php/lucky/number and OK.
Apache config in /etc/apache2/.../symfony.conf:
<VirtualHost *:80>
ServerName symfony
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/symfony/public
<Directory /var/www/html/symfony/public>
Options FollowSymlinks
Require all granted
#AllowOverride All
Order Allow,Deny
Allow from All
#FallbackResource /index.php
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
mod_rewrite is enable.
Anybody have any ideas how to fix it?
You need to add .htaccess in your project.
If you will use only apache configuration, you will be enabled FallbackResource index.php in your Directory
Following this configuration : https://symfony.com/doc/current/setup/web_server_configuration.html
See section : Use the following optimized configuration to disable .htaccess support and increase web server performance:

WAMP Gives the Forbidden Error with Static IP Address [duplicate]

I know this question has been asked a lot of times
I followed Most of the answers in the internet But I still get the same Message
403 Forbidden
You don't have permission to access / on this server.
It is weird that when I access using the same PC to localhost:1234 it runs normally but if I access using my IP address 192.168.0.188:1234
Also which is really weird is that I tried to install WAMP on other PC and without any configuration I could access to that PC.
So I thought it's because McAfee and Firewall so I open port on Widows and McAfee and nothing changed also I turned off Firewall and still nothing change.
Then for no reason I opened port through the Router “port forwarding” and still nothing changed.
I don't think that it's because my configuration in WAMP since I am still able to get this 403 Forbidden Message and also by using other PC without any configuration I could access it.
Both PCs are setup like this:
Windows 8 Pro
WAMP Wampserver: 2.4
Apache Version: 2.4.4
PHP Version: 5.4.12
MySQL Version: 5.6.12
The accessible PC uses Microsoft Security Essentials.
The inaccessible PC uses McAfee Internet Security.
I tried to turn off WAMP and start IIS For Microsoft Server (I works perfectly From any PC) but WAMP is still not not working
I followed these tutorial:
How to Access WAMP Server in LAN or WAN
Install & Setup Virtual Host Guide for WAMP
Install & Setup LAN & Worldwide Access Guide for WAMP
And the Stack Overflow answers here:
Cannot access wamp server on local network
WAMP 403 Forbidden message on Windows 7
If you are using WAMPServer 3 See bottom of answer
For WAMPServer versions <= 2.5
By default Wampserver comes configured as securely as it can, so Apache is set to only allow access from the machine running wamp. Afterall it is supposed to be a development server and not a live server.
Also there was a little error released with WAMPServer 2.4 where it used the old Apache 2.2 syntax instead of the new Apache 2.4 syntax for access rights.
You need to change the security setting on Apache to allow access from anywhere else, so edit your httpd.conf file.
Change this section from :
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
Allow from localhost
To :
# onlineoffline tag - don't remove
Require local
Require ip 192.168.0
The Require local allows access from these ip's 127.0.0.1 & localhost & ::1.
The statement Require ip 192.168.0 will allow you to access the Apache server from any ip on your internal network. Also it will allow access using the server mechines actual ip address from the server machine, as you are trying to do.
WAMPServer 3 has a different method
In version 3 and > of WAMPServer there is a Virtual Hosts pre defined for localhost so you have to make the access privilage amendements in the Virtual Host definition config file
First dont amend the httpd.conf file at all, leave it as you found it.
Using the menus, edit the httpd-vhosts.conf file.
It should look like this :
<VirtualHost *:80>
ServerName localhost
DocumentRoot D:/wamp/www
<Directory "D:/wamp/www/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
Amend it to
<VirtualHost *:80>
ServerName localhost
DocumentRoot D:/wamp/www
<Directory "D:/wamp/www/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Hopefully you will have created a Virtual Host for your project and not be using the wamp\www folder for your site. In that case leave the localhost definition alone and make the change only to your Virtual Host.
Dont forget to restart Apache after making this change
For Apache 2.4.9
in addition, look at the httpd-vhosts.conf file in C:\wamp\bin\apache\apache2.4.9\conf\extra
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot C:/wamp/www
<Directory "C:/wamp/www/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require local
</Directory>
</VirtualHost>
Change to:
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot C:/wamp/www
<Directory "C:/wamp/www/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
changing from "Require local" to "Require all granted" solved the error 403 in my local network
I got this answer from here. and its works for me
Require local
Change to
Require all granted
Order Deny,Allow
Allow from all
To expand on RiggsFolly’s answer—or for anyone who is facing the same issue but is using Apache 2.2 or below—this format should work well:
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 ::1
Allow from localhost
Allow from 192.168
Allow from 10
Satisfy Any
For more details on the format changes for Apache 2.4, the official Upgrading to 2.2 from 2.4 page is pretty clear & concise. Key point being:
The old access control idioms should be replaced by the new
authentication mechanisms, although for compatibility with old
configurations, the new module mod_access_compat is provided.
Which means, system admins around the world don’t necessarily have to panic about changing Apache 2.2 configs to be 2.4 compliant just yet.
For those who may be running WAMP 3.1.4 with Apache 2.4.35 on Windows 10 (64-bit)
If you're having issues with external devices connecting to your localhost, and receiving a 403 Forbidden error, it may be an issue with your httpd.conf and the httpd-vhosts.conf files and the "Require local" line they both have within them.
[Before] httpd-vhosts.conf
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local <--- This is the offending line.
</Directory>
</VirtualHost>
[After] httpd-vhosts.conf
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
</Directory>
</VirtualHost>
Additionally, you'll need to update your httpd.conf file as follows:
[Before] httpd.conf
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
# onlineoffline tag - don't remove
Require local #<--- This is the offending line.
</Directory>
[After] httpd.conf
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
# onlineoffline tag - don't remove
# Require local
</Directory>
Make sure to restart your WAMP server via (System tray at bottom-right of screen --> left-click WAMP icon --> "Restart all Services").
Then refresh your machine's browser on localhost to ensure you've still got proper connectivity there, and then refresh your other external devices that you were previously attempting to connect.
Disclaimer: If you're in a corporate setting, this is untested from a security perspective; please ensure you're keenly aware of your local development environment's access protocols before implementing any sweeping changes.

Apache virtual host configuration: How to make my Zend projects and phpMyAdmin play together?

In order for me to be able to run a Zend Framework project on my local development machine, I made changes to Apache's \etc\apache2\httpd.conf and the openSUSE system's \etc\hosts files. I set up a test3.local alias for an individual Zend project, and things seem to "work".
Before I started fiddling with things, I could access phpMyAdmin simply by entering http://localhost/phpMyAdmin/ in my browser. And if I take away my changes, that once again works.
Using this answer as a basis, I tried to set up an additional virtual host specifically for phpMyAdmin, hoping to "solve" this problem. But right now if key in the virtual host name, admin.local, that I intend to take me to phpMyAdmin, I get a 403 error like this:
(source: willmatheson.com)
Here is my present httpd.conf:
### Virtual server configuration ############################################
IncludeOptional /etc/apache2/vhosts.d/*.conf
<VirtualHost *:80>
ServerName test3.local
DocumentRoot /home/william/public_html/ZendTest3/public
SetEnv APPLICATION_ENV "development"
<Directory /home/william/public_html/ZendTest3/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName admin.local
DocumentRoot /var/lib/mysql/phpMyAdmin
# This gives permission to serve the directory
<Directory /var/lib/mysql/phpMyAdmin>
DirectoryIndex index.php
Options None
AllowOverride All
# This allows eveyone to access phpmyadmin, which you may not want
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
and hosts:
127.0.0.1 localhost
127.0.0.1 local
127.0.0.1 test3.local
127.0.0.1 admin.local
Ideally I'd like to not have to specify a virtual host for phpMyAdmin at all, because I'm sure to muck it up, and just somehow have the settings to make the Zend project work but to also have phpMyAdmin work like it did before.
I know this question was already answered, but I thought I'd share what I did to overcome a similar problem, in case it helps anyone else.
My problem was:
I started to get localhost/phpmyadmin 404 error after changing the DocumentRoot folder in httpd.conf. The change I made was to change the DocumentRoot
from:
DocumentRoot "C:\Program Files (x86)\Zend\Apache2/htdocs"
to:
DocumentRoot "C:\Program Files (x86)\Zend\Apache2/htdocs/a/deeper/folder"
I fixed it by changing a line in zend.conf
from:
Alias /phpMyAdmin "C:\Program Files (x86)\Zend\phpMyAdmin"
to:
Alias /phpMyAdmin "C:\Program Files (x86)\Zend\ZendServer\data\apps\http\__default__\0\phpMyAdmin\4.0.5.4_41"
Hope this helps somebody else!
Well, there's a good reason I was getting a 403 - I was digging in the wrong place. My installation of phpMyAdmin was actually in /srv/www/htdocs/phpMyAdmin. Changed that, restarted Apache (sudo systemctl restart apache2.service) and things seem to work.
If you're interested in how the heck to find files and folders on openSUSE, the following steps worked for me:
sudo zypper install findutils-locate
su
updatedb (go check your e-mail)
locate phpMyAdmin (like that, not 'phpmyadmin')

How do fix apache error "not within configured docroot" under Ubuntu

Greetings experts and gurus, I am looking for some help with an apache php configuration problem.
I have been running several websites from an apache2 setup on an ubuntu server for some time now without problems using the line NameVirtualHost * in my etc/apache2/conf.d/virtual.conf file. I recently updated the server version to the latest lts version and I am now unable to run php files.
I am running all my sites for the location "/home/www/[site-name]/htdocs" and I have setup and enabled all my sites in /etc/apache2/sites-available. I have also disabled the default site.
for each sites file I have specified the following:
# Indexes + Directory Root.
# DirectoryIndex index.html index.htm index.php
DocumentRoot /home/www/[site-name]/htdocs/
# CGI Directory
ScriptAlias /cgi-bin/ /home/www/[site-name]/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
# Logfiles
ErrorLog /home/www/[site-name]/logs/error.log
CustomLog /home/www/[site-name]/logs/access.log combined
I restart apache and enter the url for a php test page on my server and I am met with an "Internal Server Error". When I check the error log I get:
Script "/home/www/[site-name]/htdocs/test.php" resolving to "/home/www/[site-name]/htdocs/test.php" not within configured docroot.
For some reason when looking into the error, suphp came up a lot. According to this link:
Don't be fooled into thiking this has anything to do with the Apche virtual host document root, this is actually another setting in the suphp config file. Including the paths which contained the RoundCube scripts fixed this one. For example:
docroot=/var/www:/usr/share/roundcube:/var/lib/roundcube:${HOME}/public_html
You need to edit your /etc/suphp/suphp.conf file and change the docroot to whatever is appropriate.
It looks you missed the virtual hosts configuration for every site name:
<VirtualHost IP:80>
ServerName yourdomainname
ServerAlias www.yourdomainname
DocumentRoot /home/www/[site-name]/htdocs/
ScriptAlias /cgi-bin/ /home/www/[site-name]/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
ErrorLog /home/www/[site-name]/logs/yourdomainname.ua-error.log
CustomLog /home/www/[site-name]/logs/yourdomainname-access.log combined
</VirtualHost>
<Directory "/home/www/[site-name]/htdocs/">
Options FollowSymLinks
AllowOverride None
Order allow,deny
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
Thanks for all the help, I got there in the end. It seems that upgrading to Ubuntu 10.04 turned on suPHP. It has ended up being a good thing as the reason why I was getting errors was down to file management in my htdocs getting sloppy.
To fix my issues I had to do several things:
First I turned on suphp error messages in /etc/apache2/sites-available/[site-name]. This gave me the true error, which told me that some of my pages had the wrong permissions. I then set all my folder permissions in www to 755 and the files to 644. I also had to lower the min_uid and min_gid fileds in suphp.conf to 33.

Set up a Zend project in OS X

I'm trying to set up a new Zend project using Zend Server CE under OS X 10.6
First, I have downloaded and successfully installed Zend Server CE: opening http://localhost:10081 in my browser shows the dashboard, and everything seems to be working fine.
Than I created a new project, following the tutorial:
$ cd /usr/local/zend/apache2/htdocs
$ /usr/local/zend/share/ZendFramework/bin/zf.sh create project quickstart
The project was created without errors.
Then I added
<VirtualHost quickstart.local:10088>
ServerName quickstart.local
DocumentRoot /usr/local/zend/apache2/htdocs/quickstart
SetEnv APPLICATION_ENV "development"
<Directory /usr/local/zend/apache2/htdocs/quickstart>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
to the /usr/local/zend/apache2/conf/extra/httpd-vhosts.conf file and the entry 127.0.0.1 quickstart.local to my /etc/hosts/ file.
Finally, I restarted the Apache bundled with Zend Server CE.
But now, if I open http://quickstart.local:10088/ in my browser, I see this:
instead of the default index view I was expecting.
What a I missing?
Thanks.
I was having a hell of a time trying to figure out the directions from "Zend Framework Quick Start" Even though you didn't solve it, you pointed me in the right direction and I was able to get it. You probably figured it out by now but for everyone else coming to this page here goes:
By default the httpd.conf file has the 'Include httpd-vhosts.conf' line commented out. So edit /usr/local/zend/apache2/conf/httpd.conf to change this line:
#Include conf/extra/httpd-vhosts.conf
to this line:
Include conf/extra/httpd-vhosts.conf
We are almost done now. The code you added to /usr/local/zend/apache2/conf/extra/httpd-vhosts.conf wasn't quite correct. It should be:
<VirtualHost quickstart.local:10088>
ServerName quickstart.local
DocumentRoot /usr/local/zend/apache2/htdocs/quickstart/public
SetEnv APPLICATION_ENV "development"
<Directory /usr/local/zend/apache2/htdocs/quickstart/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Notice how I added the /public onto the paths. Otherwise you won't point to the index.php file. Now restart Apache using this command sudo /usr/local/zend/bin/zendctl.sh restart
and it should now be working.
Happy coding :)

Categories