Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-04-2007, 08:41 PM   #1
LQ Newbie
Registered: Feb 2007
Posts: 8

Rep: Reputation: 0
PHP5 and Apache Conifg?

I am new to this and using OpenSUSE 10.2. I originally posted in the programming forum but realized that this is probably such a newbie error that it belonged here, so here it goes :-):

I had the SUSE install program go ahead and install MySQL and PHP5 as wellnwhile I set up the operating system. 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:

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.

Old 02-05-2007, 09:49 AM   #2
LQ Newbie
Registered: Feb 2007
Posts: 8

Original Poster
Rep: Reputation: 0
Question answered

I was able to get this answered in another thread:

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:

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

# 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__________________

Old 09-04-2007, 11:35 AM   #3
LQ Newbie
Registered: Sep 2007
Posts: 2

Rep: Reputation: 0
Check permissions

You need to check the permissions of every file created within.
If you see the permissions on '/srv/www/htdocs/phptest.php' it will be 700. For every new file you create in /srv/www/htdocs dir, it will be 700 (suppose you have permissions to write to that dir).

Changing every file permissions to 705 worked for me.

Last edited by mandaksk; 09-04-2007 at 11:37 AM.


apache2, error, pear, php5

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Glitch? on Apache 2.2.3/PHP5.2.0 Tralce Linux - General 0 11-19-2006 04:15 PM
apache 2 with php5 and mysql5 jghalo Linux - Software 2 09-08-2006 01:24 PM
apache + php5 + mysql dejan_su Debian 2 05-23-2006 01:55 PM
Apache and PHP5 Mogatu Linux - Software 3 06-17-2005 03:43 PM
redhat-network-conifg error 2 bourbon_beast Linux - Laptop and Netbook 2 05-17-2004 02:18 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:27 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration