Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: head123 on July 09, 2013, 10:49:19 AM

Title: HTTP 500 Internal Server Error on search...
Post by: head123 on July 09, 2013, 10:49:19 AM
Hi,
M getting HTTP 500 Internal Server Error on searching massage.
I tried to find ERROR LOG for this, No error log was thr.
m not getting reason for this. plz provide ur help.

i m a admin user.

Title: Re: HTTP 500 Internal Server Error on search...
Post by: vbgamer45 on July 09, 2013, 12:41:03 PM
On any search or a specific search?
Title: Re: HTTP 500 Internal Server Error on search...
Post by: MrPhil on July 09, 2013, 12:56:06 PM
Could be a lot of reasons to get this error. Start by reading my sig > FAQs > 500 (Internal Server) Errors and see if you can rule out some of the reasons.
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 10, 2013, 05:28:54 AM
 vbgamer45 : getting error on msg search. On Simple search and advance search.
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 10, 2013, 05:35:10 AM
Also i set file permission to 777 to all directories of smf. Location of smf directory is = /usr/local/apache/htdocs/smf . and root user is owner
Title: Re: HTTP 500 Internal Server Error on search...
Post by: Storman™ on July 10, 2013, 05:36:38 AM
Have you ruled out what MrPhil suggested ?

QuoteCould be a lot of reasons to get this error. Start by reading my sig > FAQs > 500 (Internal Server) Errors and see if you can rule out some of the reasons.
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 10, 2013, 06:48:05 AM
yes, i read that. and now with the help of that, i set the permission to 755 and restarted apache2 service. but :( m getting following error on each page/ any click/ any navigation/ even m not able to log out.

ERROR :attempt to write a readonly database

File: /usr/local/apache/htdocs/smf_setup/Sources/Subs.php
Line: 2624
Title: Re: HTTP 500 Internal Server Error on search...
Post by: kat on July 10, 2013, 06:59:41 AM
Quote from: head123 on July 10, 2013, 06:48:05 AMERROR :attempt to write a readonly database

I'd suggest that you want to have a word with your host, about that.

A "Read-only" database isn't much use, for a forum. Ask them to ensure that you have full CHOWN ownership of the files on your site, too.
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 10, 2013, 07:21:06 AM
I debugged this, as per my study : file/directory owner is wrong... need to set CHOWN to same user as "webserver user". I think webserver will not be able to write into files.

Current status : File permissions : 644
                          Folder permissions : 755
All file/folder 's owner is root user.

tell me, Is this wrong setting.
How i set owner user same as "webserver user" ?
Title: Re: HTTP 500 Internal Server Error on search...
Post by: kat on July 10, 2013, 07:29:23 AM
Are you self-hosted? (Might've helped, if you'd told us, if you are)

If not, you'll need to contact your host.

Unless you're self-hosted, you can't change CHOWN settings.
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 10, 2013, 07:32:15 AM
Quote from: K@ on July 10, 2013, 06:59:41 AM
Quote from: head123 on July 10, 2013, 06:48:05 AMERROR :attempt to write a readonly database

I'd suggest that you want to have a word with your host, about that.

A "Read-only" database isn't much use, for a forum. Ask them to ensure that you have full CHOWN ownership of the files on your site, too.


It is working before permission / owner change........
Title: Re: HTTP 500 Internal Server Error on search...
Post by: kat on July 10, 2013, 07:36:27 AM
Quote from: K@ on July 10, 2013, 07:29:23 AM
Are you self-hosted?
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 10, 2013, 07:48:19 AM
No, but i m able to change owner.
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 10, 2013, 07:59:40 AM
:)  resolved : ERROR attempt to write a readonly database. :) By changing the file permission to 777  with owner to daemon user (webserver user)

But, msg search in thronging 500 Internal server error. Rest all the things / search is going well.

File permission 777 is wrong thing, i wanna change it but if decrease permission i faced 'ERROR attempt to write a readonly database'.

now what to do???
Title: Re: HTTP 500 Internal Server Error on search...
Post by: kat on July 10, 2013, 08:15:06 AM
Quote from: head123 on July 10, 2013, 07:48:19 AMNo, but i m able to change owner.

You SEEM to be able to change owner. But, in all likelihood, you can't. It'll look like you have, though.

I still think you want to have a chat with your host, myself.

I could be wrong, of course. ;)
Title: Re: HTTP 500 Internal Server Error on search...
Post by: MrPhil on July 10, 2013, 09:04:08 AM
Quote from: head123 on July 10, 2013, 07:59:40 AM
:)  resolved : ERROR attempt to write a readonly database. :) By changing the file permission to 777  with owner to daemon user (webserver user)

But, msg search in thronging 500 Internal server error. Rest all the things / search is going well.

File permission 777 is wrong thing, i wanna change it but if decrease permission i faced 'ERROR attempt to write a readonly database'.

First of all, never go blindly changing permissions to 777. They're rarely necessary, and can be a major security problem. Many servers are configured to throw 500 errors when they encounter a "world writable" file or directory (such as 777 permissions). Files should always start out 644 and directories 755. Add "write" to the group (664/775) if SMF complains it can't write to something. Go to 666/777 ONLY if it still can't write, and change it back to 644/755 as soon as you can when you're done with the mod install or whatever you're doing.

What kind of database are you using? Normally you would have no access to the database's files (.myi etc. files), so I don't know what you're doing that gives you "readonly database" errors. We need more information here about your system configuration. When you "decrease permissions", what are you changing file and directory permissions to? 644 and 755? You can try 664 and 775, but that shouldn't have any effect on a database in a normal server configuration.
Title: Re: HTTP 500 Internal Server Error on search...
Post by: Kindred on July 10, 2013, 09:27:35 AM
are you using mySQL or SQLite?
Title: Re: HTTP 500 Internal Server Error on search...
Post by: Storman™ on July 10, 2013, 09:35:48 AM
Bet it's the latter  ;)
Title: Re: HTTP 500 Internal Server Error on search...
Post by: Kindred on July 10, 2013, 09:41:26 AM
yup...   when he kept referncing unwritabel database with regards to file permissions, it almost has to be.

If so -- my best suggestion is to convert to mySQL instead.
Title: Re: HTTP 500 Internal Server Error on search...
Post by: MrPhil on July 10, 2013, 10:00:18 AM
Does SQLite require 664/775 permissions? I hope it doesn't require 666/777. If it does, the rest of SMF can be left at 644/755 or 664/775 -- there's no reason they have to be all the same. It all depends on what PHP is running as (owner, in your group, or as a random "other" user), and likewise for the database system. For SMF, if 666/777 is required for PHP to write, leave only the avatars and attachments directories at that permission, and set everything else to 644/755 until you need to install a mod or do other work, and then temporarily change to 666/777.
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 10, 2013, 10:26:18 AM
Quote from: Kindred on July 10, 2013, 09:27:35 AM
are you using mySQL or SQLite?
mySQL
Title: Re: HTTP 500 Internal Server Error on search...
Post by: Kindred on July 10, 2013, 11:20:11 AM
then I fail to see how changing the file permisssions woudl generate a DATABASE permission error.  That makes no sense at all, unless your host has a VERY screwy set up.

(or maybe you set the actual database files to a bad permission deep in the root of your hosting service?   Although, why you would do that, I have no idea...)
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 10, 2013, 11:53:46 AM
Quote from: MrPhil on July 10, 2013, 09:04:08 AM
Quote from: head123 on July 10, 2013, 07:59:40 AM
:)  resolved : ERROR attempt to write a readonly database. :) By changing the file permission to 777  with owner to daemon user (webserver user)

But, msg search in thronging 500 Internal server error. Rest all the things / search is going well.

File permission 777 is wrong thing, i wanna change it but if decrease permission i faced 'ERROR attempt to write a readonly database'.

First of all, never go blindly changing permissions to 777. They're rarely necessary, and can be a major security problem. Many servers are configured to throw 500 errors when they encounter a "world writable" file or directory (such as 777 permissions). Files should always start out 644 and directories 755. Add "write" to the group (664/775) if SMF complains it can't write to something. Go to 666/777 ONLY if it still can't write, and change it back to 644/755 as soon as you can when you're done with the mod install or whatever you're doing.

What kind of database are you using? Normally you would have no access to the database's files (.myi etc. files), so I don't know what you're doing that gives you "readonly database" errors. We need more information here about your system configuration. When you "decrease permissions", what are you changing file and directory permissions to? 644 and 755? You can try 664 and 775, but that shouldn't have any effect on a database in a normal server configuration.

I changed permission as per ur suggestions to 644-file and 755-directory Also 664-filr and 775-directory but got error:  "Database Error. Please try again. If you come back to this error screen, report the error to an administrator"
I am using mySQL.
One question: Does SMF works without any db?  .... Because i was a smf_cd5ccb554f.db file in /usr/local/apache/htdocs/smf/  ..... i couldn't find any db for SMF in mySQL
Title: Re: HTTP 500 Internal Server Error on search...
Post by: Kindred on July 10, 2013, 12:03:30 PM
1- you should never, ever, ever touch the database FILES unless you know EXACTLY what you are doing.
2- the database files would not be in the smf directory... they would be int he directory of your root system configured to hold the mySQL database files.
3- No.. SMF *REQUIRES* a database. mySQL is the preferred, but it supports SQLite and PostGRE
Title: Re: HTTP 500 Internal Server Error on search...
Post by: Storman™ on July 10, 2013, 02:08:56 PM
I would suggest you nuke the whole instance, get your host to reinstall, and then start again.

It should basically work out the box without any of the errors.
Title: Re: HTTP 500 Internal Server Error on search...
Post by: MrPhil on July 10, 2013, 02:17:45 PM
If this is really MySQL, you should have no way to get anywhere near the actual files in the database. They should be well protected from you, and the only way to do anything is through the server interface. Anyway, your error message "Database Error. Please try again. If you come back to this error screen, report the error to an administrator" I think is generated by SMF when it can't connect to the database for some reason. I can't look at my code until tonight to be sure. In the mean time, double check your database connection information in the Settings.php file (DB name, location, user name, user password), and make sure that file is readable (at least 444 permissions).
Title: Re: HTTP 500 Internal Server Error on search...
Post by: Oldiesmann on July 10, 2013, 06:19:34 PM
It sounds like you are/were using SQLite, not MySQL. SQLite uses .db files, and would give you the "read-only database" error. MySQL stores data in numerous files (usually one file per database, with additional files handling the indexes, table structure, etc.), and would say something like "Permission denied for user <user>@localhost (using password: YES)" instead.
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 12, 2013, 11:48:04 AM
Now, I am doing setup from first step, before that i clear browser IE history + restarted apache2 and mysql services + deleted old installation directory + copied new one

On the 3rd step of SMF Installer : Database Setting, m getting following error 

==============================================================
Critical Error!
Cannot connect to the database server with the supplied data.
If you are not sure about what to type in, please contact your host.
unable to open database: /usr/local/apache/htdocs/forum/smf_1/smf_1c3d709289.db
==============================================================


On 2nd step : Writable check -
I only provide following details :
host:- localhost, user :-root, password:-(password of root user which is used to access this machine. i.e. login password) , installation path : /usr/local/apache/htdocs/forum/smf_1
Title: Re: HTTP 500 Internal Server Error on search...
Post by: Kindred on July 12, 2013, 11:52:52 AM
1- why would you ever use your root account to access the database?
2- from that installation message, it would appear that you are indeed trying to use SQLite.   Why?
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 13, 2013, 04:38:44 AM
1. only for full access.
2. SQLite / mySQL both are ok for me. no database specification, just wanna up the forum with its msg searching feature...
Title: Re: HTTP 500 Internal Server Error on search...
Post by: Storman™ on July 13, 2013, 05:25:46 AM
Quoteonly for full access.

Not quite sure what you mean by that?

If you are using your root account in Settings.php to access the databse then potentially that puts the whole instance at risk should it get compromised.

QuoteSQLite / mySQL both are ok for me

Then use mySQL as SQLite is obviously giving you issues  ;)

Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 17, 2013, 06:09:26 AM
Can not select Database (MySQL).........

Hi, i am doing fresh smf installation, i found that installation not asking me for selection of database. Here are the screen shot. please check it.
And on the 3rd step i got Critical Error : unable to open database /usr/local/apache/htdocs/smf/smf_6be6604b0d.db


Before installation-- i removed old smf setup directory + deleted browser hostory   
Title: Re: HTTP 500 Internal Server Error on search...
Post by: Illori on July 17, 2013, 06:37:51 AM
please keep to one topic, your other thread has been locked.

if you are using a .db file you are using sqlite and it is recommended you look into using mysql instead.
Title: Re: HTTP 500 Internal Server Error on search...
Post by: Kindred on July 17, 2013, 06:50:19 AM
yep...   see that line that says "database filename"?
That is for SQLite.

