Spiga

audit_log_user_command(): Connection refused

June 26, 09 by Gabi Solomon

This error happend to me when i runned a command on my Centos VPS.

audit_log_user_command(): Connection refused

And after some googling it seems that a lot of Centos users are running into this when executing SUDO.
But it seens that this is a bug in Centos kernel, and its not fixed yet.
My problem was that i was running the commands logged as root ( silly me ).
Hope you are too, because otherwise i have no sollution for you :( .

Cheers

mysql error : Incorrect information in file: ./table.frm

March 11, 09 by Gabi Solomon

After tinkering with my VPS settings to optimize it ( it was having some low memory problems ) and after restarting the server, just when i tought everything was ok i noticed that i managed to break some websites.

they all got this error:

mysql error : Incorrect information in file: ./table.frm

After a bit of googling i found the problem … apparently it could be because there is no support for InnoDB … oops. In my quest for optimization i disabled the support for InnoDB tables thinking that there werent any InnoDB tables in the websites hosted on that VPS .. apparently they were :( .

Hope you get here faster then i found the solution.
Cheers

zend framework losing session on swf/flash upload

March 04, 09 by Gabi Solomon

Recently i tried to integrate the well known swfupload script into a website.
If you are here you must probably know that normally the flash request looses session since it doesn’t send cookie headers. The recommended workaround is to send the sessionid as a parameter through post, and in the action page set the session_id() to the post variable before the session start.

I did this but for some reason, my zend application refused to accept the new session_id. I struggled with it for quite a few hours, and finally narrowed it down to a php problem since the session_id would get set properly but after session start the session would be empty.

Really hitting a dead end i headed to stackoverflow ( really thankful for the guys that made this site possible ) and tried my luck there and wrote a question. And i got my answer :D

Seemed like the problem was with the php extension Suhosin witch has a session protection to prevent session stealing. A very useful thing but in this case it made me spend quite a few hours puzzled and staring at the monitor.

Hope you this is also your problem,
Cheers

Connection Interrupted

November 16, 08 by Gabi Solomon

A few weeks ago as i was working on a project i got a message in firefox that said :

Connection Interrupted
The connection to the server was reset while the page was loading.
The network link was interrupted while negotiating a connection. Please try again.

I was a little puzzled since i never saw this one before. So i did a little googling search and debugging i find out the cause :D

There was a infinite loop in my code.

I know silly me, but hope you manage to stumble upon this when you get in the same situation.
cheers.

Fatal error: Maximum execution time exceeded in /wp-includes/streams.php

May 25, 08 by Gabi Solomon

Recently i started to do some cleaning on my blog, and added and removed some plugins. At one point i starting getting the error:

Fatal error: Maximum execution time exceeded in /wp-includes/streams.php

At first i tought it has something to do with the plugins i just added, or the multi-language plugin ( wich i disabled later on, and moved my romanian posts to gabrielsolomon.ro ). So i started to do some googling and discovered it was not to do with the plugins but it was a bug in the version 2.5 of wordpress.
Which kind of made sense since i recently upgraded to it … and have not encountered this error before.

It seems it is caused by the WPLANG setting in the wordpress wp-config.php file.
So if you have setup the file like this :

// Change this to localize WordPress. A corresponding MO file for the
// chosen language must be installed to wp-content/languages.
// For example, install de.mo to wp-content/languages and set WPLANG to ‘de’
// to enable German language support.
define (‘WPLANG’, ‘ro’);

Then you need to remove the language like so :

define (‘WPLANG’, ”);

That seem to do the trick for me, and the error stop showing up.

Hope this article saved you some googling time and invite you to comment if you encountered a similar problem or have a better solution.

Custom Error Documents with .htacces

May 24, 08 by Gabi Solomon

Some people only know about .htaccess utility in apache rewrite, but it can do more than that. For example it can help you specify your own Error Documents. When ever a browser makes a request for a web document ( webpage, files, images, css files etc) the server returns a header that contains an error code that tells the browser details about the requests. I will list this codes below:

Successful Client Requests
200 OK
201 Created
202 Accepted
203 Non-Authorative Information
204 No Content
205 Reset Content
206 Partial Content
Client Request Redirected
300 Multiple Choices
301 Moved Permanently
302 Moved Temporarily
303 See Other
304 Not Modified
305 Use Proxy

Client Request Errors
400 Bad Request
401 Authorization Required
402 Payment Required (not used yet)
403 Forbidden
404 Not Found
405 Method Not Allowed
406 Not Acceptable (encoding)
407 Proxy Authentication Required
408 Request Timed Out
409 Conflicting Request
410 Gone
411 Content Length Required
412 Precondition Failed
413 Request Entity Too Long
414 Request URI Too Long
415 Unsupported Media Type

Server Errors
500 Internal Server Error
501 Not Implemented
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout
505 HTTP Version Not Supported

In order to In order to specify your own ErrorDocuments, you need to know these error codes, since you will need to specify for wich error code you want to assign a page.

But you wont need to specify an error page for all those codes, You only might want to do a custom error page for the most common of them like 404 and 500. Also most people do a custom Error Document for
401 – Authorization Required ( for sections of the site that are protected by a folder password and somebody tries to enter a protected area without corect login details ),
403 – Forbidden ( for example when someone is trying to access a folder withough an index option )
400 – Bad Request, which is one of those generic kind of errors that people get to by doing some weird stuff with your URL or scripts.

The advantage of having custom error documents is that you can display to the user a custom page with the site layout ( instead of the simple default one ) and you can even build a script to make custom logs of this errors.

You shouldn’t make custom pages for all error codes, for example an ErrorDocument for code 200 would cause an infinite loop, whenever a page was found…this would not be good.

To specify your custom error documents, you will add a special command for this in the htaccess file:
ErrorDocument [code] /directory/errorDocument.html

For example an error document for 404 would be:
ErrorDocument 404 /errors/404.html

Now you told the server that when it has an error code of 404 to return the page http://yoursite.com/errors/notfound.html. The same principle apply's to all the codes.

As a small advice i would recommend you make a special folder for your error documents and also name them something that will show theyr error code and purpose. I put 404.html but you can do notFound.html for example. Also the error documents do not need to be html they can also be php,asp or other types of files.

If you dont want to make a special file you can add the html directly in .htaccess file
ErrorDocument 401 "<body> You have to to be a member to view this page.

To do this you need to keep in mind :
the ErrorDocument starts with a " but does not end with one ... that was not a typo :)
the command should be on one line, including the HTML

PHP Fatal error: Allowed memory size of 33554432 bytes exhausted

April 27, 08 by Gabi Solomon

PHP Fatal error: Allowed memory size of 33554432 bytes exhausted

This is an error that seem to puzzle most beginners, so i will try to explain what this error is all about.First lets understand why this is happing, there are a few reasons why your getting this error:

  • the output of your is very large
  • your script grabs over the 8MB default memory limit of PHP ( maybe from POST FILES variables )
  • there’s a bug in your script that is causing the script to eat that much memory

Now dont get scared its not a big deal, and usualy its a easy fix ;) . To solve this problem you should try to:

  • optimize your script so that it will not eat up the maximum memory limit
  • find bugs (memory leaks) in your script
  • minimize the output of your script
  • increase the memory_limit setting in php.ini or directly in your php script by using the ini_set() function

This 8MB default limit is coded in php to stop any script from taking to much memory out of the server and maybe crashing it. This is way the best method of dealing with this error is to figure out what is causing the need for this much memory and reducing it, rather then going for the easy way out and increasing the limit.

Hope this helped you and i await your comments