Aug 10 2011

PHP tip: sh: /usr/local/php/bin/xxx: No such file or directory

Published by under Uncategorized

This might not be news to experienced PHP developers, but as a newb it did take me a few days to track this error down, and I could not find any help on the net for it. So I’m writing it here:

First of all, the cause: I was running in PHP’s safe mode. The fix: disable safe mode in PHP’s configuration; in my case this was an edit to php.ini.

As for the process that led me there: I host a Joomla! website on Midphase. Joomla! has a password reset mechanism, which uses email verification. At some point in the past few weeks this mechanism stopped working on my site. The problem was that the verification emails were not sent, as the PHP code, which tries to execute sendmail, failed to do this.

I tried to figure out the problem, tried setting Joomla! to use direct SMTP or PHPMailer instead, but SMTP didn’t work for some other reason, and PHPMailer actually uses either sendmail or SMTP itself, so that was not a real solution. I added various debug code to the original Joomla!/PHPMailer code in order to debug this problem, and ended up receiving this error message at the attempt to execute sendmail:

sh: /usr/local/php/bin/sendmail: No such file or directory

This was very strange, as there really is no sendmail in /usr/local/php/bin. I tried figuring out what was sending the code to look for sendmail in the wrong place, tried setting everything that I could think of (php.ini, Joomla! configuration, hard-coding values into phpmailer.php) but still got this same error.

In the end I somehow mentally stumbled over the PHP-safe-mode idea, and immediately went to set this value in php.ini. And that’s that. PHP’s safe mode disallows execution of external programs unless they are in one of the specially-specified directories. I opted to turn safe mode off altogether due to the notes in that this mode is deprecated (they say it’s not really safe), and has in fact been removed from the newer versions of PHP.

I can only assume that recent server transitions in Midphase moved my site to a server where the default PHP configuration had safe mode at *on*, where the old server had it at *off*.

Hope this helps someone 🙂

No responses yet

Nov 25 2010

Facebook: The new Compuserve/AOL?

Published by under Thoughts

In the late 1980’s we got a new computer, with a modem. At first my brother and I just fooled around, calling a friend’s computer and text-chatting over the point-to-point (not PPP, yes?) link that was created, but pretty soon we discovered BBSs, and the possibilities started opening up.

Then came the net (for us), and everything changed. No more calling a specific service, or relying on scheduled fidonet mail transfers. Everything everywhere was available, simultaneously (as far as your operating system could throw that, anyway, and as long as you could find it), and the experience, for me at least, was that of freedom.

This is why I was always confused by people who used Compuserve, or America Online (AOL), or even browsed the net using the Yahoo directory. Why constrict yourself to a closed space? Why restrict yourself to only what they have indexed and will show you? Why pay extra for something that gave you less?

The users of such so-called “online services” were restricted to their interface, seeing and accessing only the content that was available on their menu systems. They sent messages via the proprietary client, although – and this is a bit different from the point of this post – this was an actual email account and it did communicate with the outside world. Eventually these services did evolve to supply actual normal internet access, and I’m sure that many people today have no idea what they used to be, but the absurdity of their initial product never faded for me.

Today, however, I see a return to that paradigm: Facebook.

The world, it seems, prefers being constrained (reminds me of a scene from Lost). It seems to me that from (wrongly) conceiving the web browser as being the internet, people have folded themselves into Facebook, and see hardly anything outside of it. Most of their use of the net is there, anyway: Communicate with your friends via the message system (email? huh?), share pictures, videos, and random thoughts, ‘consume’ corporate content such as product or company pages, or advertisements (sometimes it seems to me I’m the only one that feels that they’re an unnatural and unwanted part of life), play games, etc. Why go anywhere else?

Companies today, practically all of them having actual websites, will send you to their Facebook pages. What’s the last time you typed in a URL at a browser’s location bar? Or even looked at it? But forget searching for things on Google, they’ll have you “search for us on FB!” now. You just don’t need to go anywhere else (and don’t forget to “like” everything).

It’s all coming back to me, and I’m still puzzled. There’s more to see out there, and this time around people aren’t really under any limitations: they constrain themselves, willingly. I guess I’ll never be one to understand the mainstream.

