Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

Connection to database not working

Codes here !

Moderators: macek, egami, gesf

Connection to database not working

Postby psychomantum » Sat Jan 18, 2003 12:38 am

Hi,
I'm fairly new to php and mysql, but I've been reading up and am starting my own website on my own server using Apache 2.0.40 on RedHat 8.0

I decided to test mysql and php with this little php code:
<?php

$linkID = mysql_pconnect("localhost", "******", "******");

if($linkID != FALSE)
{
print "Persistent connection established";
}
else
{
print "Hey, it don't work";
}
?>

(username and password changed by me)


I get this error when I visit the page I put this code on:
Fatal error: Call to undefined function: mysql_pconnect() in /var/www/html/Admin/mysqltest.php on line 12


Any suggestions?
psychomantum
New php-forum User
New php-forum User
 
Posts: 10
Joined: Sat Dec 07, 2002 8:04 pm

Postby Joan Garnet » Sat Jan 18, 2003 6:02 am

Maybe it has something to do with this:
Code: Select all
Note: Note, that these kind of links only work if you are using a module version of PHP

http://www.php.net/manual/en/function.m ... onnect.php
User avatar
Joan Garnet
Moderator
Moderator
 
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars

different error

Postby psychomantum » Sun Jan 19, 2003 12:11 am

Ok, added the modules to httpd.conf, now I get this:
Warning: SAFE MODE Restriction in effect. The script whose uid is -1 is not allowed to access /var/www/html/Admin/mysqltest.php owned by uid 0 in Unknown on line 0

Warning: Failed opening '/var/www/html/Admin/mysqltest.php' for inclusion (include_path='.:/usr/share/pear') in Unknown on line 0


Any ideas?
psychomantum
New php-forum User
New php-forum User
 
Posts: 10
Joined: Sat Dec 07, 2002 8:04 pm

Postby Joan Garnet » Sun Jan 19, 2003 9:04 am

* http://www.devshed.com/Talk/Books/ProPHP/print_html
sql.safe_mode boolean
MySQL has it’s own safe mode. If you set this to TRUE, mysql_connect and mysql_pconnect will ignore any host, user and password information you supply. This means you can only connect to the MySQL database as the user the web server is running as.


* http://www.pt.horde.org/faq/admin/print.php#t7
"undefined function: mysql_pconnect()"
Code: Select all
This error occurs when IMP is configured to use MySQL, but PHP was not built with support for MySQL. Rebuild PHP, ensuring that MySQL support is compiled in, and that the line
   extension = mysql.so
appears in your php.ini (or php3.ini in PHP version 3).
User avatar
Joan Garnet
Moderator
Moderator
 
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars

Postby Joan Garnet » Sun Jan 19, 2003 9:55 am

More interesting links:
http://www.zend.com/manual/ref.mysql.php

The behaviour of these functions is affected by settings in php.ini.
Table 1. MySQL Configuration Options

Name Default Changeable
mysql.allow_persistent "On" PHP_INI_SYSTEM
mysql.max_persistent "-1" PHP_INI_SYSTEM
mysql.max_links "-1" PHP_INI_SYSTEM
mysql.default_port NULL PHP_INI_ALL
mysql.default_socket NULL PHP_INI_ALL
mysql.default_host NULL PHP_INI_ALL
mysql.default_user NULL PHP_INI_ALL
mysql.default_password NULL PHP_INI_ALL
mysql.connect_timeout "0" PHP_INI_SYSTEM
User avatar
Joan Garnet
Moderator
Moderator
 
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars

ok

Postby psychomantum » Sun Jan 19, 2003 4:57 pm

ok, so how do I turn it off?
psychomantum
New php-forum User
New php-forum User
 
Posts: 10
Joined: Sat Dec 07, 2002 8:04 pm


Return to mySQL & php coding

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron