LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   PHP5 Fatal Error Message (http://www.linuxquestions.org/questions/programming-9/php5-fatal-error-message-525590/)

geoffmat 02-04-2007 05:06 PM

PHP5 Fatal Error Message
 
Hello,

I have searched the forum so I hope this is not a repeat post. I am new to this and just installed OpenSUSE 10.2 and had the install program go ahead and install MySQL and PHP5 as well. When I run the "PHP Test" file that comes with it everything works great (even if I change the extension from .php5 to .php). However, when I tried my own test:
<?php

echo "If this works, we <i>really</i> did it!";

?>

and saved this as "phptest.php" I received the following error:

Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0 Fatal error: Unknown: Failed opening required '/srv/www/htdocs/phptest.php' (include_path='.:/usr/share/php5:/usr/share/php5/PEAR') in Unknown on line 0

I looked at the aforementioned directories and they appear to all have the "755" permissions. I also tried renaming the file to .php5 and it worked (??). But f I put HTML (i.e. <TITLE>PHPTest</TITLE> with appropriate added tags, it gives me the same error again.

I am running Apache 2, if that helps. My guess is there is some configuration I need to change somewhere. Anyone have any ideas?

Sorry for the long post.

Thanks
Geoff

graemef 02-04-2007 09:32 PM

If using the extension .php5 works but .php doesn't then I suspect that it is an apache error. You will need to modify the httpd.conf script (or a configuration file called by this script -- sorry I don't know how it is set up in SUSE) The lines you want to look for are as follows:

Code:

# Load php - you should have this since .php5 works
LoadModule php5_module modules/libphp5.so

# Cause the PHP interpreter to handle files with a .php extension.
AddHandler php5-script .php
AddType text/html .php

# Add index.php to the list of files that will be served as default
DirectoryIndex index.php


geoffmat 02-05-2007 09:47 AM

Thank you
 
It looks like that worked, although I am frustrated because I am not completely sure why ;-)

It said the module was already included, so I commented that piece out but left the other lines in.

Thanks again!
Geoff


All times are GMT -5. The time now is 11:50 AM.