While trying to install php4.0.4pl1 on suse7.1 with apache_1.3.19 and mysql support I get the following error when I run the config command

./configure --with-mysql=/usr/local/mysql --with-apxs

error is

checking lex output file root... ./configure: lex: command not found
configure: error: cannot find output from lex; giving up

any Ideas??

Thanx in advance

Ian

    2 months later

    Had same problem. Via Yast, I installed flex and bison and everything is humming along.

    matt

      5 months later

      That fixed it, thanks!

        2 months later

        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.

          18 days later

          Thanks Melissa! I definitely think that put me in the right direction, but I still get an error message. On the line where the script trys to run lex, I get the message:

          /usr/local/bin/flex: can't open @$

          I put the @$ in double-quotes when I copied the script you posted. I figured the backslashes were added by the php desipte how ridiculous that looks (do you hear me php.net?).

          Any ideas? Is there a chance I copied it wrong?

          Thanks,
          Tom

            Well it sounds like its helping you at least a little so far. When your PC says can\'t open file $@ it means that the line in the script that tells the machine where to look for your flex file is wrong (I think?).

            This one:

            exec /root/flex-2.5.4/flex -l \"@$\"

            (And yes, take out any of the forward slashes they\'re not supposed to be there!!)

            You\'ll need to change /root/flex-2.5.4 to the directory you\'ve installed flex into. An easy way to figure it out if you\'ve got Linux Mandrake or something similar is to open up a browser window rather than doing it at the root in a terminal window where you can\'t see the directories above. Work your way through the directories until you get to your flex directory and then check the location in the address bar.

            Now what the script above did was add to the last one, so that when it ran it knew to look in another place for an interpreter to run lex commands. You\'ll need to open that file up in a text editor and edit the line I\'m talking about. Save it & try to compile again. If you\'ve already tried this a dozen times over and its still not working post again and maybe I might be able to think of something else or someone else will. It might take a day or two though, I\'m installing a new XP1800 chip & board on the PC that this is installed on.. 😛

              9 days later

              Btw, if all else fails you can 'cheat' a little and stop worrying about all of the installation troubles. Just search for an installation kit for Linux. NuSphere MySql offers a package for both Windows & Linux. (I found this out after I got everything working!). Check out http://www.nusphere.com and head to their downloads section.

                12 days later

                I encountered the same thing installing PHP4.1.2 on SuSE 7.1. PHP4.1.0 had previously installed without problem!!

                I couldn't make Melissa's trick work, but placed a symbolic link from flex, eg.

                ln -s /usr/local/flex-2.5.4/flex /usr/bin/lex

                Hope this helps.

                Tony

                  thanks for the info,
                  Even as an experienced Linux user I found it helpful as I had been having trouble as it said I needed lex and got confused thinking flex had to do with hardware 'scanners' due to the Mandrake software installer calling it a text 'scanning' package.

                    5 days later

                    No problem. I'm happy to help out. 🙂

                      4 days later

                      The problem with the @$ is that it's backwards.. it should be $@ (with no quotes). When you see $@ in a shell script it represents all of the command line parameters to the script. In this case, it just relays the command line parms to the executable.

                        12 days later

                        Thanks for the help Melissa and Aaron - this actually helped me out with a sound card issue installing alsa. I tried it every which way and I used Meleissa's script... flipped the @$ to $@ (shoudl have seen that - drove me nuts for a while) AND I had to enclose the $@ in the double quotes contrary to Aaron's advice. Wouldn't work otherwise.

                        Without the help I was lost - thanks!!!

                          2 months later

                          Okay good, it wasn't just me ;-)
                          I could had sworn that I didn't have problems with PHP 4.2.0 either.

                          I was having a hard time finding Flex, as all the links I found referenced ftp://ftp.gnu.org/gnu/flex/ . I ended up finding it at ftp://ftp.gnu.org/non-gnu/flex/ . Hope that helps someone!

                            Write a Reply...