I'm using SuSE Linux 10 and Apache 2.2 and PHP 5 and MySQL 5.0.18 but PHP doesn't recognize MySQL commands.
I'm wondering if I installed it incorrectly. It's kind of hard for a linux newbie like myself to know exactly how I installed it because I don't quite understand all the command line stuff yet. My guess is I installed PHP but didn't configure it to notice MySQL.
Could someone give me a link or an explanation about what to include in the config when I'm compiling PHP and MySQL?

thanks

    I'm really not sure if I did. I'm making it right now with the --with-mysql, so we'll find out when it's done.

      Doing a phpinfo() let's you know how PHP was compiled I do believe.

      BTW, did you know about using [man]MySQLi[/man] or "MySQL Improved" ?

      Do you know why PHP5 no longer enabled MySQL support by default and only MySQLi? Click here and read PHP's Database issues FAQ #4.

        okay... I reconfigured it like this:
        ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
        but php still doesn't know about mysql
        one strange thing about when I did the make install... it didn't say anything about mysql in the details while installing, just SAPI, CGI, PEAR, and of course PHP

          phpinfo() said --without-mysql, even after I told it to make --with-mysql
          should I try it all again?

            I was checking the httpd2 status in Yast and I noticed that php4 was enabled, but php5 was not, so I enabled php5 and it wanted an install source when I clicked finish.
            Do I have to reinstall apache to enable php5?
            Or maybe it would be easier to forget about php5 and configure php4......
            Suggestions?

              7 days later

              how do you configure apache to work with php5 and mysql in linux?

                alright, I reinstalled apache and that seemed to work fine, but php isn't working quite as expected.
                I made sure to include the --with-mysql in the ./configure part of installing, but when I do a phpinfo(), it says --without-mysql.
                Now, I didn't reinstall mysql yet. Do I need to do that as well?

                  MySQL should be installed before PHP, and you might need to use "--with-mysql=/path/to/mysql"

                    tried this to configure php after mysql already installed:

                    ./configure --with-mysql=/usr/bin --with-apx2=/usr/local/apache2/bin/apxs
                    make
                    make install

                    but it still doesn't work.
                    phpinfo() still says --without-mysql
                    am I still missing something?

                      I learned that the following must be added/edited in the php.ini file:
                      extension=mysql.so
                      mysql.default_host = localhost

                      but the mysql.so file is found nowhere on my system. What could be the cause of this? How necessary is this file and what does it do? What procedure should I follow to correct this problem. I can't find it in the MySQL or PHP Manuals.
                      Also, I connect to apache using port 4444, do I need to enter mysql.default_host=localhost:4444 or just mysql.default_host=localhost?

                        I finally got MySQL to work on my server. I gave up on it yesterday and switched to Windows XP to work on something else and then went to bed. Then this morning, I thought I'd look at it again. So I switched back to linux and voila! It works! It finally realizes that MySQL is an extension of PHP and recognizes the commands and functions.
                        Sometimes I hate computers. :mad:
                        There is still something not quite right though. When I try to connect to MySQL it gives me this warning:
                        Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /srv/www/htdocs/sqlstuff/index.php on line 11
                        Is this a problem with the "mysql.default_socket" line in php.ini? Right now it is blank, which apparently means it will use the MySQL default socket. Also, I looked and I didn't find the '/var/lib/mysql/mysql.sock' file that it is looking for in the above error. What's up with that?

                        thanks for the help

                          Write a Reply...