executing programs from .. (non)progress

David Lloyd davidlloyd at bigpond.com
Tue May 14 00:27:40 CST 2013


1. Make a page in your web server's directory root (the same place as the index.html) and then put:

<?php phpinfo(); ?>

...in that page.

2. Call it "info.php" without the double quotes.

3. If you see the 1000 lines in nice-ish HTML output your PHP is configured.

You do seem to be getting a file permissions error.

Who does your file server run as?

  ps auxww | egrep 'http|apache'

_www             200   0.0  0.0  2452912   2024   ??  S     6:59pm   0:00.00 /usr/sbin/httpd -D FOREGROUND

Notice that _www then the 200. You want to figure out who the _www is. Yours could be daemon, root, webserver, apache or whatever. The point is, _www needs to be able to read the info.php (and other) files. Otherwise, logically, PHP won't work because the web server can't even serve the pages to the PHP engine.

You need to make the info.php or whatever you've called it readable by the webserver. The easiest way to do that is to go in as root and chmod 777 it BUT THAT IS NOT ADVISED. Figure out what user your webserver is running as (unless you're on OS X it's probably not _www but whatever is in place of the _www above) and then changing the file owenership t that.

PLUS don't rely on plain old / and the webserver yet. You'll get confused.

If you want:

 http://localhost/index.html

SAY SO

If you want:

 http://localhost/index.php

SAY SO

If you want:

 http://localhost/index.cgi

SAY SO.

DO NOT assume that:

 http://localhost/

...will be behave as you expect it to - it probably won't. TELL your webserver what you want. Don't assume it'll get it correct (most newcomers to webservers make this assumption and then waste a day or two at least wondering why http://mywonderfulsite.com/ serves up a default web page)/

DSL



More information about the linuxsa mailing list