PDA

View Full Version : Mac OS X 10.1.3 / PHP assistance needed


Gordon Werner
03-17-2002, 07:30 PM
OK ...

So I have OS X 10.1.3 on my cube running without any real problems. So I decided that I wanted to try to take advantage of having PHP4 and MySQL available on my computer for web development.

So, I went into my httpd.conf file and uncommented the commands to load the PHP4 modules as described in the excellent articles (http://www.oreillynet.com/pub/ct/49) at the O'Reilly Network.

Everything seems to work as expected ... I now have PHP4 on my Cube.

However, and here is the problem, in one of my test files I tried using both the include() and require() functions to include a global variable file in my main php document.

When I tried viewing the page I got the following error message:

Fatal error: Failed opening required 'defs.inc' (include_path='.:/usr/lib/php') in /Users/gordon/Sites/file.php on line 1

Now the file "defs.inc" (in the example above) is in the same directory as the main file "file.php"

Can anyone assist me in changing the settings so that this will work?

I appreciate any and every piece of advice that all y'all can provide.

Thanks in advance,

Gordon

[ 03-17-2002: Message edited by: Gordon Werner ]

spunk
03-18-2002, 01:55 AM
You should just be able to include the file like so:

include("defs.inc");
Does your php file include look different? I have not had this problem on my computer and I am running OS 10.1.3. Oh, and by the way: If the file you are including stores important passwords or other vital information you do not want to call it .inc - you would want to put .php at the end. If the file is called inc then anyone can open the file in the browser and it will be displayed as plain text. Calling it a .php files requires php to parse the document and nothing will be sent to the browser.

SpunK

stetner
03-18-2002, 05:20 AM
I think I have seen this error when the php file to include was not readable by the web server. Do an 'ls -l' on your included php file and show us the results. It needs to be readable by the web server, so that means either:
1) world readable (say rwxr--r-- )
2) owned by 'www' and user readable ( say rwx------ )
3) group www and group readable (say ( rwxr----- )

I would think that 2 or 3 is the safer way to go.....

Keep in mind that for your cgi's (perl etc) they will need to be executable as well as readable.

Cheers