hi! im a newbie in setting up php 5, apache and mysql. please bear with me, please...need a help.

Im using php 5.2.17, apache 2.2 and mysql 5.1.42. I

my php codes are working in loading some pages, but when I tried connecting to MySQL, i got the same error. "Fatal error: Call to undefined function mysql_connect()"

when i run test.php which has "<?php

phpinfo();

?> "
i have

C:\php\php.ini for the Loaded Configuration File

my php.ini is configured with:

extension_dir = "C:\php\ext"

extension=php_pdo.dll
extension=php_pdo_mysql.dll
extension=php_mysql.dll
extension=php_mysqli.dll

my libmysql.dll is in c:\php

my httpd.conf has
LoadModule php5_module "C:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"

I run the code:
<?php // extensions_list.php

$list = get_loaded_extensions();
$list2 = array_map('strtolower',$list);
sort($list2);
echo '<pre>'.print_r($list2,true).'</pre>';

?>

and it doesnt show the mysql.

any help would be highly appreciated.

    So did you read the thread you replied to?

      More specifically, I don't see any mention of you verifying that the PHP installation directory is in your system's PATH environment variable. Have you done that? (If not, if you don't know, my FAQ entry here talks about this towards the end of the post.)

      EDIT: Possibly even more important would be the preface to my FAQ entry:

      bradgrafelman;10805646 wrote:

      Let me preface this FAQ by suggesting you ditch the MySQL extension - hey, the PHP team already did, that's why it's not enabled by default anymore! - and instead use a more robust set of functions/classes, such as [man]MySQLi[/man] or [man]PDO[/man].

        Weedpacket;10995667 wrote:

        So did you read the thread you replied to?

        yup, I did before and tried everything before I posted my message here. 🙂

          bradgrafelman;10995675 wrote:

          More specifically, I don't see any mention of you verifying that the PHP installation directory is in your system's PATH environment variable. Have you done that? (If not, if you don't know, my FAQ entry here talks about this towards the end of the post.)

          EDIT: Possibly even more important would be the preface to my FAQ entry:

          Thank you for your immediate reply!

          the system's PATH environment variable adding of c:\php work. 🙂

            Please consider marking your thread RESOLVED using the link under "Thread Tools" on the bar above the first post. Thank you.

              dalecosp;10995904 wrote:

              Please consider marking your thread RESOLVED using the link under "Thread Tools" on the bar above the first post. Thank you.

              Since (s)he hijacked an old thread, I doubt (s)he is able to do that. (However I'm going to mark it resolved anyway due to the thread necromancy plus the fact that this issue has been resolved a few times over.)

                3 years later
                bradgrafelman;10995911 wrote:

                Since (s)he hijacked an old thread, I doubt (s)he is able to do that. (However I'm going to mark it resolved anyway due to the thread necromancy plus the fact that this issue has been resolved a few times over.)

                ERROR: Call to undefined function mysqli_connect(),
                I have tried all of the following :
                1) set c:\php in path
                2) checked phpinfo() see below it said loaded configuration file "C:\php\php.ini"
                3) uncommented extension: php_mysql_...dll and php_mysqli.dll
                4) check extension_dir =ext;

                Apache2.2
                PHP5.4.23

                Really appreciate any help!!!

                System Windows NT 6.1 build 7601 (Windows 7 Home Premium Edition Service Pack 1) i586
                Build Date Dec 11 2013 00:52:57
                Compiler MSVC9 (Visual C++ 2008)
                Architecture x86
                Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--disable-isapi" "--enable-debug-pack" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--with-pdo-oci=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=C:\php-sdk\oracle\instantclient11\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--with-mcrypt=static" "--disable-static-analyze" "--with-pgo"
                Server API Apache 2.0 Handler
                Virtual Directory Support enabled
                Configuration File (php.ini) Path C:\Windows
                Loaded Configuration File C:\php\php.ini
                Scan this dir for additional .ini files (none)
                Additional .ini files parsed (none)
                PHP API 20100412
                PHP Extension 20100525
                Zend Extension 220100525
                Zend Extension Build API220100525,TS,VC9
                PHP Extension Build API20100525,TS,VC9
                Debug Build no
                Thread Safety enabled
                Zend Signal Handling disabled
                Zend Memory Manager enabled
                Zend Multibyte Support disabled
                IPv6 Support enabled
                DTrace Support disabled
                Registered PHP Streams php, file, glob, data, http, ftp, zip, compress.zlib, phar
                Registered Stream Socket Transports tcp, udp
                Registered Stream Filters convert.iconv., mcrypt., mdecrypt., string.rot13, string.toupper, string.tolower, string.strip_tags, convert., consumed, dechunk, zlib.*

                  [0] => apache2handler
                  [1] => bcmath
                  [2] => calendar
                  [3] => core
                  [4] => ctype
                  [5] => date
                  [6] => dom
                  [7] => ereg
                  [8] => filter
                  [9] => ftp
                  [10] => hash
                  [11] => iconv
                  [12] => json
                  [13] => libxml
                  [14] => mcrypt
                  [15] => mhash
                  [16] => mysqlnd
                  [17] => odbc
                  [18] => pcre
                  [19] => pdo
                  [20] => phar
                  [21] => reflection
                  [22] => session
                  [23] => simplexml
                  [24] => spl
                  [25] => standard
                  [26] => tokenizer
                  [27] => wddx
                  [28] => xml
                  [29] => xmlreader
                  [30] => xmlwriter
                  [31] => zip
                  [32] => zlib

                    Weedpacket;11046185 wrote:

                    Did you restart the server?

                    Thanks for the help.
                    Yes I did. Every time. Also reboot after update path.

                      Weedpacket;11046185 wrote:

                      Did you restart the server?

                      mysqlnd

                      mysqlnd enabled
                      Version mysqlnd 5.0.10 - 20111026 - $Id: e707c415db32080b3752b232487a435ee0372157 $
                      Compression supported
                      SSL supported
                      Command buffer size 4096
                      Read buffer size 32768
                      Read timeout 31536000
                      Collecting statistics Yes
                      Collecting memory statistics No
                      Tracing n/a
                      Loaded plugins mysqlnd,example,debug_trace,auth_plugin_mysql_native_password,auth_plugin_mysql_clear_password
                      API Extensions no value

                        i found that in php.ini that pdo_mysql.default_socket=
                        empty.

                        could this be the reason?

                          thanks All, I got it. The extension_dir was set c:\php\extentsion instead of "c:\php\ext".
                          after fixing it, phpinfo() shows both mysql and myslqi see below
                          mysql

                          MySQL Support enabled
                          Active Persistent Links 0
                          Active Links 0
                          Client API version mysqlnd 5.0.10 - 20111026 - $Id: e707c415db32080b3752b232487a435ee0372157 $

                          Directive Local Value Master Value
                          mysql.allow_local_infile On On
                          mysql.allow_persistent On On
                          mysql.connect_timeout 60 60
                          mysql.default_host no value no value
                          mysql.default_password no value no value
                          mysql.default_port no value no value
                          mysql.default_socket no value no value
                          mysql.default_user no value no value
                          mysql.max_links Unlimited Unlimited
                          mysql.max_persistent Unlimited Unlimited
                          mysql.trace_mode Off Off

                          mysqli

                          MysqlI Support enabled
                          Client API library version mysqlnd 5.0.10 - 20111026 - $Id: e707c415db32080b3752b232487a435ee0372157 $
                          Active Persistent Links 0
                          Inactive Persistent Links 0
                          Active Links 0

                          Directive Local Value Master Value
                          mysqli.allow_local_infile On On
                          mysqli.allow_persistent On On
                          mysqli.default_host no value no value
                          mysqli.default_port 3306 3306
                          mysqli.default_pw no value no value
                          mysqli.default_socket no value no value
                          mysqli.default_user no value no value
                          mysqli.max_links Unlimited Unlimited
                          mysqli.max_persistent Unlimited Unlimited
                          mysqli.reconnect Off Off

                            a month later
                            4 years later

                            It's also a spam post (links to essay-writing, i.e., "Pay me and cheat on your homework!" site).

                              Thanks for your vigilance, Mr. Weedpacket :-)

                                Write a Reply...