2 responses so far

Mar 09 2010

The clean code of the soul

Published by under Thoughts

I like to take pride in the code that I write. I like order and efficiency in general, and specifically in what I create and use. It therefore bothers me to see messy code, which usually includes layers upon layers of patches, each an attempt to fix / work around / cover up bugs in previously written lines of code. My approach is that you should write with the forward vision of changes to come. Any future features / bug fixes should be easy to implement and add, because the code was originally written to be easy to read and easy to understand and was planned to be modifiable and maintainable.

Most importantly, if you reach a point where the existing code does not allow you to do this (either because it was written badly or because the new features require unforeseen overhauls), then scrap it and re-write with your new vision. It will save you much frustration now, as opposed to trying to debug ugly patches, and later on when you encounter the need for even more features and bug fixes.

Naturally (for me, anyway) I expected to use this approach with regards to myself. My attitude towards my own mental processes was that if something isn’t working properly then I should fix it. If this meant learning new behaviour I expected to delete the old behaviour as part of that process. I’ve lately been taught that humans just don’t work that way.

A physiological example is in the development of the nervous system. Babies are born with certain reflexes, for example, which seem to disappear in later age. In fact the ‘circuits’ for these original reflexes aren’t removed, but newer so-called ‘circuits’ (patches in the code) grow and / or mature, which overpower the originals, and effect a new and different behaviour of the system. Again, the original mechanism is still there, underneath the patches. Certain neurological trauma may even disable the overpowering mechanism, exposing the original response as exhibited by newborns.

Our mental faculties are similar.

As children we’re more prone to react immediately to our urges, disregarding or even unaware of the needs of anyone around us or of the limitations of our current environment. Growing up we learn to take into account all of the factors around us and restrain ourselves as necessary. We learn that some urges can be satisfied here and now, some can be satisfied somewhere else and now, some will wait for later, and some will not be satisfied at all. We also learn to differentiate between these cases. In fact it seems that this learning fills up most of growing up.

It’s easy to know this, but not always easy to achieve it (How many adults have you seen behaving like children only today?). The thing is that I had expected this process to include the writing off of the childish urges. I had expected to delete their code and replace it with the clean and efficient code of adult behaviour. But it doesn’t work like that. The urges stay. You just have to write really good patches.

No responses yet

Jul 12 2009

Let me tell you something about air conditioners

Published by under Rants

It’s hot in Israel. Really hot. On the coastal area (Tel Aviv, Netanya, etc.) it’s also very humid (usually above 75% humidity). This is not even the peak of the season yet, and we suffer outside.

Still, I almost daily find myself shivering from it being too cold in the office. I go to the air conditioner controls and find them set at 18 degrees Celsius. This is so stupid and it just boggles my mind at how people, especially my coworkers, who are electronics engineers, have no idea how air conditioners work.

So here’s the low-down:

Air conditioners have no way of controlling the strength of their operation.

The only thing they control is the compressor: they can turn it on or off. It doesn’t matter how low you set the thermostat – they won’t cool the air faster. It will simply cause the air conditioner to try and reach an even lower temperature, meaning that the compressor will work for a longer time. If you want the room temperature to be 25 degrees Celsius you can set the thermostat to 25 or to 16 – it will still reach 25 just as fast. The only difference is that when set to 25 it will stop the compressor there, but when set to 16 it will keep it on until reaching 16 degrees (which is very hard to achieve and will probably never occur).

Now in my office the thermostat is pretty uncalibrated, so a reasonable setting is 21. Fine, set it to 21! Why 18?!

The only other thing that you can set on air conditioners is the fan speed. This, in fact, will probably cool the room faster if set higher, for obvious reasons. But this is rarely used in practice – only the let’s-freeze-Amir’s-ass setting.

No responses yet

Jun 15 2009

Hello (again) World!

Published by under General

So… I started writing a little blog. But then I realized that a lot of the stuff that I want to write about are global, not local (to Israel). Couple that with my little fantasy of being read, I put two and two together and concluded that I would get much more exposure if I wrote in English. So this is it.

If you’re actually reading this – have fun, comment, flame, whatever. I promise to approve any non-spam comments.

🙂 Amir

No responses yet