Boosting Up PHP Performance with Alternative PHP Cache (APC)
September 20, 2006 on 4:38 am | In PHP | No Comments“Every single server has it [APC] at Yahoo, and it handles billions of requests per day” Said Rasmus Lerdorf, the creator of PHP, at the php|works conference.
Parsing and compiling speed can be significantly boosted with the use of an opcode cache.
In PHP, as with most scripting languages, code is parsed from human-readable to machine-readable instruction. The machine-readable script is known in PHP as opcodes.
An opcode cache stores or caches the compiled code in shared memory so that the code compilation for similar operations only needs to happen once.
PHP 6, which is still in development, will have opcode cache built in by default.
For current PHP 5 users, there are various opcode cache implementations that can be used, including the Alternative PHP Cache (APC), which is what Lerdorf recommended.
Installation (Linux):
APC is available via PECL Repositry, you can install it vie `pear install apc`, but it would fail if you compiled apache alone (didn’t install a binary package .deb or .rpm), so it could be a little bit tricky, I’m going to show you how to install it given that apache and php were compiled alone, and they are in there default locations
download it from http://pecl.php.net/get/APC-3.0.12p2.tgz
$ tar xzf APC-3.0.12p2.tgz
$ cd APC-3.0.12p2
$ phpize
$ ./configure –enable-apc-mmap=yes –with-apxs=’/usr/local/apache/bin/apxs’
you can replace /usr/local/apache/bin/apxs with your location to apxs e.g. /usr/local/apache2/bin/apxs if you installed apache2 in it’s default location
$ make
$ make install
After that you have to load it in php.ini
Be sure that extension_dir = “/usr/local/lib/php/extensions” or whatever your extentions folder is
add a line:
extension=no-debug-non-zts-20050922/apc.so
fix it according to the location of apc.so
try it out, it really Boosts Up your PHP applications performance
PC World: The 25 Worst Web Sites
September 16, 2006 on 2:52 am | In Internet | No CommentsWell I guess MySpace.com is the worst #1 ![]()
Whitehouse.com #13
Microsoft Windows Update #16
Hotmail #20
more details here
Happy Software Freedom Day
September 15, 2006 on 7:00 am | In Free Software & Open Source, Philosophy | No CommentsSoftware Freedom Day (SFD) is a worldwide celebration of Free and Open Source Software (FOSS). Our goal in this celebration is to educate the worldwide public about of the benefits of using high quality FOSS in education, in government, at home, and in business — in short, everywhere! The non-profit company Software Freedom International provides guidance in organizing SFD, but volunteer teams around the world organize their own SFD events to impact their own communities.
Araby Search Engine Add-on To Firefox
September 14, 2006 on 8:49 am | In Uncategorized | No Commentsif you use firefox you can think of adding this addon to your search engines
download here
Is PHP Insecure?
September 14, 2006 on 5:56 am | In PHP, Philosophy | No CommentsHim - PHP is Insecure.
Me - What makes you say so?
Him - I read it in a book.
Me - And what have you read exactly?
Him - I can’t remember, I’ll send you the book.
and he did actually send me the book, I read it, it was about 70 pages, actually I guess it was first an e-zine or something from some hackers website or mailing list, what ever. after that I saw the guy.
Me - Did you read the book, or just skimmed through.
Him - No, I read it.
Me - Do you know anything about PHP.
Him - Yeah, I wrote some scripts.
Me - OK, first of all the book does not talk about any PHP vulnerability, and the examples he gave for his hacks were just a stupid code, and if anyone working in this industry writes code like that, he should have a capital punishment.
Him - what, no no it just that PHP is not secure.
Me - ok here is the book, tell me where does it say that PHP is not secure.
Him - in the first chapter he says about a vulnerability in the include function.
Me - Yeah I noticed that, first of all include is not a function it’s an operator, second thing the code says something like
<?php
include ($page);
?>
and he says that when register_globals is turned on you can override the $page.
OK where did the $page variable came from, it should have come from somewhere, and at this somewhere it would be set, unless the coder is depending on that register_globals is on, and he is expecting the $page variable to from an input of the user, well it’s one of the extremely basic thing in programming that you have to validate user input. So it’s not a vulnerability in PHP itself, it’s a vulnerability in the developers code, which marks him as an idiot who should not put any code online, unless he is trying to win the most hacked site of the year, which also marks him as stupid cause after the first hack his application would be down, and maybe shredded all over, after the second I guess he would be fired.
Him - but it’s also PHP’s problem, why does it allows such code.
Me - really, a stupid programmer can make this vulnerability in any language you want.
Well the point is not just related to PHP, it’s also related to any programming language, usually lots of inexperienced developers, blame there errors on a programming language. Yeah some bugs could come from the programming language, but it’s very rare, and if so, programmers learn how to avoid it.
And another problem, is that people like Him, believes these things without really knowing, and most of them defend it like their lives.
Story Morals:
Don’t blame others for your mistakes, try to find out where you’ve been wrong first.
Don’t defend ideas you know nothing about, if you think they are right, try to investigate them first, at least when someone asks you about it you would have a more reasonable thing to say other I heard it, or I read it in a book.
Sharing called Piracy
September 13, 2006 on 5:26 pm | In Philosophy | No CommentsMost of us, have been taught to share, if you have candy you should share it with your friends, but what about software, not any software, proprietary software ???
In the terms we have on the planet these days, if you share proprietary software, you are called a pirate. which implies that illegal copying is ethically equivalent to kidnapping and murdering people.
Who believes that sharing software would be like that. So if you gave a friend that has always been nice to you a copy of a proprietary software, then you are a pirate.
For me I never believed so, sharing is good, even if it’s proprietary software, so instead of calling it piracy, I urge you to call it something like “Prohibited Copying”, “Unauthorized Copying”, or my preferable “Sharing Information”.
For me, I don’t use proprietary software, and if someday I would, I won’t mind sharing it at all
Open You Windows To Freedom (ReactOS)
September 13, 2006 on 10:29 am | In Free Software & Open Source | No CommentsWhile surfing the Internet last night, I reached some sites talking about a free (as in freedom) clone of MS Windows called ReactOS, ReactOS is an effort to create a Free Software replacement for Microsoft Windows(TM) that is compatible with existing hardware and software!
A good review for the product can be found on The NeoSmart Files here.
Well, it’s still in an alpha version, but they seem to have a lot of good work done.
Now to my point of view, for GNU/Linux which is based on UNIX, the root is not a proprietary to anybody, it’s based on the POSIX standards (which the only UNIX that doesn’t comply them is Sun Solaris, I don’t know if Sun ever heard about it), so any change in UNIX is not forced to be done by the GNU team, when it comes to ReactOS (also WINE) I guess this is going to be a problem, there root is Microsoft, which means any change Microsoft makes, they should do it too. Also would it be really free, GNU/Linux was a crowning achievement in the free software world, because it eliminated the one remaining barrier to having a 100% free software environment on your computer. ReactOS isn’t leaning that way, because even though it’s shooting for a free kernel, O/S, and GUI, you’re still doing it in the service of proprietary applications.
Anyway, I guess I’m going to try it soon using VMWARE, and surly I would post my feedback.
And remember, A computer is like air conditioning: it becomes useless when you open windows.
NULL Is Not A Value
September 10, 2006 on 6:05 pm | In MySQL | No CommentsBefore a few months, I was working on some mysterious issue regarding some SQL statements, it was something like this.
SELECT count(*) from some_table WHERE (condition_a);
the result was:
+----------+
| count(*) |
+----------+
| 11223 |
+----------+
alright Now:
SELECT count(*) from some_table WHERE (condition_a) AND (condition_b);
+----------+
| count(*) |
+----------+
| 0 |
+----------+
aha Ok then:
SELECT count(*) from some_table WHERE condition_a AND NOT (condition_b);
The result was also
Before a few months, I was working on some mysterious issue regarding some SQL statements, it was something like this.
SELECT count(*) from some_table WHERE (condition_a);
the result was:
+----------+
| count(*) |
+----------+
| 11223 |
+----------+
alright Now:
SELECT count(*) from some_table WHERE (condition_a) AND (condition_b);
+----------+
| count(*) |
+----------+
| 0 |
+----------+
HA !!!!
Ok for those 11223 records the condition_a was true, from the second statement I could tell that condition_b was false, so NOT condition_b should be true, but it was also false from the third statement.
So for Logic to play around condition_b, and NOT condition_b both are false (How can that be) all theories of logic are broken (what is going on?)
After breaking up the two conditions, I found that I was comparing one of the values in condition_b with NULL, so in BOTH cases the result would be FALSE (or actually UNKNOWN which is casted to NULL), I’ve always assumed that NULL would be casted to 0, but the fact that it’s not.
So this was just a thing that you might want to take care of when you write your SQL statements.
Hope it was Useful
Chain Letters
September 10, 2006 on 5:55 pm | In Internet | No CommentsA typical chain letter consists of a message that attempts to induce the recipient to make a number of copies of the letter and then pass them on to one or more new recipients. A chain letter can be considered a type of meme, a self-replicating piece of information that uses a human host to distribute copies of itself. Common methods used by chain letters include emotionally manipulative stories, get-rich-quick pyramid schemes, and the exploitation of superstition to threaten the recipient with bad luck or even physical violence if he or she “breaks the chain” and refuses to adhere by the conditions set out by the letter.
So, let’s define “chain letter”. A chain letter is ANY e-mail that contains instructions to “forward this out” or “forward this to everyone you know” or anything else of that nature. Who creates chain letters? Now you might want to think that when you get an e-mail telling you there’s some sick child with cancer and they will receive $0.03 for every time this e-mail gets forwarded out, in fact the mental image may just tug at your heart strings so bad that you forward it to other news or joke lists that you’re on, in hopes of spreading the word and bring hope to this poor kid.
Well, guys, the thing I hate more than receiving SPAM, is receiving Chain Letters, it usually has a big size, as everybody in the whole stupid part of the earth, has forwarded it to somebody else who has forwarded it to another body to ….. and forwarded it to me.
Alright, there is no sick girl whom AOL has paid a fu***** cent for each one receiving a damn message, Hotmail is not going to delete your account if you don’t send this message, (they can know when was the last time you logged in to make sure you are using it), and Bill Gates is not throwing money over anybody, and you wont get a free mobile, or a free shit or anything. you are not going to be rich or anything.
Chain Messages are used by spammers, as they collect as much emails as they want throw this thing, imagine a single chain message going around, and then getting back to the same spammer who sent it, how many emails he would’ve received. What could happen if people were wise enough not send this shit all around? do you enjoy having this FREE SOFTWARE, or VIAGRA, or stupid things going around in you’re mailbox? if no, then stop forwarding this damn emails.
if you are not convinced yet, well then enjoy your life, but don’t send me any stupid chain message.
Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds.
Valid XHTML and CSS. ^Top^





