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 :)
Related
I have Wordpress installed using an AWS EC2 instance. The public IP is as here. I used LetsEncrypt to get SSL, that worked fine. But after that, my homepage now shows the 'Apache2 Ubuntu Default Page'. It should be showing me the Wordpress homepage. I still have ssh access to the EC2 (Bitnami Wordpress), so my data is supposedly still there.
I've been doing some research at it seems that I need to change something with Apache so it direct to the Wordpress directory/page.
Any help in the matter would be most appreciated :)
Bitnami Engineer here,
It seems you installed the Apache2 system's service in the machine and it got started at boot time. The Bitnami apps don't use the system's services. That's why the Bitnami's Apache service can't be started because other service is already running in the 80 port. In order to stop and disable it, please run these commands
sudo service apache2 stop
sudo service apache2 disable
sudo /opt/bitnami/ctlscript.sh start apache
Happy to help!
The fact that you're getting the Apache default page is a good sign, it means everything from a networking standpoint is working correctly. Now, you just need to show Apache where to serve your files.
Apache stores their default configuration typically in /etc/httpd/httpd.conf or /etc/apache2/sites-available/default and looks something like below.
<VirtualHost *:80>
ServerAdmin webmaster#localhost
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>
Before making changes to this file (whenever you find it), you will also need to know where the DocumentRoot is. This is essentially the directory that your index.php is located. In the example above it's located in /var/www, and that's typically a good place to start looking.
If you're having a hard time finding your root directory, you can do something like find / -type f -name "index.php".
Assuming your index.php is in /var/www/wordpress your configuration could look as simple as this.
<VirtualHost *:80>
ServerAdmin admin#example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/wordpress
</VirtualHost>
i have an issue that i want to run my laravel project without cmd command php artisan serve , i want something like usually in php project localhost/projectName , when i do all the steps like changing hosts in System32/driver/etc/hosts
and changing E:\wamp\bin\apache\apache2.4.33\conf\extra\httpd-vhosts.conf with all recommended option i restart wamp but when i put on the url projectname.dev the cercle above browser still Spins and nothing displays in the browser!!!!
someone has any idea
the configurations is
<VirtualHost *:80>
ServerAdmin webmaster#ahssanstore.dev
DocumentRoot "E:\wamp\www\AhssanStore\public"
ServerName ahssanstore.dev
ServerAlias www.ahssanstore.dev
ErrorLog logs/ahssanstore.dev-error.log
CustomLog logs/ahssanstore.dev-access.log common
<Directory "E:\wamp\www\AhssanStore\public">
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
and in C:\Windows\System32\drivers\etc
i add 127.0.0.1 ahssanstore.dev
and i restart wamp and after that i navigate to localhost/ahssanstore.dev
For windows, you can try use Laragon.
For those that have an Ubuntu Dev Server (with the possibility of other projects in your /var/www) I did the following to make it work.
Rename your-app/server.php to your-app/index.php
Copy .htaccess from your-app/public/ to your-app/
PS: If anyone knows that this creates some problems down the line please advice.
Done
Sometimes, servername: 'projectname.dev' doesn't work (I'm used to meet like this). Try changing 'projectname.me' instead 'project.dev'.
For VirtualHost configuration, you only need to set two lines:
<VirtualHost *:80>
DocumentRoot "E:\wamp\www\AhssanStore\public"
ServerName ahssanstore.dev
</VirtualHost>
Just Sharing my knowledge. Hope it also works!
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.
I am running Apache 2.2.26 with PHP 5.4.24 on Mac OS X 10.9.4. I have several virtual hosts running on this system, and all of them run successfully. I'm trying to add environment variables to one of the virtual hosts, and I don't want them to be in .htaccess so my only option is adding them to the in httpd-vhosts.conf.
The problem is that the environment variables don't appear after I install them in the httpd-vhosts.conf file (and, of course, after I restart Apache "sudo apachectl restart"). If, however, I add them to .htaccess (just for comparison purposes), they appear just fine. What am I missing?
NameVirtualHost *:80
<VirtualHost *:80>
ServerName mysite.local
DocumentRoot "/path/to/mysite.com"
SetEnv siteid 1234
ErrorLog "/var/log/apache2/mysite.local-error_log"
</VirtualHost>
I've also double-checked my php.ini file to be sure there's nothing prohibitive there, and the only relevant line looks good:
variables_order = "GPCSE"
Again, just to be clear, my virtual hosts RUN FINE. It's just that the environment variables don't appear when called in my PHP code. I've tried each of these three commands:
echo $_SERVER["siteid"];
echo getenv("siteid");
echo apache_getenv("siteid");
What can I be doing wrong??
This has been an excruciating quest for me, but I have found a very simple yet obscure answer. First of all, let me clarify my earlier question, that what I didn't realize is my Mac runs OS X Server, which has effectively altered the way Apache runs on my system.
With that said, below is the equivalent httpd-vhosts.conf file PER VIRTUAL HOST installed on my system via OS X Server application.
/Library/Server/Web/Config/apache2/sites/0000_any_80_mylocalsite.conf
Clearly, "80" is the port for regular http requests and "mylocalsite" is the name of the local virtual host that I created (within the OS X Server application). Now that this file has been produced by OS X Server, I can now edit it as follows:
sudo vi /Library/Server/Web/Config/apache2/sites/0000_any_80_mylocalsite.conf
Which opened a config file looking similar and almost exactly like a normal httpd-vhosts.conf file (note the SetEnv testid "1234" line which is the solution I have been searching for, and this can only be done manually and not through the OS X Server application)...
<VirtualHost *:80>
ServerName mysite.local
ServerAdmin admin#example.com
DocumentRoot "/my/local/docroot/path/to/mysite.com"
SetEnv testid "1234"
DirectoryIndex index.html index.php /wiki/ /xcode/ default.html
CustomLog /var/log/apache2/access_log combinedvhost
ErrorLog /var/log/apache2/error_log
<IfModule mod_ssl.c>
SSLEngine Off
SSLCipherSuite "ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM"
SSLProtocol -ALL +SSLv3 +TLSv1
SSLProxyEngine On
SSLProxyProtocol -ALL +SSLv3 +TLSv1
</IfModule>
<Directory "/my/local/docroot/path/to/mysite.com">
Options All -Indexes -ExecCGI -Includes +MultiViews
AllowOverride All
<IfModule mod_dav.c>
DAV Off
</IfModule>
<IfDefine !WEBSERVICE_ON>
Deny from all
ErrorDocument 403 /customerror/websitesoff403.html
</IfDefine>
</Directory>
</VirtualHost>
PLEASE, I hope this helps someone else someday. I have spent far too much time searching for this solution, only to stumble on it in brute-force tactics, and I would like to know this hopefully saves someone hours of searching themselves.
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')