Question

I have installed macports and updated my path:

via docs: http://guide.macports.org/#installing.shell.postflight

but now if I test any of the sites in my Sites folder, I get a 404. so for instance if I go to localhost/~carey/test.php which is just a php_info, I get a 404

If I go to:

localhost/

I get the It Works! page

Am I missing a step to configure Macports to run apache from my Sites directory?

If I run $env from the command line I get:

TERM_PROGRAM=Apple_Terminal
SHELL=/bin/bash
TERM=xterm-256color
TMPDIR=/var/folders/rs/943jh19j31j3ld55yxqgf2mm0000gn/T/
Apple_PubSub_Socket_Render=/tmp/launch-NehzDd/Render
TERM_PROGRAM_VERSION=326
TERM_SESSION_ID=A329EAC2-AE9F-4460-BB1B-B35981BAE0ED
USER=carey
SSH_AUTH_SOCK=/tmp/launch-CgUaVv/Listeners
__CF_USER_TEXT_ENCODING=0x1F5:0:0
PATH=/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin
__CHECKFIX1436934=1
PWD=/Users/carey
LANG=en_US.UTF-8
SHLVL=1
HOME=/Users/carey
LOGNAME=carey
SECURITYSESSIONID=186b0
_=/usr/bin/env

and I can run any macport install, but I cannot configure the terminal to connect to my localhost in the browser.

So I think I have macports installed correctly, but I dont know how to make it run out of the /opt directory.

I also think this is relative to establishing the env variables, so apache knows to look to the /opt dir, but I don't know how to change it.

I am running Mavericks.

UPDATE

Following the docs recommended by eborisch here: https://trac.macports.org/wiki/howto/MAMP

I have been able to setup the localhost directory, but still an issue.

Since I have multiple users on the machine, I had to comment out this line in httpd.conf:

Include conf/extra/httpd-userdir.conf

and added this to the httpd-userdir.conf file:

#
# Include user configurations
#
Include /private/etc/apache2/users/*.conf

which connects my Sites folder to the localhost.

I also needed to add this to the httpd.conf file to parse php files as php:

AddType application/x-httpd-php .php

Now, I have a file in my Sites dir called test.php, which has <?php phpinfo() ?>

and if I run localhost/~carey/test.php in the browser it works. phpinfo() returns that I am running php5.5.10 out of the /opt/ dir. So, all seems well. The problem is if I try to run any sites from folders in this directory. It just displays the directory tree, rather than treating it like a site.

For instance if I run,

localhost/~carey/mysite

it just returns:

Index of /~carey/mysite

Parent Directory
2005/
2006/
index.php
../

If I run

localhost/~carey/mysite/index.php

it runs that file correctly (ie looks correct in the browser)

Seems like an .htaccess issue, but not sure how I would resolve that globally for each folder in the Sites directory

any suggestions?

Was it helpful?

Solution

Probably better served on https://lists.macosforge.org/mailman/listinfo/macports-users/ the macports mailing list. But some basics:

Is the osx web server running? (Web sharing under the sharing control panel?) If so, turn it off, or configure the two to use different ports.

Is the macports apache2 installed? (sudo port install apache2) Is it running? (sudo port load apache2)

Have you edited its configuration (/opt/local/apache2/conf/httpd.conf)?

See https://trac.macports.org/wiki/howto/MAMP for instructions on getting things up and running.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top