Broken Apache configuration after upgrading to Yosemite - php

Yesterday I upgraded to Yosemite and now my local configuration for web development is not working anymore.
I managed to set up a userdir under /Users/user/public_html and I could access all the websites via localhost/~user/websitename. Nothing special, but it took me a while to configure.
Looking in the apache directory I saw that many files were replaced, keeping a backup. I tried putting back the files with my settings again, but still is not working. Maybe I'm missing some file that I don't remember.
This is httpd-userdir.conf:
# Settings for user home directories
#
# Required module: mod_userdir
#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received. Note that you must also set
# the default access control for these directories, as in the example below.
#
UserDir public_html
#
# Users might not be in /Users/*/Sites, so use user-specific config files.
#
Include /private/etc/apache2/users/*.conf
<IfModule bonjour_module>
RegisterUserSite customized-users
</IfModule>
<Directory "/Users/*/public_html/">
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Order allow,deny
Allow from all
</Directory>
Then in http.conf I have enabled some modules:
Include /private/etc/apache2/extra/httpd-userdir.conf
LoadModule userdir_module libexec/apache2/mod_userdir.so
and this:
DocumentRoot "/Users/user/public_html"
Directory "/Users/user/public_html">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks MultiViews
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
If I simply try to access localhost, it displays the message "It works!". If I go to localhost/user simply doesn't load and the same if I try to access one of the websites.
Did I miss any file? In the apache logs it doesn't even display any error.

OS X 10.10 Yosemite comes with Apache 2.4 instead of Apache 2.2 in Mavericks.
The major difference in configuration is that you have to replace...
Order allow,deny
Allow from all
...with...
Require all granted
See Apache doc's manual Upgrading to 2.4 from 2.2 for more details.
UPDATE:
Please be aware that after upgrading OS X you will usually find your old config files as backups next to the new ones written by Yosemite. They are labeled e.g. httpd.conf.pre-update and/or httpd.conf~previous and can be found in the same paths as the new configs (e.g. in /private/etc/apache2).

After attempting to fix this problem for 6 hours I was finally able to get this to work. I edited the httpd.conf, httpd-userdir.conf, httpd-vhosts.conf, etc to no avail. Leaving all of these files unedited from the yosemite configuration, what finally worked for me was to edit the httpd_server_app.conf located at /Library/Server/Web/Config/apache2/ by adding the following (for each site) as follows:
<Directory />
Options +FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>
<Directory "/Library/Server/Web/Data/Sites/Default/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Directory "/Library/Server/Web/Data/Sites/[OTHER SITE DIRECTORY]/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Make sure if you use textedit to edit this file you undo the automatic insertion of the slanted quotation marks otherwise you will get a unicode error message.
Hope this helps!

Related

error when trying to enable php on mac osx mojave Syntax error on line 281 of /private/etc/apache2/httpd.conf

i am following this guide to enable php on my mac osx mojave How to install Apache, MySQL, PHP on macOS Mojave 10.14
This is the error
Syntax error on line 281 of /private/etc/apache2/httpd.conf:</Directory>
line 281 is the final line of code in the following block
<Directory "/Users/brandondjuric/Sites/">
Options FollowSymLinks Multiviews
MultiviewsMatch Any
AllowOverride All
Require all granted
</Directory>
here is a larger block of the same code
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
# DocumentRoot "/Library/WebServer/Documents"
# <Directory "/Library/WebServer/Documents">
DocumentRoot "/Users/brandondjuric/Sites/"
<Directory "/Users/brandondjuric/Sites/">
Options FollowSymLinks Multiviews
MultiviewsMatch Any
AllowOverride All
Require all granted
</Directory>
#
# Possible values for the Options directive are "None", "All"

The php return page does not show error message when error is occured

I have already installed Apache2.4 and PHP7.2.2
I debugged some php page, they had error, and the return page have displayed error messages
Then I edited the httpd.conf, changed the lines
DocumentRoot "C:\Apache24\htdocs"
<Directory "C:\Apache24\htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks ExecCGI
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
to
DocumentRoot "D:\mywebs"
<Directory "D:\mywebs">
then when a page has error, it only displayed the content from the begin of the page to the line has error but it does not show error message
I had change the path back to "C:\Apache24\htdocs" but there still have been the problem
Can anyone help
Thanks for reading.
For displaying you have to configure you PHP not apache server
You can use some php inbuilt function to show error or change the configuration file
Using PHP
You have add below code in root of the PHP file
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
?>
Using php.ini file
Find php.ini file in your PHP installation and open it, Search display_errors
variable and set value On
display_errors=On
And then restart server

Wamp server: Changing httpd.conf for apache?

