Bug 702569 - Server throws HTTP 500 Internal Error when accessing http://localhost/beacon/php
Summary: Server throws HTTP 500 Internal Error when accessing http://localhost/beacon/php
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: beacon
Version: 14
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Satya Komaragiri
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 701509
TreeView+ depends on / blocked
 
Reported: 2011-05-06 07:17 UTC by Joshua Wulf
Modified: 2015-09-12 22:41 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-08-26 09:41:25 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
New rpm that works (172.13 KB, application/x-rpm)
2011-05-11 06:16 UTC, Joshua Wulf
no flags Details

Description Joshua Wulf 2011-05-06 07:17:54 UTC
Description of problem:
After installing beacon on F14 and F13, accessing http://localhost/beacon/php returns HTTP 500 Internal Error.
 
Nothing in the apache error log.

Comment 1 Satya Komaragiri 2011-05-06 08:40:24 UTC
Could you please try saving this as index.php and under your /var/www/html and access it via localhost?

<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>

Comment 2 Joshua Wulf 2011-05-06 11:25:15 UTC
Result:

Could not connect: Access denied for user 'mysql_user'@'localhost' (using password: YES)

If I put in a valid user name and password, I get:

Connected successfully

Comment 3 Joshua Wulf 2011-05-06 12:13:46 UTC
OK, kind of weird. After I did that test, suddenly beacon started working. Not sure if it's causally related. 

Misty, can try the instruction in Comment 1 above and see if it gets beacon to work on your machine?

Comment 4 Joshua Wulf 2011-05-06 13:36:15 UTC
After the step in comment 1:

1. Edit /usr/share/beacon/php/login.php
   Comment out code for external login; uncomment code for mysql login
2. Edit /usr/share/beacon/php/lib/BeaconAPI.php
   On the first line, change <? to <?php

Comment 5 Joshua Wulf 2011-05-11 06:16:17 UTC
Created attachment 498208 [details]
New rpm that works

1. Install the attached rpm
2. Create a mysql table called beacon
3. Create a mysql user beacon, password beacon. Give it permission on the beacon table
4. Paste this into /usr/share/beacon/test.php:

<?php
$link = mysql_connect('localhost', 'beacon', 'beacon');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>

5. Open http://localhost/beacon/test.php. Verify that database connection works.
6. Open http://localhost/beacon/php

Comment 6 David Le Sage 2011-05-11 23:20:19 UTC
Forgive my newbie question but I found step 2 ambiguous, Josh.  Am I meant to create a new database to house this table or use an existing one?  


I couldn't determine the name of an existing DB from reading the PHP scripts, so I undertook the following steps in MySQL, creating a new DB called Beacon:


CREATE DATABASE beacon;
USE beacon;
CREATE TABLE beacon (
         id INT,
          data VARCHAR(100)
        );
CREATE USER 'beacon'@'localhost' IDENTIFIED BY 'beacon';
GRANT Select, Insert ON beacon.beacon TO 'beacon'@'%';

Haven't done any SQL work for ages so there may be problems.  Note I created a minimal table - if anything is being written to it during the test connection, it may need more fields....

Comment 7 David Le Sage 2011-05-11 23:28:44 UTC
To clarify, in the test script, you have 

$link = mysql_connect('localhost', 'beacon', 'beacon');


I presume localhost = machine
First beacon = db name
Second beacon = table name

in this syntax.

Comment 8 Joshua Wulf 2011-05-11 23:33:17 UTC
1. s/table/database

2. password.

You need the beacon database. The beacon app has a script that will write your tables for you, so delete the table.

yum install mysql-workbench it will make your life so much easier.

Comment 9 David Le Sage 2011-05-12 01:23:46 UTC
Well, I didn't do any more changes or edits but I simply rebooted my machine (for an unrelated reason), restarted httpd and mysqld and launched my browser and pointed back at Beacon and it all just started working.  8-|

Comment 10 David Le Sage 2011-05-12 01:26:28 UTC
Actually, the splash page does report this error:

Error: Please check the database name in your settings.


but it is obviously connecting now as I can see the "Welcome to Beacon" message, Logo graphic, status info and so on. Note that I had deleted the beacon table/DB I had manually created in Comment 7 as per Josh's advice.

Comment 11 Satya Komaragiri 2011-05-12 06:22:09 UTC
Just for reference: There is a file README_DATABASE in the rpm, which contains details on how to set up the database.

http://git.tuxfamily.org/?p=gitroot/beacon/trunk.git;a=blob_plain;f=README_DATABASE;hb=HEAD is the upstream link to it.

Comment 12 Satya Komaragiri 2011-05-12 06:25:23 UTC
The default settings use the database name 'beacon', user name 'beacon' and password 'beacon'


So,

CREATE DATABASE beacon;
CREATE USER 'beacon'@'localhost' IDENTIFIED BY 'beacon';
GRANT ALL PRIVILEGES ON beacon.* TO 'beacon'@'localhost';

Should do the trick.

The tables are created automatically.

You can choose another name but then you'll have to change the settings in beacon/php/settings.php

Comment 13 David Le Sage 2011-05-12 06:34:20 UTC
Thanks for that!  A couple of things to note, though.  I encountered this SQL error but everything worked anyway once I moved past that step:


CREATE USER 'beacon'@'localhost' IDENTIFIED BY 'beacon';

ERROR 1396 (HY000): Operation CREATE USER failed for 'beacon'@'localhost'



When I went back to Beacon in the browser, it prompted me to create the tables and accepted username/login as Beacon at that time.

Comment 14 Satya Komaragiri 2011-05-12 06:40:06 UTC
The default settings use the database name 'beacon', user name 'beacon' and password 'beacon'


So,

CREATE DATABASE beacon;
CREATE USER 'beacon'@'localhost' IDENTIFIED BY 'beacon';
GRANT ALL PRIVILEGES ON beacon.* TO 'beacon'@'localhost';

Should do the trick.

The tables are created automatically.

You can choose another name but then you'll have to change the settings in beacon/php/settings.php

Comment 15 Satya Komaragiri 2011-05-12 06:41:48 UTC
Sorry for the duplicate comment above.

The mysql error is most probably because the user beacon was already created (as I can see form Comment #6) so it could not re-create it.

That should not be a problem.

Comment 16 Satya Komaragiri 2011-05-23 19:30:41 UTC
Shall we close this bug?

Comment 17 Dave M 2011-06-15 15:46:51 UTC
(In reply to comment #16)
> Shall we close this bug?

Please don't just yet.  Although possibly for a separate bug report, I believe the package "php-mysql" should be a requirement for beacon.  Additionally, I would love to see updated documentation here:
https://fedoraproject.org/wiki/DocBook_Editor_Documentation .

I went through the steps for as identified in /usr/share/doc/beacon-0.5/README_DATABASE, installed the extra package php-mysql.  That gave me a screen where I was told the database was not installed.  So, I set it up (again) using username 'beacon', password ******, and a throwaway email address.  This took me back to the login screen, where those credentials don't work.

Any help with this?

Comment 18 Satya Komaragiri 2011-06-15 18:06:41 UTC
Did you try the rpm attached with this bug? I believe you were trying to yum update as php-mysql has been added as a dependency in this attachment in addition to a few bug fixes. It will also solve the wrong credentials problem. 

Please try and let me know how it goes.

Comment 19 Dave M 2011-06-15 19:12:51 UTC
Sorry, I did miss that.  It works on this end.  Thanks!

Comment 20 Satya Komaragiri 2011-08-26 09:41:25 UTC
Closing this bug.


Note You need to log in before you can comment on or make changes to this bug.