Just thought I\'d post this. I\'ve never used a unix os before but thought that learning PHP would be better on a unix based system. I installed and ran PHP 4.x and came across the same problem. I looked on the internet, and found this site and this answer which wasn\'t very helpful for a new linux user. After a little bit of figuring out I found the following information which I\'m hoping will help other people who aren\'t familiar with the unix os. Please note that my experience with these instructions is using PHP 4.x, flex 2.5.4 and bison 1.3.x on Linux Mandrake 7.2. This should work for other versions but I\'m not an expert at this by far. 🙂
1) Lex & Yacc are older versions of the compilers orginally distributed or created (I\'m not sure which) by AT&T and which are now distributed by www.gnu.org as \"Flex\" and \"Bison\" respectively.
2) Make sure you have the GCC compilers installed first (Also available from gnu.org) and then install bison,flex and finally php.
3) You can install the programs by using
gunzip -c bison-1.x.tar.gz | tar xvf -
\"Bison-1.x.tar.gz\" should be the version that you have downloaded for installation. Do this for bison, and then flex.
4) When you configure PHP and come across the Lex error it is because it can\'t \'find\' a lex interpreter. Create the following simple script at the unix prompt
cat > /usr/bin/lex <<\"EOF\"
#! /bin/sh
begin /usr/bin/lex
exec /root/flex-2.5.4/flex -l \"@$\"
EOF
This script tells the program where to look for a \'lex\' interpreter (in this case flex). The exec line indicates where exactly the flex program is. In my case, because I downloaded & installed flex version 2.5.4 to the root the beginning of this line looks like this: /root/flex-2.5.4/ the last \"flex\" on the end is the actual program itself (IN a Windows based OS you might see flex.exe or something similar). Change /root/flex-2.5.4/ to wherever flex is located on your machine.
5) enter in the following command at the prompt: chmod 755 /usr/bin/lex this changes the directory to the proper permissions.
6) If you dont have a version of \'byacc\' installed & get an error you might need more files. Under the subdirectory MISC in the main flex directory you\'ll find parse.h and parse.y. Copy both of these files into the main flex source directory.
Ok, that should do it (hopefully!) for you. If anyone experienced with Linux spots an error please correct it for me - I\'m still new at this, but hoping it might help someone else get PHP up and running.