I am attempting to solve an error with my error, I am unable to connect from the server to my android application.
All sources are pointing me towards the following tutorial as the solution.
I have completed all steps in the tutorial successfully apart from:
Edit httpd.conf file of Wamp server
I.e. the tutorial instructs the following:
4 .Find this section of configuration within the httpd.conf file:
Directory “c:/wamp/www/”
#
# Possible values for the Options directive are “None”, “All”,
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that “MultiViews” must be named *explicitly* — “Options All”
# doesn’t give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be “All”, “None”, or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag – don’t remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Now Find and replace ’127.0.0.1′ with ‘All’, save the file and restart your wamp server.
However, my issue is that I do not have this code within my httpd.conf file. My corresponding section looks like this:
<Directory "c:/wamp/www/">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Require all granted
</Directory>
What can I change within my code to solve this?
A solution would be greatly appreciated, I have now been stuck with server issues for over a week :(
Know this is old, but it could save someone the stress I went through trying to fix the "Forbidden-Kingdom-Error" that got me twerking my fingers on google... thats the 403 error incase you mistakenly think you have no idea what I'm talking about. and if you do thats simply Awesome and way Hot!
*click on the WAMP server icon on the system tray(I am assuming you're using windows) and then ->Apache-> httpd.vhosts.conf [open the "httpd.vhosts.conf" file]
*and change "Require local" in the Directory tag( ...) to "Require all granted"
.This should be the bomb you're looking for!
*click the WAMP icon again and Restart all services then put Online finally. FINALLY and extra FINALLY you are good2 go!
N.B
This should definitely work 4 you especially if after following online-tutorials on how to connect your Android device to your Wamp server by modifying your firewall settings(i.e by adding a new rule) and modifying the httpd.conf file as instructed and you are still getting the "Forbidden error" codename-403.

configure httpd.conf for PHP ( You don't have permission to access /php/php-cgi.exe/index.php on this server. )

I have installed Apache successfully on WINDOWS and can open an HTML file with no issues. I also installed PHP on the server. I configured Apache and PHP as per the followng tutorials:
http://www.sitepoint.com/how-to-install-apache-on-windows/
http://www.sitepoint.com/how-to-install-php-on-windows/
As mentioned apache allows me to open the html file in my website. when adding a php file I get error:
You don't have permission to access /php/php-cgi.exe/index.php on this server.
PHP is installed to c:\PHP and apached in c:\apache24
I have tried a few options to fix the https.conf file but without any success.
My config file snippet is below:
<Directory "c:/WebPages">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
##Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
##AllowOverride None
#
# Controls who can get stuff from this server.
#
##Require all granted
#Options FollowSymLinks
AllowOverride None
Options None
Require all granted
Allow from all
</Directory>
This allows me to view the html file but not the php so am thinkign I need to allow permission to the c:\PHP folder but have no idea what?
any advice welcome. Thanks as always.
This happens because your CGI folder isn't at your PHP install folder. Try adding these lines of code to your httpd.conf file:
<Directory "c:/php">
AllowOverride None
Options None
Require all granted
</Directory>
If you didn't install PHP at c:\php, change that to wherever you installed it. Remember, use forward slashes instead of back ones (I always get mixed up with that; to much Linuxing I guess).

Wordpress on windows with xampp How to change default URL

I install wordpress on Windows 7 machine with xampp and bitnami.
By default it's url is http://127.0.0.1/wordpress
How could I change it to some standard host name without page prefix (like http://myworpdress)
The Bitnami WordPress Stack includes a tool called "bnconfig" that allows you to solve this issue easily. Everything is documented in the Bitnami documentation, please take a look to the link below:
https://docs.bitnami.com/installer/apps/wordpress/#how-to-configure-the-application-to-run-at-the-root-url-of-the-domain
You have to create an entry in your hosts file(C:\Windows\System32\Drivers\etc\hosts) for your domain
127.0.0.1 mywordpress
and in addition, you could add vhosts in your apache config, if you would test multiple domains on your local machine
<VirtualHost *:80>
ServerName wordpress
DocumentRoot C:\yourpath\...
</VirtualHost>
The vhost config is located under C:\xampp\apache\conf\extra\httpd-vhosts.conf. NameVirtualHost should also be enabled in the vhosts.conf file
NameVirtualHost 127.0.0.1
Another solution is to create an alias. In this scenario you will still refer to localhost, but you can also permanently have multiple parallel websites on a single server and to locate them wherever you like on your file system.
For example:
http://localhost/toenails/
http://localhost/sock_collection/
etc.
In the DocumentRoot section of the apache httpd.conf file add the following:
Alias /toenails/ "C:\projects\toenails/"
<Directory "C:\projects\toenails">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks Includes ExecCGI
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>

Categories