Bug 702569
Summary: | Server throws HTTP 500 Internal Error when accessing http://localhost/beacon/php | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Joshua Wulf <jwulf> | ||||
Component: | beacon | Assignee: | Satya Komaragiri <satya.komaragiri> | ||||
Status: | CLOSED CURRENTRELEASE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
Severity: | unspecified | Docs Contact: | |||||
Priority: | unspecified | ||||||
Version: | 14 | CC: | dave.nerd, dlesage, lcarlon, maurizio.antillon, satya.komaragiri, skomarag | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2011-08-26 09:41:25 UTC | Type: | --- | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Bug Depends On: | |||||||
Bug Blocks: | 701509 | ||||||
Attachments: |
|
Description
Joshua Wulf
2011-05-06 07:17:54 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); ?> 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 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? 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 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 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.... 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. 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. 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-| 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. 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. 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 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. 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 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. Shall we close this bug? (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? 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. Sorry, I did miss that. It works on this end. Thanks! Closing this bug. |