Hi friends, I am a newbie. I am trying to connect PHP with Mysql, but coming across the below error: PHP Fatal error: Call to undefined function mysql_connect() in /var/www/html/index.php on line 2 Can anyone suggest with the possbile solution, with easily undestandable explanation... Thanks in advance.. pashy
Your php installation doesn't have mysql support. What linux distribution are you using? debian/fedora/centos?
Dear Mark, Thanks for your advice, but if your are pointing towards the installation of the Drivers I had already done that during PHP installation, using the same command that you have mentioned in your reply. I am able to display the hello world & PHP info web page with their respective scripts. I doubt I have to some changes in the PHP.ini file or httpd.conf file but nor sure what exactly I need to do. I have also uncommented all the MySql lines in the PHP.ini file. Kindly advice. pashy
I would not change anything to the php.ini file, unless you know what you're doing. The default settings are just fine to start learning php. About your error unknown function mysql_connect(); means that your php does not have mysql support .. installing the php-mysql package and then restart apache will resolve that issue. try this: create a file phpinfo.php and put this in it: Code: <?php phpinfo(); ?> then open that file in your browser, you can see exactly what php supports at that moment. There should be a header called "Mysql"
Thank you Mark, Below is the info under header called "Mysql" mysql MySQL Support enabled Active Persistent Links 0 Active Links 0 Client API version 5.1.46 MYSQL_MODULE_TYPE external MYSQL_SOCKET /var/lib/mysql/mysql.sock MYSQL_INCLUDE -I/usr/include/mysql MYSQL_LIBS -L/usr/lib/mysql -lmysqlclient Directive Local Value Master Value 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 Can we say the connection is successful?
Ok you have mysql support in php.. so if you have a file with something like: Code: <?php error_reporting(E_ALL); ini_set('display_erorrs', 1); $foo = mysql_connect('localhost', 'user', 'pass'); ?> You get an error?
Dear Mark, Thank you for all your time & kind support. The info inserted in the PHP Webpage is reflected in the DB table. Thanks once again. May be I would bother you again since this is just the beginning for me. Cheer's