if you type in "man lex" at a shell prompt do you get the manual? (type "q" to exit) I can also run lex from shell, but it doesn't seem to accecpt normal qualifiers, so I can't determine the version or anything.
So if you can get the man page for lex that means it's installed on the system and your path is accessing stuff right. If you can't get the man page, then have you ever edited your .bash_profile file or otherwise edited your path? (I don't think you have by what you posted above, but just to be sure...)
If you have edited your path, either return it to default or make sure that ":$PATH" follows the last of your change in .bash_profile. Try the install again, does it work now?
If you can't get the man page and you heavn't touched your path settings, contact support and ask them to check into why lex isn't insatlled on your machine.
If you can get the man page, then lex is installed. But you're abviously still having a problem. Redownload the latest stable version of php5, it's probably easiest to use wget from the shell (not sure how you did this before) and extract it. It's possible that you suffered some packet loss or somethign when you downloaded and the files got messed up a tiny bit.
If this doesn't work, I sigguest seeking help from an 'official' php forum and see if people who deal more intimatley with php know what's going on.
Oh, and one other thing. It seems it's now called flex, and used to be called lex. not sure if that makes a difference in the world as the man page comes up for lex...
Hope this help, and good luck!