Posted on February 19th, 2011 | by
Ben
This one was so odd, I HAD to post about it. I was developing my merry way and already had a bunch of mysterious, hard-to-debug issues, when I came about:
Fatal error: Exception thrown without a stack frame in Unknown on line 0
What the HELL? I said to myself. I googled, searched, checked user notes, .. I boiled it down to this:
- It’s when something throws an exception (“exception thrown”), and there is nothing to catch that error (“without a stack frame”). This can happen if you throw an exception in a class destructor or other shutdown function.
You need to try to narrow it down to which line of code is actually throwing the error. I narrowed it down to two factors: a session_start() and an exit; were two factors that were required to make the error happen. I tried a lot of things that didn’t work including clearing out /tmp, … checking php.ini three or four times to make sure settings were correct (e.g. session.save_handler was ‘files’, save_path was /tmp) .. and finally figured out:
- After the
session_start(), I set a single variable in the session (e.x. $_SESSION['test'] = 'test';). Then, I used session_write_close(); to force the error to “pop out” before the script was beginning to shut down, that is with a stack.
After that, I saw the real error message, which was simply I forgot to cast a SimpleXML Element to a string, and the object was unable to be serialized. But that’s besides the point, here is a few things to remember if you run into this error:
- It is caused because some kind of exception is being thrown as the script is “shutting down”, e.x. in a destructor or cleanup/execution of code after the script is finished.
- PHP sessions write at the end of the script, and so if there is an error in writing the session, you may see this. (This was my case.) With some googling, some people swear by re-setting the
session.save_handler manually. With my case, a session_write_close() revealed the real error. If this is you, fix the error, and remove the session_write_close();
die()/exit(); may cause the error to be visible when maybe it wasn’t before
- If you aren’t having the issue with sessions like me, try destroying some objects in your script and seeing if the destructors are throwing exceptions.
- The key here is not to fix the error, but to find the real error, then fix it.
Posted on January 22nd, 2011 | by
Ben
Just wanted to make a quick post to let everyone know about TacoDomains.com .. If you are a domainer like me, it is a must! that you check out their site, and find your way to their mailing list!
Posted on November 11th, 2010 | by
Ben
1) Find the latest version in http://packages.sw.be/unrar/ that also meets your version of CentOS and architecture (32 or 64 bit). They have RPMs all the way back to CentOS 3.
2) At the time of this writing, the latest is CentOS 5.x and I am using a 64-bit architecture. The latest “unrar” was 3.9.10, so my package was http://packages.sw.be/unrar/unrar-3.9.10-1.el5.rf.x86_64.rpm .. If you were using 32-bit, it would be http://packages.sw.be/unrar/unrar-3.9.10-1.el5.rf.i386.rpm.
Then type:
wget http://packages.sw.be/unrar/unrar-3.9.10-1.el5.rf.x86_64.rpm
rpm -Uvh unrar-3.9.10-1.el5.rf.x86_64.rpm
Obviously, if you aren’t using the 64-bit version, or a newer/older version, replace the filename appropriately.
If you stumble upon this or similar error:
unrar: /lib/tls/libc.so.6: version `GLIBC_2.4' not found (required by unrar)
You simply need to upgrade your version of glibc. Try
Hope this helps!
Posted on November 2nd, 2010 | by
Ben
I recently threw up qhash.com or www.quickhash.com if you wish in a couple of hours, I got so tired of Google’ing around everytime I needed a quick hash on my windows system.. There are so many “one page” services, but I’ve never found one strictly for hashing algorithms.. Thus, qhash.com came about in about a good hours worth of work.
It supports of course, MD5, SHA1, SHA256, among popular ones. A full list can be viewed on the site!
Posted on November 1st, 2010 | by
Ben
In many situations, where I manage SEO for clients, I like to give them access to Google Analytics and Google Webmaster Tools, as well as keeping my own access so I do not have to login to their account each time to see updated data.
For Google Analytics, it’s pretty easy, just “add” their account and you can even limit to specific domains/websites. For Google Webmaster Tools, it’s a little more complicated. There is no “official” support, however if you use the File Upload Method, simply add the site in both Google Webmaster Accounts, and upload each individual unique .html file to your server.
Viola. If you’re adding a new account to an existing website, all the prior data will be instantly there. You may be missing prior uploaded sitemaps, but I simply re-added the sitemap on the 2nd account, and once again viola, .. All the prior information was already there!
Hope this helps
Posted on October 27th, 2010 | by
Ben
Once I figured out how to use vim I was hooked. I like it significantly over vi and when using the unixy breeds of OS, is now my exclusive editor.
Although, I find myself using it with PuTTY and another host operating system fairly frequently, and it drove me crazy that I could not copy FROM vim to my host OS, or paste TO vim from my host OS. After some reading I figured out two solutions:
- Disable mouse support via
:set mouse= (or add to your ~/.vimrc file)
- Or the better solution: simply hold SHIFT while right-clicking for copy and paste.
Problem solved! Should also work for xterm as well.
Posted on October 17th, 2010 | by
Ben
I got tired of finding this article, so I am reposting it here, with some modification:
find . | xargs grep 'string' -sl
The -s is for summary and won’t display warning messages such as grep: ./directory-name: Is a directory
The -l is for list, so we get just the filename and not all instances of the match displayed in the results. You could remove the -l switch if you’d like to do a more comprehensive search.
Performing the search on the current directory I get:
./javascript_open_new_window_form.php
./excel_large_number_error.php
./linux_vi_string_substitution.php
./email_reformat.php
./online_email_reformat.php
./excel_find_question_mark.php
./linux_find_string_in_files.php
./excel_keyboard_shortcuts.php
./linux_grep.php
./md5_unique_sub_string.php
./email_reformat_token.php
./excel_password_protect.php
./mysql_date_calulation.php
./md5_string.php
./php_javascript_passing_values_to_new_window_in_url.php
./php_math_on_string/math_on_string_form.php
./guide.php
./excel_large_number_paste.php
./piping_commands_find_grep_sed.php
./google-search-for-seo-research.php
./filename_conversion_form.php
./linux_find_string_files.php
I find this useful for just quickly seeing which files contain a search time. I would normally limit the files searched with a command such as :
find . -iname '*php' | xargs grep 'string' -sl
Another common search for me, is to just look at the recently updated files:
find . -iname '*php' -mtime -1 | xargs grep 'string' -sl
Would find only files edited today, whilst the following finds the files older than today:
find . -iname '*php' -mtime +1 | xargs grep 'string' -sl
Once again, this is a repost of this article with slight modifications.