Zend Framework controller issue - zend-framework

This has to be the most frustrating and mind boggling problem I have encountered so far.
I have a small demo project which has about 5 controllers. When I go to the project using the URL 'localhost/demo/public/' it opens the indexcontrollers indexaction related view, which is correct. This page has 3 links to 3 other controllers.
Now when I press the link to the studentController (which is one of the 3 controllers) I get the following error:
Message: Invalid controller specified (demo)
Stack trace:
#0 C:\xampp\library\Zend Framework\library\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#1 C:\xampp\library\Zend Framework\library\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch()
#2 C:\xampp\library\Zend Framework\library\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#3 C:\xampp\htdocs\Demo\public\index.php(26): Zend_Application->run()
#4 {main}
Request Parameters:
array (
'controller' => 'demo',
'action' => 'public',
'module' => 'default',
)
It seems to completely misread my URL, so naturally I checked my apache's rewrite module, however this is turned on by default in Xampp. Still, here's my apache's httpd.conf file:
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo.log"
# with ServerRoot set to "C:/xampp/apache" will be interpreted by the
# server as "C:/xampp/apache/logs/foo.log".
#
# NOTE: Where filenames are specified, you must use forward slashes
# instead of backslashes (e.g., "c:/apache" instead of "c:\apache").
# If a drive letter is omitted, the drive on which httpd.exe is located
# will be used by default. It is recommended that you always supply
# an explicit drive letter in absolute paths to avoid confusion.
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "C:/xampp/apache"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 0.0.0.0:80
#Listen [::]:80
Listen 80
# Default charset UTF8
# AddDefaultCharset utf-8
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_core_module modules/mod_authn_core.so
#LoadModule authn_dbd_module modules/mod_authn_dbd.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_file_module modules/mod_authn_file.so
#LoadModule authn_socache_module modules/mod_authn_socache.so
#LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
LoadModule authz_core_module modules/mod_authz_core.so
#LoadModule authz_dbd_module modules/mod_authz_dbd.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
#LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule bucketeer_module modules/mod_bucketeer.so
#LoadModule cache_module modules/mod_cache.so
#LoadModule case_filter_module modules/mod_case_filter.so
#LoadModule case_filter_in_module modules/mod_case_filter_in.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule cgi_module modules/mod_cgi.so
#LoadModule charset_lite_module modules/mod_charset_lite.so
#LoadModule dav_module modules/mod_dav.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule dav_lock_module modules/mod_dav_lock.so
#LoadModule dbd_module modules/mod_dbd.so
#LoadModule deflate_module modules/mod_deflate.so
LoadModule dir_module modules/mod_dir.so
#LoadModule disk_cache_module modules/mod_disk_cache.so
#LoadModule dumpio_module modules/mod_dumpio.so
#LoadModule echo_module modules/mod_echo.so
LoadModule env_module modules/mod_env.so
#LoadModule example_module modules/mod_example.so
#LoadModule expires_module modules/mod_expires.so
#LoadModule ext_filter_module modules/mod_ext_filter.so
#LoadModule fcgid_module modules/mod_fcgid.so # did not work at runtime
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule filter_module modules/mod_filter.so
LoadModule headers_module modules/mod_headers.so
#LoadModule ident_module modules/mod_ident.so
#LoadModule imagemap_module modules/mod_imagemap.so
LoadModule include_module modules/mod_include.so
LoadModule info_module modules/mod_info.so
LoadModule isapi_module modules/mod_isapi.so
#LoadModule ldap_module modules/mod_ldap.so
#LoadModule logio_module modules/mod_logio.so
LoadModule log_config_module modules/mod_log_config.so
#LoadModule log_forensic_module modules/mod_log_forensic.so
#LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule mime_module modules/mod_mime.so
#LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule speling_module modules/mod_speling.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule status_module modules/mod_status.so
#LoadModule substitute_module modules/mod_substitute.so
#LoadModule unique_id_module modules/mod_unique_id.so
#LoadModule userdir_module modules/mod_userdir.so
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule version_module modules/mod_version.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User daemon
Group daemon
</IfModule>
</IfModule>
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin#your-domain.com
#
ServerAdmin postmaster#localhost
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName localhost:80
#
# 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 "C:/xampp/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
# XAMPP: We disable operating system specific optimizations for a listening
# socket by the http protocol here. IE 64 bit make problems without this.
AcceptFilter http none
#
# 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.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "C:/xampp/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.2/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:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.php index.pl index.cgi index.asp index.shtml index.html index.htm \
default.php default.pl default.cgi default.asp default.shtml default.html default.htm \
home.php home.pl home.cgi home.asp home.shtml home.html home.htm
</IfModule>
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ".ht*">
Require all denied
</Files>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error.log"
#ScriptLog "logs/cgi.log"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
#CustomLog "logs/access.log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
CustomLog "logs/access.log" combined
</IfModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://localhost/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "C:/xampp/cgi-bin/"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock "logs/cgi.sock"
</IfModule>
#
# "C:/xampp/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "C:/xampp/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig "conf/mime.types"
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
AddHandler cgi-script .cgi .pl .asp
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>
<IfModule mime_magic_module>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
MIMEMagicFile "conf/magic"
</IfModule>
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://localhost/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# XAMPP specific settings
Include "conf/extra/httpd-xampp.conf"
# Server-pool management (MPM specific)
Include "conf/extra/httpd-mpm.conf"
# Multi-language error messages
Include "conf/extra/httpd-multilang-errordoc.conf"
# Fancy directory listings
Include "conf/extra/httpd-autoindex.conf"
# Language settings
Include "conf/extra/httpd-languages.conf"
# User home directories
Include "conf/extra/httpd-userdir.conf"
# Real-time info on requests and configuration
Include "conf/extra/httpd-info.conf"
# Virtual hosts
Include "conf/extra/httpd-vhosts.conf"
# Distributed authoring and versioning (WebDAV)
# Attention! WEB_DAV is a security risk without a new userspecific configuration for a secure authentifcation
# Include "conf/extra/httpd-dav.conf"
# Implements a proxy/gateway for Apache.
Include "conf/extra/httpd-proxy.conf"
# Various default settings
Include "conf/extra/httpd-default.conf"
# Secure (SSL/TLS) connections
Include "conf/extra/httpd-ssl.conf"
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
# Configure mod_proxy_html to understand HTML4/XHTML1
#<IfModule proxy_html_module>
#Include etc/extra/proxy-html.conf
#</IfModule>
# AJP13 Proxy
<IfModule mod_proxy.c>
<IfModule mod_proxy_ajp.c>
Include "conf/extra/httpd-ajp.conf"
</IfModule>
</IfModule>
The only other thing I could think off was the config.ini file or my bootstrap.. however I can't really find anything wrong with those either...
Config.ini:
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
resources.db.adapter = "PDO_MYSQL"
resources.db.params.host = "localhost"
resources.db.params.username = "root"
resources.db.params.password = ""
resources.db.params.dbname = "mydb"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
[staging : production]
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
Bootstrap:
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initViewHelpers() {
$view = new Zend_View();
$view->addHelperPath( APPLICATION_PATH . '/views/helpers/', 'Application_View_Helper');
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
}
}
Last thing could be the htaccess file but aside from the application environment it's unchanged from when I generated the project using the Zend Tool...
SetEnv APPLICATION_ENV development
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
If anyone is able to crack and solve this problem I will construct a statue in your image! (metaphorically)
UPDATE:
As requested here's the link that I create to link towards the student controller:
<p>Studenten</p>
Note: This link is on the view of the IndexController's IndexAction.
UPDATE 2:
To clarify my project structure I have the proper directory setup for my controllers, their actions and corresponding views.
For example views/scripts/student/ has a index.phtml, add.phtml, edit.phtml and delete.phtml. The same goes for the other controllers