mySQL doe snot have you define a database filename....
it asks for database name, database host, database username and password
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 17, 2013, 07:00:42 AM
ok. I provided user and password of FTP. For SQLite what should i suppose to provided / or what should i suppose to do ?
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 17, 2013, 07:03:52 AM
Do i need to install SQLite on this machine??    (MySQL is already installed.)

Title: Re: HTTP 500 Internal Server Error on search...
Post by: Kindred on July 17, 2013, 07:06:27 AM
the username and password for FTP is **DIFFERENT** from the database user and database password.

I don't know what choices you have made to get to that point, but you have obviously told it to use SQLite, for some reason and in some way.
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 17, 2013, 07:13:06 AM
So, in this case its good to proceed with SQLite. m i Right ?
If Yes, what should be next step?
Title: Re: HTTP 500 Internal Server Error on search...
Post by: Illori on July 17, 2013, 07:15:03 AM
no it is not good to proceed with sqlite, it has issues and restrictions. mysql is a much better option.
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 17, 2013, 07:18:08 AM
ok :)
So now, what suppose to next step?
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 17, 2013, 07:26:46 AM
On 2nd step of installation : Writable Check :
I put username/pass : root/****   (with this password i can connect to mysql )

I got error : Unable to connect to FTP server with this combination of details.
530 Login incorrect
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 17, 2013, 07:33:15 AM
Should i create new MySQL user ???
Title: Re: HTTP 500 Internal Server Error on search...
Post by: Storman™ on July 17, 2013, 07:47:21 AM
Yes, never use root.

And make sure you also give that user suitable MySQL permissions otherwise you'll still have the same problem.

http://dev.mysql.com/doc/refman/5.1/en/adding-users.html

If you used a control panel like cPanel then this is dead easy to do. Something like a control panel may be beneficial for you.
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 17, 2013, 08:15:03 AM

m using machine :-Ubuntu 10.04.4
So, i executed following commands--
1. mysql -u root -p****
2. CREATE DATABASE smf_database ;
3. GRANT ALL ON smf_database.* TO smf_user@localhost IDENTIFIED BY '****';
4. logout
5. mysql -u smf_user -p****
6. show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| smf_database       |
+--------------------+
2 rows in set (0.00 sec)
-----------------------------------------------------
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 17, 2013, 08:16:38 AM
Still the error same : Unable to connect to FTP server with this combination of details.

530 Login incorrect


on step 2: I provided new created mySQL user name and password.  :(
Title: Re: HTTP 500 Internal Server Error on search...
Post by: Storman™ on July 17, 2013, 09:16:19 AM
Off topic but any reason why you are using an older version of Ubuntu, it's "End of Life" date was back in May 2013.:

https://lists.ubuntu.com/archives/ubuntu-announce/2013-March/000169.html

Problem here is that this isn't really an SMF issue, it's becoming more to do with setting up your server so that it works correctly. That makes me wonder about other services on the instance and whether they are set-up correctly, or even installed and running.
Title: Re: HTTP 500 Internal Server Error on search...
Post by: Illori on July 17, 2013, 10:17:39 AM
no you have asked already and we told you not to use sqlite.
Title: Re: HTTP 500 Internal Server Error on search...
Post by: MrPhil on July 17, 2013, 10:25:08 AM
If MySQL (version 5) is available, you'll find it much easier to use than SQLite. If it's not available, you'll just have to soldier on with SQLite, though it's not the optimal choice.

I'm concerned about your platform. Is this a PC running a LAMPP stack, or a real honest-to-goodness professionally run server? If it's a PC, don't use it for a server connected to the Internet, or you will be hacked and pwned so fast you won't know what hit you. Especially, if it's a home-brew aggregation of this and that, rather than a proper LAMPP stack installation. I guarantee that the hackers will know more about your security (or lack of it) than you or whoever is running this "server". If it's isolated from the Internet, you might be safe, but should still be using a LAMPP stack to ensure that everything works together.
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 18, 2013, 05:01:31 AM
Yes, PC running LAMP stack. And this forum will be available in LAN only,  isolated  from internet.

My problems are :
1. installation not asking for MySQL or SQLite selection (Please refer above screen shots )

2. If I proceed to next installation step and provide username and password of MySQL user >>
            ERROR : Unable to connect to FTP server with this combination of details.530 Login incorrect

3. If I provide username and password of FTP user >>  Then installation proceed to next step "Database setting" >>
    - It asks for database filename :-
          a. string "/usr/local/apache/htdocs/forum/smf_bd5880ebd0.db" is already typed in the database filename textbox  >> so i kept that and click 'continue' >>
             Critical Error! Cannot connect to the database server with the supplied data. If you are not sure about what to type in, please contact your host.
             unable to open database: /usr/local/apache/htdocs/forum/smf_bd5880ebd0.db
       
          b. on retry I provided database filename :- Name od MySQL database which i created.
              Critical Error! Cannot connect to the database server with the supplied data. If you are not sure about what to type in, please contact your host.
             unable to open database: /usr/local/apache/htdocs/forum/smf_database.db

           
Title: Re: HTTP 500 Internal Server Error on search...
Post by: Illori on July 18, 2013, 05:17:32 AM
then it sounds like you dont know how to configure your server correctly, which is beyond the support we provide here.
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 18, 2013, 07:51:43 AM
Quote from: MrPhil on July 17, 2013, 10:25:08 AM
If MySQL (version 5) is available, you'll find it much easier to use than SQLite. If it's not available, you'll just have to soldier on with SQLite, though it's not the optimal choice.

I'm concerned about your platform. Is this a PC running a LAMPP stack, or a real honest-to-goodness professionally run server? If it's a PC, don't use it for a server connected to the Internet, or you will be hacked and pwned so fast you won't know what hit you. Especially, if it's a home-brew aggregation of this and that, rather than a proper LAMPP stack installation. I guarantee that the hackers will know more about your security (or lack of it) than you or whoever is running this "server". If it's isolated from the Internet, you might be safe, but should still be using a LAMPP stack to ensure that everything works together.

Yes, PC running LAMP stack. And this forum will be available in LAN only,  isolated  from internet.
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 18, 2013, 07:55:45 AM
Quote from: Illori on July 18, 2013, 05:17:32 AM
then it sounds like you dont know how to configure your server correctly, which is beyond the support we provide here.

:( yes, m not good in configure server things.... also my machine showing me errror and error  for my all alternative tries.
I really really need ur support ...
Title: Re: HTTP 500 Internal Server Error on search...
Post by: Illori on July 18, 2013, 07:59:25 AM
we dont provide support here on configuring servers from scratch, sorry.
Title: Re: HTTP 500 Internal Server Error on search...
Post by: MrPhil on July 18, 2013, 09:15:33 AM
If it really has a LAMPP (or LAMP) stack installed, the "M" is for MySQL. It sounds like a totally botched installation and/or configuration. Are you really required to use SQLite for the forum, or does someone need it for another project? AFAIK MySQL and SQLite can coexist on a machine, so you can go ahead and use MySQL for SMF -- does anyone have contrary information?
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 18, 2013, 09:59:58 AM
Quote from: MrPhil on July 18, 2013, 09:15:33 AM
If it really has a LAMPP (or LAMP) stack installed, the "M" is for MySQL. It sounds like a totally botched installation and/or configuration. Are you really required to use SQLite for the forum, or does someone need it for another project? AFAIK MySQL and SQLite can coexist on a machine, so you can go ahead and use MySQL for SMF -- does anyone have contrary information?

No I dont required  to use SQLite for the forum, no one need it for another project.
I want to use MySQL  for SMF.
But facing errors. and want support to resolve the errors
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 18, 2013, 10:10:20 AM
A very first problem is SMF installer is not asking for "Database Type" ... Please refer screen shot
Title: Re: HTTP 500 Internal Server Error on search...
Post by: Kindred on July 18, 2013, 10:16:32 AM
you are missing our point.

Some misconfiguration of your server is not allowing SMF to recognize that databases exist....

When I install my system asks me...
(see attached)
Title: Re: HTTP 500 Internal Server Error on search...
Post by: head123 on July 22, 2013, 11:51:15 AM
hi,
yes m also agree with u all, my system is mis-configured.
just for my more understanding i open install.php of SMF. i found for each installation step thr is one function :-
1. function Welcome (Line no :- 401)
2. function checkFileWritable (Line no :- 478)
3. function databaseSetting (Line no :- 675)
      --- In this I saw db_type variable has value 'sqlite'    (Line no :- 723 and 768)

Please explain me how sqlite is thr ? how variable db_type take this value ? thr is No sqlite is installed on my machine ?
(Is because of this installer not asking me for database type selection ?? )

please refer attached install.php