Categories
PHP Web Development

PHP: Headers cannot be sent or why is headers_sent() incorrect?

Working with PHP, trying to warm up to PHP 5 with all its object-oriented glory, or at least step forward compared to PHP 4.

When you redirect browsers in PHP, you do it raw, without niceties of objects, by sending the HTTP header to the client with a call like:

header(“Location: “);

For some odd reason, this kept on failing, with an error message telling me that the header cannot be sent. Furthermore, PHP even told me through its header ‘detection’ method php headers_sent() that the headers were indeed sent.

Googled and found this article that infers that the issue may have something to do with file encoding. The file that was causing the issues for me was copied from a Windows machine (I am developing on a Linux VM now). It had the Windows line separators (\r\n). Apparently this made Apache and PHP on Linux very very uneasy and made them think that the headers were sent out.

Resolution: Copy the contents of the file to another file that was born on Unix and uses its line separators (\n). Ugly moments in coding.

Share
Categories
General

Typing in Hebrew in Ubuntu (and other foreign languages too)

This was apparently a challenge because the documentation is pretty scant.

I am now using Ubuntu 7.04 (so fresh) but regardless, could not find for the life of me how to edit a Word document in Hebrew using an OS that is all about being international (edit was supposed to be done in OpenOffice).

There are two steps – the first is the most logical and important, the second silly but crucial. So here goes:

1. Set up Hebrew in Ubuntu

From the System menu, select Administration and then Language Support. There, add your language(s) of  choice. Once you click OK, Ubuntu will download the additional fonts and whatever it needs to support the use of the additional language.

2. Add the *Keyboard Indicator* to the panel

Unlike Windows, which adds the language switching to the taskbar, Ubuntu leaves that for you to do. Not that I knew about it until I found a reference to a ‘Keyboard Indicator’ applet which does the exact same thing. To add it to your Ubuntu panel, right click the panel and select ‘Add to Panel’. From the list that appears, select ‘Keyboard Indicator’, which will now display the languages available for your use.

What is interesting is that Ubuntu offers two keyboard layouts for Hebrew: Lyx – which is the standard Hebrew layout (Mem sofit on separate key) and phonetic (Mem sofit as shift-Mem). Cool stuff when you get it to work…

Share
Share