You can use the <a href> tag like this
Student
Second
Third
Try this i hope it works.
If you have a any problem then let me know.

try 'localhost/demo/public/index.php/student' for the link, and be sure you have an indexAction in studentController.

imho you have to make a directory "student" under views/scripts/ and move student.phtml from views/scripts/index directory to views/scripts/student directory
In that case your existing link should work.

Related

Bugzilla: Code on start

I tried to install Bugzilla on my Raspberry. Everything is greater than the minimum system requirements and I installed perl lib to apache too, but I got this when I wanted to "run" it.
#!/usr/bin/perl -T
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use Bugzilla;
use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::Update;
# Check whether or not the user is logged in
my $user = Bugzilla->login(LOGIN_OPTIONAL);
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
my $vars = {};
# And log out the user if requested. We do this first so that nothing
# else accidentally relies on the current login.
if ($cgi->param('logout')) {
Bugzilla->logout();
$user = Bugzilla->user;
$vars->{'message'} = "logged_out";
# Make sure that templates or other code doesn't get confused about this.
$cgi->delete('logout');
}
# Return the appropriate HTTP response headers.
print $cgi->header();
if ($user->in_group('admin')) {
# If 'urlbase' is not set, display the Welcome page.
unless (Bugzilla->params->{'urlbase'}) {
$template->process('welcome-admin.html.tmpl')
|| ThrowTemplateError($template->error());
exit;
}
# Inform the administrator about new releases, if any.
$vars->{'release'} = Bugzilla::Update::get_notifications();
}
if ($user->id) {
my $dbh = Bugzilla->dbh;
$vars->{assignee_count} =
$dbh->selectrow_array("SELECT COUNT(*) FROM bugs WHERE assigned_to = ?
AND resolution = ''", undef, $user->id);
$vars->{reporter_count} =
$dbh->selectrow_array("SELECT COUNT(*) FROM bugs WHERE reporter = ?
AND resolution = ''", undef, $user->id);
$vars->{requestee_count} =
$dbh->selectrow_array('SELECT COUNT(DISTINCT bug_id) FROM flags
WHERE requestee_id = ?', undef, $user->id);
}
# Generate and return the UI (HTML page) from the appropriate template.
$template->process("index.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
What I missed? Or should I use an another issue tracker? (MantisBT)
Assuming that by "run it" you mean "Visited an HTTP URL pointing to your Raspbery Pi on the network in a web browser" and that by "this" you mean "The source code of the CGI program was rendered in the browser" then:
You haven't configured Apache to support CGI for whereever you installed Bugzilla.
The Apache manual page covers how to do this in detail.
You'll need to start by loading the module:
LoadModule cgid_module modules/mod_cgid.so
and enabling CGI for the location you put Bugzilla:
<Directory "/path/to/bugzilla/">
Options +ExecCGI
AddHandler cgi-script .cgi
</Directory>
This is helped me
nano /etc/apache2/sites-available/bugzilla.conf
Paste in the following and save:
ServerName localhost
<Directory /var/www/html/bugzilla>
AddHandler cgi-script .cgi
Options +ExecCGI
DirectoryIndex index.cgi index.html
AllowOverride All
</Directory>
$ a2ensite bugzilla
$ a2enmod cgi headers expires
$ service apache2 restart
Referral URL:
https://bugzilla.readthedocs.io/en/latest/installing/quick-start.html#configure-apache

MAMP 500 Internal Server Error

I got a little problem.
I made two virtual hosts "web-backend.local" and "oplossingen.web-backend.local".
But I always have a "500 Internal Server Error"
What am I doing wrong?
Hosts file:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
# MAMP VirtualHost Mappings
127.0.0.1 web-backend.local
127.0.0.1 oplossingen.web-backend.local
httpd-vhosts.conf:
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
#NameVirtualHost *:80
#
# 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 web-backend.local:* >
DocumentRoot "/Users/yawuarsernadelgado/Documents/web-backend/cursus"
ServerName web-backend.local
<Directory "/Users/yawuarsernadelgado/Documents/web-backend/cursus">
AllowOverride All
Require all granted
Options +Indexes
IndexOptions NameWidth=*
</Directory>
ServerAlias web-backend.local
</VirtualHost>
<VirtualHost oplossingen.web-backend.local:* >
DocumentRoot "/Users/yawuarsernadelgado/Documents/web-backend/oplossingen"
ServerName oplossingen.web-backend.local
<Directory "/Users/yawuarsernadelgado/Documents/web-backend/oplossingen">
Allow from all
Require all granted
Options +Indexes
IndexOptions NameWidth=*
</Directory>
</VirtualHost>
Although it's reported MAMP 500 Server Error, it usually has little to do with MAMP.
500 internal server errors indicate you have crashed php pages. the solution is to add following error-reporting php code in your potential crashed page:
// display php error
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if you use jQuery.Ajax, then I am afraid the code above in action.php won't work, there is another method, which is followed by
add this to index.html or index.php
<div id="show-error" style="position: fixed; z-index: 10000; height: 20vh; width: 100vw; background:#f08080; border-radius:20px; opacity: 0.8; display: flex; font-size: 2rem; justify-content: center; align-items: center; display: none;"></div>
in the php file called by ajax, set a success code and failue code
try{
// main
echo json_encode(['status' => 1, 'msg' => 'succeed']);
}catch(Exception $e){
echo json_encode(['status' => 0, 'msg' => $e->getMessage()]);
}
finallly, in the ajax javascript file, catch error if it occurs
$.ajax({
url: '../php/action.php',
method: 'POST',
data: array('some data'),
}).done(function(result){
var output = JSON.parse(result);
if(output.status == 0){
$('#show-error').show();
$('#show-error').html(output.msg);
exit();
}else{
// no error occurred
}
});
Remove the following lines from httpd-vhosts.conf file from each virtual host:
<Directory "/Users/yawuarsernadelgado/Documents/web-backend/cursus">
AllowOverride All
Require all granted
Options +Indexes
IndexOptions NameWidth=*
</Directory>
Worked for me :D

Can't access hosts after upgrading to MAMP PRO 3.1: Connection Refused

I just upgraded to MAMP PRO 3.1, and I can't access any sites through vhosts. I can still get to the default localhost page and localhost/phpMyAdmin. If I try to create a new hosts entry or use an existing one, I get an ERR_CONNECTION_REFUSED in Chrome. I can ping the host entry and get 127.0.0.1 back, but nothing works in the browser. There's also nothing in the logs. Any help would be appreciated!
EDIT
Here is the httpd.conf according to MAMP.
ServerRoot "/Applications/MAMP/Library"
<IfModule !mpm_netware.c>
PidFile logs/httpd.pid
</IfModule>
MAMP_IP_Port_iteration_begin_MAMP
Listen MAMP_IP_Port_MAMP
MAMP_IP_Port_iteration_end_MAMP
MAMP_authn_file_module_MAMPLoadModule authn_file_module modules/mod_authn_file.so
MAMP_authn_dbm_module_MAMPLoadModule authn_dbm_module modules/mod_authn_dbm.so
MAMP_authn_anon_module_MAMPLoadModule authn_anon_module modules/mod_authn_anon.so
MAMP_authn_dbd_module_MAMPLoadModule authn_dbd_module modules/mod_authn_dbd.so
MAMP_authn_default_module_MAMPLoadModule authn_default_module modules/mod_authn_default.so
MAMP_authz_host_module_MAMPLoadModule authz_host_module modules/mod_authz_host.so
MAMP_authz_groupfile_module_MAMPLoadModule authz_groupfile_module modules/mod_authz_groupfile.so
MAMP_authz_user_module_MAMPLoadModule authz_user_module modules/mod_authz_user.so
MAMP_authz_dbm_module_MAMPLoadModule authz_dbm_module modules/mod_authz_dbm.so
MAMP_authz_owner_module_MAMPLoadModule authz_owner_module modules/mod_authz_owner.so
MAMP_authz_default_module_MAMPLoadModule authz_default_module modules/mod_authz_default.so
MAMP_auth_basic_module_MAMPLoadModule auth_basic_module modules/mod_auth_basic.so
MAMP_auth_digest_module_MAMPLoadModule auth_digest_module modules/mod_auth_digest.so
MAMP_file_cache_module_MAMPLoadModule file_cache_module modules/mod_file_cache.so
MAMP_cache_module_MAMPLoadModule cache_module modules/mod_cache.so
MAMP_disk_cache_module_MAMPLoadModule disk_cache_module modules/mod_disk_cache.so
MAMP_mem_cache_module_MAMPLoadModule mem_cache_module modules/mod_mem_cache.so
MAMP_dbd_module_MAMPLoadModule dbd_module modules/mod_dbd.so
MAMP_bucketeer_module_MAMPLoadModule bucketeer_module modules/mod_bucketeer.so
MAMP_dumpio_module_MAMPLoadModule dumpio_module modules/mod_dumpio.so
MAMP_echo_module_MAMPLoadModule echo_module modules/mod_echo.so
MAMP_case_filter_module_MAMPLoadModule case_filter_module modules/mod_case_filter.so
MAMP_case_filter_in_module_MAMPLoadModule case_filter_in_module modules/mod_case_filter_in.so
MAMP_reqtimeout_module_MAMPLoadModule reqtimeout_module modules/mod_reqtimeout.so
MAMP_ext_filter_module_MAMPLoadModule ext_filter_module modules/mod_ext_filter.so
MAMP_include_module_MAMPLoadModule include_module modules/mod_include.so
MAMP_filter_module_MAMPLoadModule filter_module modules/mod_filter.so
MAMP_substitute_module_MAMPLoadModule substitute_module modules/mod_substitute.so
MAMP_charset_lite_module_MAMPLoadModule charset_lite_module modules/mod_charset_lite.so
MAMP_deflate_module_MAMPLoadModule deflate_module modules/mod_deflate.so
MAMP_log_config_module_MAMPLoadModule log_config_module modules/mod_log_config.so
MAMP_logio_module_MAMPLoadModule logio_module modules/mod_logio.so
MAMP_env_module_MAMPLoadModule env_module modules/mod_env.so
MAMP_mime_magic_module_MAMPLoadModule mime_magic_module modules/mod_mime_magic.so
MAMP_cern_meta_module_MAMPLoadModule cern_meta_module modules/mod_cern_meta.so
MAMP_expires_module_MAMPLoadModule expires_module modules/mod_expires.so
MAMP_headers_module_MAMPLoadModule headers_module modules/mod_headers.so
MAMP_ident_module_MAMPLoadModule ident_module modules/mod_ident.so
MAMP_usertrack_module_MAMPLoadModule usertrack_module modules/mod_usertrack.so
MAMP_unique_id_module_MAMPLoadModule unique_id_module modules/mod_unique_id.so
MAMP_setenvif_module_MAMPLoadModule setenvif_module modules/mod_setenvif.so
MAMP_version_module_MAMPLoadModule version_module modules/mod_version.so
MAMP_proxy_module_MAMPLoadModule proxy_module modules/mod_proxy.so
MAMP_proxy_connect_module_MAMPLoadModule proxy_connect_module modules/mod_proxy_connect.so
MAMP_proxy_ftp_module_MAMPLoadModule proxy_ftp_module modules/mod_proxy_ftp.so
MAMP_proxy_http_module_MAMPLoadModule proxy_http_module modules/mod_proxy_http.so
MAMP_proxy_scgi_module_MAMPLoadModule proxy_scgi_module modules/mod_proxy_scgi.so
MAMP_proxy_ajp_module_MAMPLoadModule proxy_ajp_module modules/mod_proxy_ajp.so
MAMP_proxy_balancer_module_MAMPLoadModule proxy_balancer_module modules/mod_proxy_balancer.so
MAMP_ssl_module_MAMPLoadModule ssl_module modules/mod_ssl.so
MAMP_mime_module_MAMPLoadModule mime_module modules/mod_mime.so
MAMP_dav_module_MAMPLoadModule dav_module modules/mod_dav.so
MAMP_status_module_MAMPLoadModule status_module modules/mod_status.so
MAMP_autoindex_module_MAMPLoadModule autoindex_module modules/mod_autoindex.so
MAMP_asis_module_MAMPLoadModule asis_module modules/mod_asis.so
MAMP_info_module_MAMPLoadModule info_module modules/mod_info.so
MAMP_cgi_module_MAMPLoadModule cgi_module modules/mod_cgi.so
MAMP_fastcgi_module_MAMPLoadModule fastcgi_module modules/mod_fastcgi.so
MAMP_cgid_module_MAMPLoadModule cgid_module modules/mod_cgid.so
MAMP_dav_fs_module_MAMPLoadModule dav_fs_module modules/mod_dav_fs.so
MAMP_vhost_alias_module_MAMPLoadModule vhost_alias_module modules/mod_vhost_alias.so
MAMP_negotiation_module_MAMPLoadModule negotiation_module modules/mod_negotiation.so
MAMP_dir_module_MAMPLoadModule dir_module modules/mod_dir.so
MAMP_imagemap_module_MAMPLoadModule imagemap_module modules/mod_imagemap.so
MAMP_actions_module_MAMPLoadModule actions_module modules/mod_actions.so
MAMP_speling_module_MAMPLoadModule speling_module modules/mod_speling.so
MAMP_userdir_module_MAMPLoadModule userdir_module modules/mod_userdir.so
MAMP_alias_module_MAMPLoadModule alias_module modules/mod_alias.so
MAMP_rewrite_module_MAMPLoadModule rewrite_module modules/mod_rewrite.so
MAMP_perl_module_MAMPLoadModule perl_module modules/mod_perl.so
MAMP_wsgi_module_MAMPLoadModule wsgi_module modules/mod_wsgi.so
MAMP_xsendfile_module_MAMPLoadModule xsendfile_module modules/mod_xsendfile.so
MAMP_php_module_MAMP
MAMP_php_ini_dir_MAMP
#
AddType application/x-httpd-php .php .phtml
# Security: Disable HTTP TRACE support
TraceEnable off
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User MAMP_User_MAMP
Group MAMP_Group_MAMP
</IfModule>
</IfModule>
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin#your-domain.com
#
ServerAdmin you#example.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName MAMP_ServerName_MAMP
#
# 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.
#
# MAMP DOCUMENT_ROOT !! Don't remove this line !!
DocumentRoot "MAMP_DocumentRoot_MAMP"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options Includes
AllowOverride None
</Directory>
#
# 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.
#
<IfModule xsendfile_module>
XSendFile on
</IfModule>
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "MAMP_DocumentRoot_MAMP">
#
# 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 MAMP_DocumentRoot_Options_MAMP
#
# 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
<IfModule xsendfile_module>
XSendFilePath "MAMP_DocumentRoot_MAMP"
</IfModule>
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
<IfModule perl_module>
DirectoryIndex index.pl
</IfModule>
<IfModule wsgi_module>
DirectoryIndex index.wsgi index.py
</IfModule>
</IfModule>
#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives. See also the AllowOverride
# directive.
#
AccessFileName .htaccess
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
<Files ~ "^\.DS_Store">
Order allow,deny
Deny from all
</Files>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "MAMP_ErrorLog_MAMP"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel error
#
# ServerTokens
# This directive configures what you return as the Server HTTP response
# Header. The default is 'Full' which sends information about the OS-Type
# and compiled in modules.
# Set to one of: Full | OS | Minor | Minimal | Major | Prod
# where Full conveys the most information, and Prod the least.
#
#ServerTokens Full
ServerTokens Prod
#
# Optionally add a line containing the server version and virtual host
# name to server-generated pages (internal error documents, FTP directory
# listings, mod_status and mod_info output etc., but not CGI generated
# documents or custom error documents).
# Set to "EMail" to also include a mailto: link to the ServerAdmin.
# Set to one of: On | Off | EMail
#
ServerSignature Off
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
#CustomLog "/Applications/MAMP/logs/apache_access.log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "/Applications/MAMP/logs/apache_access.log" combined
</IfModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# We include the /icons/ alias for FancyIndexed directory listings. If you
# do not use FancyIndexing, you may comment this out.
#
Alias /icons/ "/Applications/MAMP/Library/icons/"
<Directory "/Applications/MAMP/Library/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Alias /phpMyAdmin "/Library/Application Support/appsolute/MAMP PRO/phpMyAdmin"
Alias /phpmyadmin "/Library/Application Support/appsolute/MAMP PRO/phpMyAdmin"
<Directory "/Library/Application Support/appsolute/MAMP PRO/phpMyAdmin">
Options Indexes
AllowOverride None
Order deny,allow
Deny from all
Allow from localhost
Allow from 127.0.0.1
Allow from ::1
</Directory>
Alias /phpPgAdmin "/Library/Application Support/appsolute/MAMP PRO/phpPgAdmin"
Alias /phppgadmin "/Library/Application Support/appsolute/MAMP PRO/phpPgAdmin"
<Directory "/Library/Application Support/appsolute/MAMP PRO/phpPgAdmin">
Options Indexes
AllowOverride None
Order deny,allow
Deny from all
Allow from localhost
Allow from 127.0.0.1
Allow from ::1
</Directory>
Alias /phpLiteAdmin "/Applications/MAMP/bin/phpLiteAdmin"
Alias /phpliteadmin "/Applications/MAMP/bin/phpLiteAdmin"
<Directory "/Applications/MAMP/bin/phpLiteAdmin">
Options Indexes
AllowOverride None
Order deny,allow
Deny from all
Allow from localhost
Allow from 127.0.0.1
Allow from ::1
</Directory>
Alias /SQLiteManager "/Applications/MAMP/bin/SQLiteManager"
Alias /sqlitemanager "/Applications/MAMP/bin/SQLiteManager"
<Directory "/Applications/MAMP/bin/SQLiteManager">
Options Indexes
AllowOverride None
Order deny,allow
Deny from all
Allow from localhost
Allow from 127.0.0.1
Allow from ::1
</Directory>
Alias /MAMP "/Library/Application Support/appsolute/MAMP PRO/mamp"
<Directory "/Library/Application Support/appsolute/MAMP PRO/mamp">
Options Indexes
AllowOverride None
Order deny,allow
Deny from all
Allow from localhost
Allow from 127.0.0.1
Allow from ::1
</Directory>
Alias /MAMP/favicon.ico "/Applications/MAMP/bin/favicon.ico"
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "/Applications/MAMP/cgi-bin/"
Alias /perl/ "/Applications/MAMP/cgi-bin/"
<IfModule perl_module>
PerlModule ModPerl::Registry
<Location /perl>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
</Location>
</IfModule>
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock logs/cgisock
</IfModule>
#
# "/Applications/MAMP/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/Applications/MAMP/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig /Applications/MAMP/conf/apache/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
AddHandler cgi-script .cgi .pl
AddHandler wsgi-script .wsgi .py
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
<IfModule mime_magic_module>
MIMEMagicFile /Applications/MAMP/conf/apache/magic
</IfModule>
<IfModule ssl_module>
SSLRandomSeed startup file:/dev/urandom 1024
SSLRandomSeed connect file:/dev/urandom 1024
#
# Uncomment the next line if Apache should not accept SSLv3 connections, to learn more google for "POODLE SSLv3".
# SSLProtocol All -SSLv2 -SSLv3
</IfModule>
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
#
# 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.
#
<IfModule mod_userdir>
UserDir MAMP_UserDir_MAMP
#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#
<Directory "MAMP_UserDir_MAMP">
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
</IfModule>
<IfModule mod_fastcgi.c>
# URIs that begin with /fcgi-bin/, are found in /var/www/fcgi-bin/
Alias /fcgi-bin/ "/Applications/MAMP/fcgi-bin/"
# Anything in here is handled as a "dynamic" server if not defined as "static" or "external"
<Directory "/Applications/MAMP/fcgi-bin/">
SetHandler fastcgi-script
Options +ExecCGI
</Directory>
# Anything with one of these extensions is handled as a "dynamic" server if not defined as
# "static" or "external". Note: "dynamic" servers require ExecCGI to be on in their directory.
AddHandler fastcgi-script .fcgi .fpl
MAMP_ActionPhpCgi_MAMP
MAMP_FastCgiServer_MAMP
</IfModule>
MAMP_VirtualHosts_begin_MAMP
#
# MAMP virtual hosts
#
MAMP_IP_or_Star_Port_iteration_begin_MAMP
NameVirtualHost MAMP_IP_or_Star_Port_MAMP
MAMP_IP_or_Star_Port_iteration_end_MAMP
MAMP_Port_iteration_begin_MAMP
#<VirtualHost _default_:MAMP_Port_MAMP>
# DocumentRoot "MAMP_DocumentRoot_MAMP"
#</VirtualHost>
MAMP_Port_iteration_end_MAMP
MAMP_VirtualHost_iteration_begin_MAMP
<VirtualHost MAMP_VirtualHost_IP_MAMP:MAMP_VirtualHost_Port_MAMP>
ServerName MAMP_VirtualHost_ServerName_MAMP
MAMP_VirtualHost_ServerAdmin_MAMP
MAMP_VirtualHost_DirectoryIndex_MAMP
DocumentRoot "MAMP_VirtualHost_DocumentRoot_MAMP"
<IfModule xsendfile_module>
XSendFilePath "MAMP_VirtualHost_DocumentRoot_MAMP"
</IfModule>
MAMP_VirtualHost_ServerAliases_MAMP
<Directory "MAMP_VirtualHost_DocumentRoot_MAMP">
Options MAMP_VirtualHost_Options_MAMP
AllowOverride MAMP_VirtualHost_AllowOverride_MAMP
Order MAMP_VirtualHost_Order_MAMP
Allow MAMP_VirtualHost_Allow_MAMP
MAMP_VirtualHost_DirectoryCustom_MAMP
</Directory>
MAMP_VirtualHost_WSGIDAEMON_MAMP
MAMP_VirtualHost_WSGIAPP_MAMP
MAMP_VirtualHost_ActionPhpCgi_MAMP
MAMP_VirtualHost_AdditionalCustom_MAMP
</VirtualHost>
MAMP_VirtualHost_iteration_end_MAMP
MAMP_VirtualHosts_end_MAMP
#
# Supplemental configuration
#
# The configuration files in the /Applications/MAMP/conf/apache/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
#Include /Applications/MAMP/conf/apache/extra/httpd-mpm.conf
# Multi-language error messages
#Include /Applications/MAMP/conf/apache/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include /Applications/MAMP/conf/apache/extra/httpd-autoindex.conf
# Language settings
#Include /Applications/MAMP/conf/apache/extra/httpd-languages.conf
# Real-time info on requests and configuration
#Include /Applications/MAMP/conf/apache/extra/httpd-info.conf
# Local access to the Apache HTTP Server Manual
#Include /Applications/MAMP/conf/apache/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include /Applications/MAMP/conf/apache/extra/httpd-dav.conf
# Various default settings
#Include /Applications/MAMP/conf/apache/extra/httpd-default.conf
# Secure (SSL/TLS) connections
MAMP_SSL_Include_MAMP
# DONT REMOVE: MAMP PRO httpd.conf template compatibility version: 17
took me 2 hours to figure out that mamp automatically redirects to www.yourhost.local from yourhost.local but etc/host didn't get 127.0.0.1 www.yourhost.local
so try either add
127.0.0.1 www.yourhost.local
to your etc/hosts
or make mamp not to redirect to www.
I had this as well and I reinstalled MAMP PRO. Did not help.
BUT I had deleted a folder which was my root folder when I recreated that folder (empty) everything worked again
In my case it looked like this
under tab HOSTS
left window
localhost Document root (bottom right window) read Username > Sites > keeper
I had deleted the folder keeper and it did not work. When I created a new empty folder with the name keeper it worked again. I do not remember changing the folder to localhost, but I must have done it.

Jail user to their home doesn't work

I'm using proftpd on Debian 7.
I need to jail each user in their own home directory, so they can't see and access parent folders.
Actually each user is logged in his own homedir but they can see and access parent folders.
As you can see below, I have already tried DefaultRoot ~ developers and also DefaultRoot ~ .
How can I jail each user in their own home directory, so they can't see and access parent folders?
This is my proftpd.conf
#
# /etc/proftpd/proftpd.conf -- This is a basic ProFTPD configuration file.
# To really apply changes, reload proftpd after modifications, if
# it runs in daemon mode. It is not required in inetd/xinetd mode.
#
# Includes DSO modules
Include /etc/proftpd/modules.conf
# Set off to disable IPv6 support which is annoying on IPv4 only boxes.
UseIPv6 on
# If set on you can experience a longer connection delay in many cases.
IdentLookups off
ServerName "Debian"
ServerType standalone
DeferWelcome off
MultilineRFC2228 on
DefaultServer on
ShowSymlinks on
TimeoutNoTransfer 600
TimeoutStalled 600
TimeoutIdle 1200
DisplayLogin welcome.msg
DisplayChdir .message true
ListOptions "-l"
DenyFilter \*.*/
# Use this to jail all users in their homes
DefaultRoot ~ developers
#DocumentRoot ~
# Users require a valid shell listed in /etc/shells to login.
# Use this directive to release that constrain.
# RequireValidShell off
# Port 21 is the standard FTP port.
Port 21
# In some cases you have to specify passive ports range to by-pass
# firewall limitations. Ephemeral ports can be used for that, but
# feel free to use a more narrow range.
# PassivePorts 49152 65534
# If your host was NATted, this option is useful in order to
# allow passive tranfers to work. You have to use your public
# address and opening the passive ports used on your firewall as well.
# MasqueradeAddress 1.2.3.4
# This is useful for masquerading address with dynamic IPs:
# refresh any configured MasqueradeAddress directives every 8 hours
<IfModule mod_dynmasq.c>
# DynMasqRefresh 28800
</IfModule>
# To prevent DoS attacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd)
MaxInstances 30
# Set the user and group that the server normally runs at.
User proftpd
Group nogroup
# Umask 022 is a good standard umask to prevent new files and dirs
# (second parm) from being group and world writable.
Umask 022 022
# Normally, we want files to be overwriteable.
AllowOverwrite on
# Uncomment this if you are using NIS or LDAP via NSS to retrieve passwords:
# PersistentPasswd off
# This is required to use both PAM-based authentication and local passwords
# AuthOrder mod_auth_pam.c* mod_auth_unix.c
# Be warned: use of this directive impacts CPU average load!
# Uncomment this if you like to see progress and transfer rate with ftpwho
# in downloads. That is not needed for uploads rates.
#
# UseSendFile off
TransferLog /var/log/proftpd/xferlog
SystemLog /var/log/proftpd/proftpd.log
# Logging onto /var/log/lastlog is enabled but set to off by default
#UseLastlog on
# In order to keep log file dates consistent after chroot, use timezone info
# from /etc/localtime. If this is not set, and proftpd is configured to
# chroot (e.g. DefaultRoot or <Anonymous>), it will use the non-daylight
# savings timezone regardless of whether DST is in effect.
#SetEnv TZ :/etc/localtime
<IfModule mod_quotatab.c>
QuotaEngine off
</IfModule>
<IfModule mod_ratio.c>
Ratios off
</IfModule>
# Delay engine reduces impact of the so-called Timing Attack described in
# http://www.securityfocus.com/bid/11430/discuss
# It is on by default.
<IfModule mod_delay.c>
DelayEngine on
</IfModule>
<IfModule mod_ctrls.c>
ControlsEngine off
ControlsMaxClients 2
ControlsLog /var/log/proftpd/controls.log
ControlsInterval 5
ControlsSocket /var/run/proftpd/proftpd.sock
</IfModule>
<IfModule mod_ctrls_admin.c>
AdminControlsEngine off
</IfModule>
#
# Alternative authentication frameworks
#
#Include /etc/proftpd/ldap.conf
#Include /etc/proftpd/sql.conf
#
# This is used for FTPS connections
#
#Include /etc/proftpd/tls.conf
#
# Useful to keep VirtualHost/VirtualRoot directives separated
#
#Include /etc/proftpd/virtuals.conf
# A basic anonymous configuration, no upload directories.
# <Anonymous ~ftp>
# User ftp
# Group nogroup
# # We want clients to be able to login with "anonymous" as well as "ftp"
# UserAlias anonymous ftp
# # Cosmetic changes, all files belongs to ftp user
# DirFakeUser on ftp
# DirFakeGroup on ftp
#
# RequireValidShell off
#
# # Limit the maximum number of anonymous logins
# MaxClients 10
#
# # We want 'welcome.msg' displayed at login, and '.message' displayed
# # in each newly chdired directory.
# DisplayLogin welcome.msg
# DisplayChdir .message
#
# # Limit WRITE everywhere in the anonymous chroot
# <Directory *>
# <Limit WRITE>
# DenyAll
# </Limit>
# </Directory>
#
# # Uncomment this if you're brave.
# # <Directory incoming>
# # # Umask 022 is a good standard umask to prevent new files and dirs
# # # (second parm) from being group and world writable.
# # Umask 022 022
# # <Limit READ WRITE>
# # DenyAll
# # </Limit>
# # <Limit STOR>
# # AllowAll
# # </Limit>
# # </Directory>
#
# </Anonymous>
# Include other custom configuration files
Include /etc/proftpd/conf.d/
<Global>
AccessGrantMsg "Benvenuto sul server demo Up3Up! Ricordati di fare sempre un backup di cio' che modifichi!"
AccessDenyMsg "Accessi al server FTP demo di Up3Up errati!"
</Global>
This is how I create users and set their own homedir
#!/bin/bash
echo "Procedura per la creazione di un utente FTP . . ."
#Chiedo il nome dell'account
read -p "Inserisci il nome (senza #up3up.net): " user
#Chiedo il percorso
echo "Percorso per $user # up3up.net (senza /var/www/up3upn/public_html/)"
read -p "Inserisci il percorso: " percorso
#Se non esiste il percorso lo creo
mkdir /var/www/up3upn/public_html/"$percorso" &> /dev/null
#Avverto che verra' chiesta la password
echo "Inserisci la password in chiaro per $user # up3up.net"
#Creo l'account' e chiedo la password
useradd -d /var/www/up3upn/public_html/"$percorso" "$user" &> /dev/null
usermod -m -d /var/www/up3upn/public_html/"$percorso" "$user" &> /dev/null
useradd -G developers "$user" &> /dev/null
passwd "$user"
echo "Account creato $user # up3up.net con percorso /var/www/up3upn/public_html/$percorso"
#Riavvio il servizio FTP
service proftpd restart &> /dev/null
you have to create a Group (like ftpjail) ald add all users that should be jailed to this group.
Then add the line to your proftpd.conf (must not be at end of file):
DefaultRoot ~ ftpjail # this must be a group!
now restart your FTP-Server and now the users are chrooted and jailed!
I had the same problem.. I found out that the DefaultRoot ~ developers line needs to be at the end of the config file..

Joomla after SEF " Page Not Found " 404 Error?

I am trying to open URL of article from Facebook page on my website but the problem is every time error 404 is raised although the article is exists .
After searching I find that there is problem in .htaccess codes and I need help in this.
The problem :
URL : like from facebook page
Website : worked like Real link
As you can see there different between this two links.
The part is added "component/content/" and without the another language prefix "ar".
Some Details :
This is my .htaccess file :
> ##
# #package Joomla
# #copyright Copyright (C) 2005 - 2012 Open Source Matters. All rights reserved.
# #license GNU General Public License version 2 or later; see LICENSE.txt
##
##
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!
#
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations. It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file. If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's. If they work,
# it has been set by your server administrator and you do not need it set here.
##
## Can be commented out if causes errors, see notes above.
Options +FollowSymLinks
## Mod_rewrite in use.
RewriteEngine On
## Begin - Rewrite rules to block out some common exploits.
# If you experience problems on your site block out the operations listed below
# This attempts to block the most common type of exploit `attempts` to Joomla!
#
# Block out any script trying to base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block out any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL.
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* index.php [F]
#
## End - Rewrite rules to block out some common exploits.
## Begin - Custom redirects
#
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
#
## End - Custom redirects
##
# Uncomment following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root).
##
RewriteBase /
## Begin - Joomla! core SEF Section.
#
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the request is for something within the component folder,
# or for the site root, or for an extensionless URL, or the
# requested URL ends with one of the listed extensions
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
#
# Forward to sitemap
Redirect /sitemap.xml http://www.businesstendersmag.com/ar/?option=com_xmap&view=xml&tmpl=component&id=3
## End - Joomla! core SEF Section.
That's all! Any help will be appreciated.
How do you generate URLs that are posted to Facebook?
Are you generating URLs like this?
// require com_content router.
require_once (JPATH_SITE.'/components/com_content/helpers/route.php');
// generate link.
$link = JURI::root() . substr( JRoute::_( ContentHelperRoute::getArticleRoute( $article->slug, $article->categorySlug ) ), strlen(JURI::base(true)) + 1);
// Where $article->slug & $article->categorySlug are fetched from database.