PHP and MYSQL on Apache
Has anybody seen, encounter, and was able to solve this error message i had when i try to access a website with php scripts connecting to a mysql database?
Fatal error: Call to undefined function: mysql_connect() in /var/www/rivet85.com/phpbb2/db/mysql4.php on line 48 |
That could be anything unless your willing to give us line 48 of your script that its stating the error is on, etc. Probably best to give a few lines before and after just in case.
My first guess would be, its not connecting to your db for some reason, maybe mysql isn't running, the username and password is wrong that its trying to connect with, or could just be a single syntax in your line that is preventing it from connecting. |
[trickykid]
here is the function: function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true) { $this->persistency = $persistency; $this->user = $sqluser; $this->password = $sqlpassword; $this->server = $sqlserver; $this->dbname = $database; **line48** $this->db_connect_id = ($this->persistency) ? mysql_pconnect($this->server, $this->user, $this->password) : mysql_connect($this->server, $this->user, $this->password); if( $this->db_connect_id ) { if( $database != "" ) { $this->dbname = $database; $dbselect = mysql_select_db($this->dbname); if( !$dbselect ) { mysql_close($this->db_c |
Well looking at my line 48 in my mysql4.php file I have for my phpbb forum, I see no difference in what you have in yours. This would lead me to believe mysql is not even running perhaps? Have you checked that? Check with ps -aux or top
|
Also on a side note, has this ever worked before or is this a initial install of phpbb, etc? If its new install, did you make sure to include mysql support with php, etc?
|
I have seen this before, check your phpinfo() and make sure php is built with mysql support then check your php.ini file and make sure the your loading the mysql extensions. Should look something like this
extension_dir /usr/lib/php4 extension mysql.so Hope this helps |
i did a ps aux and got these entries
mysql 1188 0.0 1.4 28140 7460 ? S Mar12 0:00 /usr/sbin/mysqld mysql 1189 0.0 1.4 28140 7460 ? S Mar12 0:05 /usr/sbin/mysqld mysql 1190 0.0 1.4 28140 7460 ? S Mar12 0:00 /usr/sbin/mysqld mysql 1191 0.0 1.4 28140 7460 ? S Mar12 0:00 /usr/sbin/mysqld could it be a user and password issue? |
[shortfuse]
i checked my php.ini nd did not find these entries extension_dir /usr/lib/php4 extension mysql.so also under /usr/lib/php4, i only have ldap.so and imap.so and no mysql.so i search the entire drive and cannot find mysql.so |
Does your phpinfo() show any MySql information?
|
Did you post this in another forum already because I responded to that thread..
Anyway, your problem is that perl5 DOES NOT include MySQL support, nor is it bundled with the MySQL PHP library. You'll need to download the MySQL library and then recompile php using the configure option: Code:
./configure --with-mysql |
All times are GMT -5. The time now is 05:44 PM. |