Problems getting PHP to connect to MySQL on same server

Posted on 2011-04-27
Last Modified: 2012-05-11

I have someone trying to get a dashboard working for a company I work for.  He had it working fine on his server.  But having some trouble getting it to work on our server.

He put some echos in there, and it seems to die at mysql_connect because it never gets to the echo right after.

The username and password are correct.  Any idea's what could be going wrong?

        // Initialize Variables for connecting to mySQL
        $mysql_host = "localhost";
        $mysql_uid = "dashboard";
        $mysql_pwd = "password";
        $mysql_db = "dashboard";

        //Open a connection using the parameters
        $mysql_connect = mysql_connect($mysql_host,$mysql_uid,$mysql_pwd) or die(mysql_error());


Open in new window

Question by:Xetroximyn
    LVL 142

    Expert Comment

    by:Guy Hengel [angelIII / a3]
    what error do you get?

    Author Comment

    No error message as far as I know.  It just seems to die.  The guy trying to set it up just noticed on the php info page it seems to have a "--without-mysql" option.   Any idea how I would take that off?

    './configure' '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib64' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-expat-dir=/usr' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-kerberos' '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr' '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--with-mime-magic=/usr/share/file/magic.mime' '--without-sqlite' '--with-libxml-dir=/usr' '--with-xml' '--with-system-tzdata' '--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd' '--without-odbc' '--disable-dom' '--disable-dba' '--without-unixODBC' '--disable-pdo' '--disable-xmlreader' '--disable-xmlwriter' 

    Open in new window

    LVL 142

    Expert Comment

    by:Guy Hengel [angelIII / a3]
    please check with a page just having :
    <?php phpinfo(); ?>

    Open in new window

    if the mysql support is enabled on your server.
    other step would be to enable/chage the error_display...

    Accepted Solution

    dur...    I just had to run..

    yum install php-mysql

    sorry to waste your time!  Thanks for the input!! :)
    LVL 142

    Assisted Solution

    by:Guy Hengel [angelIII / a3]
    no time wasted if problem is solved :)

    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
    Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit ( and similar technologies have enjoyed wide adoption, making it possib…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now