Error message "You don't have permission to access / on this server."
I had been running an Apache webserver under
OS X El Capitan on my
MacBook
Pro laptop. After an upgrade on the laptop, now running
OS X El Capitan (10.11.6), when I tried accessing the site
via http://localhost
, I saw a page with the title "403 Forbidden"
and the following text displayed on the page:
Forbidden
You don't have permission to access /
on this server.
[ More Info ]
[/os/os-x/apache]
permanent link
Using Python scripts with Apache on OS X El Capitan
If you've got the
Apache web server software working
under OS X El Capitan, but want to use
Python scripts with
Apache, the following steps will allow you to
run Python
scripts from a cgi-bin directory.
First, ensure that the hash sign (#) is removed from the
LoadModule cgi_module libexec/apache2/mod_cgi.so
in
/etc/apache2/httpd.conf
. If you need to remove the hash/pound sign,
restart Apache after modifying the file, which you can do with
sudo apachectl restart
. You will also need to use the
sudo command
to edit the file, if you edit it with a text editor such as
GNU nano or
vi.
[ More Info ]
[/os/os-x/apache]
permanent link
Using Perl with Apache under OS X El Capitan
If you've got
Apache running on your Mac OS X system
and want to be able to display the output of
Perl programs,
you need to remove the hash sign (#) from the following line in
/etc/apache2/httpd.conf.
#LoadModule cgi_module libexec/apache2/mod_cgi.so
You will neeed to edit the file with a
text editor,
such as the
TextEdit app found in the Applications
directory, or
GNU nano or
vi. And you will
need to run the editor with root, i.e., administrator privileges by using the
sudo command in order to be able to save
modifications to the file. E.g.:
sudo nano /etc/apache2/httpd.conf
[ More Info ]
[/os/os-x/apache]
permanent link
PHP for Apache on OS X El Capitan
If you are
running an Apache web server under OS X
El Capitan and want to use
PHP with Apache, you will need to take some additional steps
after you've got Apache running on
OS X/macOS. Once you've got Apache working on the system,
you can create a .php file, e.g.
phptest.php
and have the page
displayed by your browser if you visit the page, but PHP code within the page
won't be executed. E.g., suppose the
phptest.php
page contains
the following code:
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PHP Test</title>
</head>
<body>
<h2>A test page</h2>
<?php phpinfo(); ?>
</body>
</html>
If I visit the page using a browser, the HyperText Markup Language
(HTML) code on the page will be displayed, e.g. the "A test page"
heading will be displayed, but the information that the phpinfo()
command would display regarding the PHP settings for a system on which
PHP is working won't be displayed. You could also try a simple PHP echo
command, e.g. <?php echo "This is the output from a PHP echo
command."; ?>
, but the output from that command would not be
displayed, either.
[ More Info ]
[/os/os-x/apache]
permanent link