Okay, I installed apache2, mysql, then php4 all on my WinXP Pro Corp box. I set everything up, and apache2 starts all great, and I did the phpinfo() and was wondering how I knew that php saw mysql... it has a mysql section, but I believe if I remember that when I installed it in linux long ago without mysql, that it still had a section saying that it was there... does php come with a... sql lite type of thing?

How can I test my configuration and setup to see if I have mysql working along with php properly?

Thanks,
Jason Bush

    php 4.x has SUPPORT for mysql built into it but php does not actually come with mysql. But your post indicates that you did install mysql so you should be good to go.

    Check the articles section and follow the one about getting started with mysql and php.

    Basically, you need to use mysql tools to create a database, create a user with acces to it and then probably create some tables.

    At that point, code such as
    <?php
    $link = mysql_connect("localhost", "mysql_user", "mysql_password")
    or die("Could not connect: " . mysql_error());
    print ("Connected successfully");
    mysql_close($link);
    ?>
    should work.

      doesn't seem to be working, here are my errors:

      Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'localhost' (10061) in C:\Program Files\Apache Group\Apache2\htdocs\phpinfo.php on line 9
      Could not connect: Can't connect to MySQL server on 'localhost' (10061)

        new error when putting my ip rather than localhost

        Warning: mysql_connect() [function.mysql-connect]: Access denied for user: 'Administrator@jason' (Using password: YES) in C:\Program Files\Apache Group\Apache2\htdocs\phpinfo.php on line 9
        Could not connect: Access denied for user: 'Administrator@jason' (Using password: YES)

        so I don't have a user is what I am seeing? This is what I have for my.ini file...

        #This File was made using the WinMySQLAdmin 1.4 Tool
        #12/14/2002 6:44:56 PM

        #Uncomment or Add only the keys that you know how works.
        #Read the MySQL Manual for instructions

        [mysqld]
        basedir=C:/PROGRA~1/mysql
        bind-address=192.168.0.2
        datadir=C:/PROGRA~1/mysql/data
        #language=C:/PROGRA~1/mysql/share/your language directory
        #slow query log#=
        #tmpdir#=
        #port=3306
        #set-variable=key_buffer=16M
        [WinMySQLadmin]
        Server=C:/PROGRA~1/mysql/bin/mysqld-nt.exe
        user=Administrator
        password=passhere

          I don't have a whole lot of expertise on setting up mysql. Reviewing some 'getting started' articles is still recommended.

          You might try setting
          user=Administrator@jason

          But I don't usuall modify the mysql ini files. I just go in with mysql, reset the root password then create users as necessary.

            Try connecting as user "root" with no password. This is the default for new install on win.

            Hope this helps 😉

              whoa, holy crap that worked... how do I go about changing that so there is a pass and add users and do other things? create databases... not much docs I can find, they want you to pay for stuff 🙁

                okay... now I have logged in successfully I guess to mysql... I delteted the test database, and kept the mysql one... do I need it? all I am going to start doing is try to learn php, and also learn to use mysql databases within my scripts...

                I have given root a password... do I need to create another user and use it instead of root? Do I need to make a new dababase for each project?

                Any more help is greatly appreciated, thx

                Jason Bush

                  YES. You must keep the mysql database. The tables in there control everything relating to your users and databases.

                  It is bad practice to use your root user for web access. "root" should be limited to access only from localhost and should be kept for admin tasks, not a hard and fast rule, but that's what I do.

                  "root" is the superuser setup when you install. This user has access and permission to do anything and everything.

                  When creating a new project it is a good idea to create a separate database, and any users you might need for that project. Most of the time you will find that a user with SELECT, INSERT, UPDATE and DELETE privileges is plenty for getting started.

                  It is worth buying one of the many books on developing with PHP and mySQL. It really helps when you do not come from a programming background. Though these forums (and the devshed forums) provide a lot of help when getting started.

                  The php manual downloaded as a .chm is a great help too.

                  Good luck 😉

                    Okay, well the book I have is SAMS PHP and MySQL Web Development by Luke Welling and Laura Thomson, plus Larry Ullman's PHP for the world wide web and PHP4 A Beginner's Guide by Bill McCarty. I tend to unpack them soon and crack them open (I just moved to Germany, and have all my books in boxes still)...

                    Just a quick question, I loaded the MySQL-Front and I used it to change the password of root user, and also create a new user and new database...

                    Does this program have anything to do with setting up my.ini in the Windows directory? I look at it, and it looks unmodified from before I started doing anything with MySQL-Front.

                    I am kind of lost as far as how the my.ini file comes into play, how to configure it and what file MySQL-Front modifies...

                    Thanks,
                    Jason Bush

                      Ignore your my.ini file. As long as it's working you don't need to know for the moment. If you want to know more download the mysql manual as a .chm file. It's a crap manual but it goes through the use of the option files quite well.

                      mySQL-Front is modifying the data dictionary (the mySQL db) when you create users. It is a tool for editing/admin'ing mySQL dbs, and user data is stored in a table in the mysql db.

                      Put your effort into understanding the mySQL db. You can use HELP from the mysql command line to find out commands available to you. Just play and find your way around.

                      Good luck 😉

                        Okay, I sem to have the users and database creation under control, and I'm understanding this whole thing a bit better. I went and downloaded phpbb 2 and installed it on my system, the installation and configuration seemed to go great, but now when I try to post, the post doesn't show... any ideas?

                        Is it the MySQL configuration?

                        Thanks,
                        Jason Bush

                          I went to the phpBB admin section, and it shows that the posts exist... just when I goto the auctual forum, nothing shows... hmm... confused.. could it be a rights thing? I'm fairly new to XP/NTFS, I'm coming from Linux... kinda strange, usually goes the other way, heh...

                            Okay, with phpbb2 I have noticed that unless I delete my cached files that I don't get the current postings and information that is in the database for the web site?

                            Is this a known problem being on the auctual server (development)? If so, how do I get around such problems?

                            Thanks,
                            Jason Bush

                              Check and/or play with these settings in your php.ini file. I don't remember encountering these problems when I installed phpbb2.

                              ; Set to {nocache,private,public} to determine HTTP caching aspects.
                              session.cache_limiter = nocache

                              ; Document expires after n minutes.
                              session.cache_expire = 2

                              Good luck 😉

                                Still nothing... both of those options were already in the file, but the cache limit was set to 180 rather than 2, so I set it to 2, restarted apache2 (didn't know if I need to or now) and still it didn't work, so I changed back the modifications in the file and restarted apache again...

                                When I said cleared my cache, I meant that by my browser cache... is that what you took by that?

                                  I also tried posting and doing as I would online on my machine in Mozilla, and IE, still the same response to both... any ideas?

                                  Thanks in advance,
                                  Jason Bush

                                    Write a Reply...