I have installed the symfony_demo application on El Capitan (10.11.2)
If I run the inbuilt PHP server as follows:
php app/console server:run 127.0.0.1:8111
the demo application is Live at localhost:8111
but if I access the application via El Capitan's inbuilt apache instance (by copying it into my <user>/Sites directory), I just get a directory listing.
Note that I do have PHP enabled on apache, and other PHP-based applications run through apache as currently configured (e.g. Joomla).
What more configuration of apache do I need?
Addendum:
I am running the Server version of the OS. I read that there exists another apache configuration file at: /Library/Server/Web/Config/apache2/httpd_server_app.conf
But uncommenting the vhosts .conf and .so directives and restarting 'Websites' via the Server app in this file made no difference to the behaviour
You'll need to uncomment few lines in your /etc/apache2/httpd.conf. Remove the # in front of the following lines if it's there (these lines are in different parts of the file):
LoadModule php5_module libexec/apache2/libphp5.so
LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so
Include /private/etc/apache2/extra/httpd-vhosts.conf
Next, you can edit /etc/apache2/extra/httpd-vhosts.conf to define your virtual hosts. For example if your project is located in /Users/username/Sites/symfony (replace "username" with your username, and "symfony" with you project directory):
<VirtualHost *:80>
ServerName symfony.dev
DocumentRoot "/Users/username/Sites/symfony/web/"
<Directory "/Users/username/Sites/symfony/web/">
AllowOverride All
Order Allow,Deny
Allow from All
</Directory>
</VirtualHost>
In the example I used a fake domain symfony.dev. If you want to use it you'll need to add it to your /etc/hosts file (add a new line there):
127.0.0.1 symfony.dev
After changing apache's configuration don't forget to restart it:
sudo /usr/sbin/apachectl restart
You might need to adapt the vhost config to your needs. Read more about configuring the web server in the Symfony documentation.
Success!
The pivotal information here is that the Server version of OSX has it's own configuration which disables .htaccess redirection by default.
After finding the setting in Server > Websites > Server Website (edit) > Edit Advanced Settings > "Allow overrides using .htaccess files
And restarting Websites, the symfony demo works fine at http://localhost/symfony_demo/web/
n.b.: No need for vhosts - that's merely a convenience
Related
I'm simply trying to open a php file I have created and keep getting this.
The requested URL /~Wade/HelloWorld.php was not found on this server.
I just recently did a reinstall on my Mac. Which shouldn't have affected my .conf files. With that being said, I can still typein localhost in my URL and it returns "It Works" so I know the server is still up? I'm confused
(Note: Assuming you use a recent version of OS X)
Since a couple of versions (not sure which, but at least since Mavericks), userdir Sites are disabled in the httpd.conf shipped with OS X.
Assuming you know how to edit files owned by root, remove the # from these two lines in /etc/apache2/httpd.conf:
#LoadModule userdir_module libexec/apache2/mod_userdir.so
#Include /private/etc/apache2/extra/httpd-userdir.conf
Next, create a file in /etc/apache2/users/. Its name doesn't matter, as long as it ends in .conf.
Its contents should be:
<Directory "/Users/Wade/Sites">
Require all granted
# The next two lines are optional and may bee too lax for
# production, but I deem them good for a development environment.
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
Also, in every httpd.conf that has shipped with OS X for as long as I can remember, PHP has been disabled by default. So you'll also have to remove the # from this line in httpd.conf:
#LoadModule php5_module libexec/apache2/libphp5.so
You probably also want to set the ServerName directive, to suppress a startup warning.
There's a commented out line somewhere that reads
#ServerName www.example.com:80
Either change it (and remove the #), or just add a new one after it that reads
ServerName 127.0.0.1:80
If you want your server to be accessible from other devices in your local network, replace 127.0.0.1 with 0.0.0.0, and if you use a different post, adjust accordingly.
After that, run sudo apachectl -k restart to restart Apache and you should be good to go.
I would like to host Wordpress and Magento PHP sites on a IBM/Lotus Domino Server with plans to integrate with Lotus Notes databases.
I have installed PHP 5.3.29, MySQL 5.6.21.1, phpMyAdmin 4.2.10.1
I am NOT running IIS or Apache.
I am running IBM Domino Enterprise Server 9.01 with HTTP Server task.
I have created the URL-->Directory mapping doc in the Domino Directory:
Incoming URL String: /*.php
Target server directory: c:\php\php-cgi.exe /*.php
Access Level: Execute
I have created a directory 'php' in the Domino HTML folder (c:\domino\data\domino\html\php)
I created a info.php file that displays phpinfo():
<?php phpinfo(); ?>
I am able to bring up http://domain.com/php/info.php perfectly. !!
I am able to run phpMyAdmin and create MySQL db's.
I am able to install and configure Wordpress.
HOWEVER I must add index.php to any URLs that only include the directory.
For example /wp/wp-admin/index.php works.
But /wp/wp-admin/ or /wp/wp-admin return status 403 and error:
Unable to process request, directory browsing is not allowed
SO Here is my question:
How can I get the Domino HTTP service to look for index.php in addition to index.htm & index.html when a URL is only of the directory? If there is a file named index.html in the Domino HTML directory, you need only use the directory name. How to add index.php to the list of files to look for if only a directory is in the URL? Is there some configuration file where I can add index.php to the list?
Please note that I am not using Apache so the .htaccess file has no effect (correct me if I am wrong) in the Domino HTTP environment.
Thanks in advance.
I was able to host a Wordpress site on a Domino 9 server running the optional IBM HTTP Server (IHS). All running on Windows Server 2008 R2.
First, Domino 9 Server must be installed with the option 'IBM HTTP Server' -- you have to do a Custom installation to see the choice. This installs IBM HTTP Server (IHS) which is a version of Apache that integrates with Domino HTTP.
IHS is installed in the Domino directory 'ihs'. The ihs\conf\domino.conf file needs to be edited -- most of it is OK as is. The file domino.conf is used instead of httpd.conf which would normally be used to run IHS without the Domino HTTP connection.
Add domino\ihs\bin\ httpd.exe to your Firewall rules since it will now be receiving the HTTP requests and proxying them to the Domino server on a different port. This setup will allow the installation of TLS encryption certificates, for example.
Make edits to domino.conf:
Uncomment line:
Listen 0.0.0.0:80
Comment out SetHandler domino-handler :
<IfModule mod_domino.c>
...
#<LocationMatch /*>
#SetHandler domino-handler
#</LocationMatch>
</IfModule>
Append the following at the end of domino.conf:
LoadModule dir_module modules/mod_dir.so
DirectoryIndex index.html index.htm index.php
Win32DisableAcceptEx
LoadModule php5_module "C:\php\php5apache2_2.dll"
<IfModule php5_module>
AddType application/x-httpd-php .php
PHPIniDir c:/php/
</IfModule>
NameVirtualHost *:80
#default vhost for Domino HTTP:
<VirtualHost *:80>
ServerName "${DOMINO_SERVER_NAME}"
DocumentRoot "${DOMINO_DOCUMENT_ROOT}"
<IfModule mod_domino.c>
<LocationMatch /*>
SetHandler domino-handler
</LocationMatch>
</IfModule>
</VirtualHost>
# vhost for wordpress.domain.com
<VirtualHost *:80>
ServerName wordpress.domain.com
DocumentRoot "${DOMINO_DOCUMENT_ROOT}/wp"
</VirtualHost>
Secondly, to install PHP5 on IHS, we have to use the thread safe version -- I had previously installed the non-thread safe (nts) versions configured for 'Other CGI' which did not allow for a php module that could be loaded by the IHS (Apache) server.
PHP 5.3.29 VC9 x86 Thread Safe (2014-Aug-15 20:02:15)
Installer [38.38MB] http://windows.php.net/downloads/releases/php-5.3.29-Win32-VC9-x86.msi
I used the PHP installer program - install PHP in C:\PHP, choose Apache 2.2.x Module during web server setup.
I copied the Wordpress files into the Domino html directory domino\data\domino\html\wp .
Finally, to run IHS on Domino, edit notes.ini and add:
HTTPIHSEnabled=1
Restart the HTTP task on the Domino server. Pay attention to console to make sure there are no errors with domino.conf file.
The above configuration will send ALL HTTP requests on port 80 to the Domino HTTP task as normal with the exception of wordpress.domain.com which will continue to be handled by the IHS server instead of the Domino server.
The Virtual Host doc in the Domino directory for wordpress.domain.com is not needed, and the URL-->Directory mapping doc in the Domino Directory I originally added is now no longer needed (and now there is no c:\php\php-cgi.exe file).
Note that Domino does no logging of any IHS virtual hosts that are not handled by Domino.
According to the book "IBM HTTP Server on z/OS: Migrating from Domino-powered to Apache-powered" (p.42, bottom) there exists a Welcome directive in Domino, which should do the same as DirectoryIndex in Apache.
This should do the trick:
Welcome index.php index.html index.htm
although I do not know where to put that... but maybe you already know that.
I have the following environment:
XAMPP on Windows
php handled by mod_php5
Can someone please tell me how to load custom php.ini per project? because currently it only loads from the main php.ini of xamp setup.
Thanks a lot.
You can setup PHPINIDir for each virtual host.
Add to your apache configuration:
<VirtualHost *:80>
DocumentRoot c:\www\example1
ServerName www.example.com
PHPINIDir c:\www\example1
# Other directives here
</VirtualHost>
for handling several virtualhosts you should have different hostnames (you can use etc/hosts) or different ip-adresses.
UPDATE: the following error is coming up in the Apache error logs...
[Sat Dec 08 16:41:39 2012] [error] [client 127.0.0.1]
PHP Fatal error: require_once():
Failed opening required 'Zend/Application.php'
(include_path='/Library/WebServer/Documents/quickstart/library:.:/php/includes:/Users/markmcdonnell/Dropbox/Library/PHP/ZendFramework-1.12.0/library')
in /Library/WebServer/Documents/quickstart/public/index.php on line 18
I'm using Mac OSX 10.8.2 (Mountain Lion) and I'm having problems getting the Zend framework set-up and running (just the basic QuickStart).
I'm using Apache 2.2.22
My localhost files are accessible from /Library/WebServer/Documents
I have PHP 5.3.15 running as well.
I've created a new project via the command line (using the zf.sh file) called 'quickstart' (as per the section on the Zend website recommends) and that is stored here: /Library/WebServer/Documents/quickstart
I've followed both the official Zend website instructions and also an online book about installing Zend: http://www.survivethedeepend.com/zendframeworkbook/en/1.0/creating.a.local.domain.using.apache.virtual.hosts
My php.ini (/private/etc/php.ini) file has been updated to include the path to the library folder inside the ZendFramework directory...
include_path = ".:/php/includes:/Users/<home>/Dropbox/Library/PHP/ZendFramework-1.12.0/library"
I've updated /etc/apache2/httpd.conf so it includes...
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
# Ensure "localhost" is preserved unchanged pointed
# to the default document root for our system.
<VirtualHost *:80>
ServerName localhost
DocumentRoot /Library/WebServer/Documents
</VirtualHost>
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerName quickstart.local
DocumentRoot /Library/WebServer/Documents/quickstart/public
SetEnv APPLICATION_ENV "development"
<Directory /Library/WebServer/Documents/quickstart/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
...I've also updated /etc/hosts so it includes...
127.0.0.1 localhost
127.0.0.1 quickstart.local
I'm restarting Apache using sudo apachectl graceful (I've also used sudo apachectl restart)
So if I try and now access http://localhost/ I see my /Library/WebServer/Documents directory and I can see PHP is running still with no problems. But if I try and access http://quickstart.local/ I just get an empty page?
Can any one advise as to what the problem might be, what I'm missing and what I can do to get the initial 'welcome' page to display.
I'm sure I'm just missing someone small, but it's obviously causing problem enough for the basic page not to show.
Thanks.
Mark
Just for others who may have followed this. The answer by Kamil, above, will work, but opens a security hole outside Apache's security configuration. That's fine as long as you know it and have another layer of security above Apache.
Another way to resolve the problem is to put the ZendFramework somewhere inside the root directory's hierarchy. Like:
DocumentRoot/Library/WebServer/Documents/ZendFramework-1.12.0/library
or
DocumentRoot/Library/WebServer/Documents/quickstart/public/ZendFramework-1.12.0/library
Any path that's inside the root directory of your Apache server.
Maybe a user permissions issue between the Zend files and the Apache process.
Since you can create the project using zf.sh, the Zend files are obviously there. But the fail you get via Apache suggests that the Zend files might not be accessible via the Apache process (that is, the user under which the Apache process runs).
$ chmod 0777 /Users/markmcdonnell/Dropbox/Library/PHP/ZendFramework-1.12.0/library
to test.
You could probably get away with much less expansive permissions - 0644, for example - but I confess I'm terrible at that aspect of it. ;-)
I am attempting to install cakephp-1.3 on Ubuntu 11.10. I have finished all the required changes in the configuration file as mention in http://book.cakephp.org.
It shows all database connections as being setup.
Temp folder is rewrite-able.
But it give me an apache module rewrite error. I have checked the apache rewrite mode and it is enabled.
But I still get the URL_REWRITE error repeatedly and am unsure how to proceed. All help appreciated.
You should check if mod_rewrite is actually on. To do that, make a php file with
<?php php_info(); ?>
in your web root folder. At Loaded Modules you should see mod_rewrite.
If not, check for the line:
LoadModule rewrite_module modules/mod_rewrite.so
In httpd.conf (apache2.conf in UBUNTU > /etc/apache2/apache2.conf). It must be uncomented (without ; in front).
Check if AllowOverride option is on for your project. To do that, add the following line at the end of httpd.conf (apache2.conf in UBUNTU)
<Directory "/var/www/myProjectName">
AllowOverride all
</Directory>