failed to open stream: Permission denied

Problems with the Linux version of XAMPP, questions, comments, and anything related.

failed to open stream: Permission denied

Postby jodha » 27. December 2008 18:55

Hi Apache Friends,

I've got a little problem with my Ubuntu install of Xampp... I'm working through some books to bring my PHP and mySQL up to speed. For the record, the install I have on my Windows laptop seems OK, but I am retiring from all things MicroSoft so I'd like to wrap my head around this problem.

Code from book used in test file starts:
test php file wrote:<?php

/* Program: mysql_up.php

* Desc: Connects to MySQL Server and

* outputs settings.

*/


echo "<html>

<head><title>Test MySQL</title></head>

<body>";

$host="I have the correct text here";

$user="I have the correct text here";

$password="I have the correct text here";



$cxn = mysqli_connect($host,$user,$password);

$sql="SHOW STATUS";

$result = mysqli_query($cxn,$sql);

if($result == false)

{

echo "<h4>Error: ".mysqli_error($cxn)."</h4>";

}

else

{

/* Table that displays the results */

This should connect to mySQL and provide a table on the page, but what I get is the following message:
browser error message wrote:Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0

Warning: Unknown: Failed opening '/opt/lampp/htdocs/sparky/mysql_up.php' for inclusion (include_path='.:/opt/lampp/lib/php') in Unknown on line 0


Anybody know what the problem is?

Many thanks :)
jodha
 
Posts: 3
Joined: 27. December 2008 18:44

Re: failed to open stream: Permission denied

Postby Wiedmann » 27. December 2008 18:59

The file "mysql_up.php" have wrong permissions (or a wrong owner/group).
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: failed to open stream: Permission denied

Postby jodha » 27. December 2008 19:06

Interesting, let me see if I understand this correctly...

I took the sample code from the CD that came with the book I am working through, because I am in a Linux O/S this means the file is 'not owned by me', because I was not created by me.

If I copy the code within the file, paste it into a new file, then save this new file, I should be OK?

My logic = this way the computer is saving the code in a file 'I made', thus the permissions should then work properly.

Lets try this out...
jodha
 
Posts: 3
Joined: 27. December 2008 18:44

Re: failed to open stream: Permission denied

Postby jodha » 27. December 2008 19:09

That worked.

Marvellous.

Many thanks Wiedmann :)

[/problem]
jodha
 
Posts: 3
Joined: 27. December 2008 18:44


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 17 guests