Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 06:06 am EDT

Geeklog Forums

Fatal error: Call to undefined function: mysql_connect() in /var/www/system/databases/mysql.class.


Status: offline

4Xsample

Forum User
Junior
Registered: 09/21/03
Posts: 26
caffeinated
Recently I reinstalled my debian woody to sarge after a few problems could make work all the services but since then I get this message on all my geeklog sites

Fatal error: Call to undefined function: mysql_connect() in /path/to/geeklog/system/databases/mysql.class.php on line 112

somebody know where can be the problem or where I can find information can helpme to find the solution?¿?
 Quote

Status: offline

twhiting9275

Forum User
Newbie
Registered: 03/30/04
Posts: 14
Location:Waterloo
Make sure you have mysql installed and the php mysql module to go with it. If you installed from source, you will need to reconfigure and add the --with-mysql option. If you've installed through your OS package, make sure to get the package specifically setup for php and mysql.
Geekdownloads - http://www.geekdownloads.net
Containing a variety of Geeklog plugins and downloads, updated to work with the latest versions of Geeklog
 Quote

mach

Anonymous
actually, that looks like an improper path setting. you can fix that in config.php. Because i doubt that /path/to/geeklog/etc... is actually the proper path.
 Quote

Status: offline

twhiting9275

Forum User
Newbie
Registered: 03/30/04
Posts: 14
Location:Waterloo
Quote by mach: actually, that looks like an improper path setting. you can fix that in config.php. Because i doubt that /path/to/geeklog/etc... is actually the proper path.

Incorrect
mysql_connect() is a built in php function, has nothing to do with geeklog itself. If it doesn't show up as a php function, then that means that it's not built into php somehow. Take a look at any phpinfo() page and you'll see that you don't have the mysql module loaded into php.
Geekdownloads - http://www.geekdownloads.net
Containing a variety of Geeklog plugins and downloads, updated to work with the latest versions of Geeklog
 Quote

Status: offline

4Xsample

Forum User
Junior
Registered: 09/21/03
Posts: 26
Solved Thanks
the problem was in the mysql module from the php...

Big Celebration

now find the shit arround the permisions of the files because theres a few websites restored from a tar and all the files and folders lost the user permisions and all this stuff Banging your head
 Quote

mach

Anonymous
Quote by twhiting9275:
Incorrect
i was referring to the path in the error, not the missing module.
 Quote

Laqua

Anonymous
Quote by twhiting9275:
Quote by mach: actually, that looks like an improper path setting. you can fix that in config.php. Because i doubt that /path/to/geeklog/etc... is actually the proper path.

Incorrect
mysql_connect() is a built in php function, has nothing to do with geeklog itself. If it doesn't show up as a php function, then that means that it's not built into php somehow. Take a look at any phpinfo() page and you'll see that you don't have the mysql module loaded into php.


Could you explain what was wrong, am having the same issue and am stumped. Thanks
 Quote

Anthony

Anonymous
I'm also having this problem, but when i execute phpinfo() it says that it has mysql. also, when I execute a php file that is just
Text Formatted Code
<? mysql_connect() ?>
 

It gives no problems, even though it should give SOME kind of error.
 Quote

Status: offline

twhiting9275

Forum User
Newbie
Registered: 03/30/04
Posts: 14
Location:Waterloo
YOu need to take a look at the php / sql documentation on this. The mysql_connect() function should be called with other variables. See http://us2.php.net/manual/en/function.mysql-connect.php .

Check the variables in phpinfo() , make sure that the proper version is in there. If ou have shell access try to connect to the database from the shell using

mysql -uusername -ppassword database

If that doesn't work, then you have a problem with the user/pass/db connection, not php itself.

This isn't really a geeklog problem, it's a mysql issue, or php compilation issue.
Geekdownloads - http://www.geekdownloads.net
Containing a variety of Geeklog plugins and downloads, updated to work with the latest versions of Geeklog
 Quote

junkken

Anonymous
I am posting this so others can read what solved my Fatal error: Call to undefined function: mysql_connect() Issue on Debian 2.4.25-1-386 running Apache2. PHP Version 4.3.10-15 Geeklog 1.3.11sr1.

I was able to use phpmyadmin and connect to mysql server so I knew the database was running and php was working to connect as the user I configured Geeklog to access the DB. I studied phpinfo and became concerned that '--without-mysql' was showing in the configure command. THIS IS OK. What was missing was a section in the phpinfo display labeled MYSQL and describing Mysql support enabled and directives as follows:

mysql
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 4.0.24
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /var/run/mysqld/mysqld.sock
MYSQL_INCLUDE -I/usr/include/mysql
MYSQL_LIBS -L/usr/lib -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

TO enable PHP4 in Apache2 on Debian;
edit /etc/php4/apache2/php.ini
and paste:
extension=snmp.so
extension=curl.so
extension=mysql.so
extension=odbc.so
extension=imap.so

After the end statement. Restart apache2

Some of the above extensions may not be necessary but I wanted to get this out so others could see if it works for them.

Regards





 Quote

Weia

Anonymous
to junkken:
ur way (add those extension=xxx.so lines) to solve this problem is working!! thanks!! but i sill dunno why snmp,curl,odbc,imap...and what effects will be after add those un-nessesery extensions?
thanks again;
 Quote

Status: offline

twhiting9275

Forum User
Newbie
Registered: 03/30/04
Posts: 14
Location:Waterloo

I studied phpinfo and became concerned that '--without-mysql' was showing in the configure command. THIS IS OK.

No, it is noit ok. You can't have php configured without mysql AND have it connect to databases. It's not the proper way to do things. Reconfigure php and tell it to use mysql, properly. Don't cheat, if you don't know what you're doing, then DON'T do it. Hire a professional to do it for you, otherwise you run the risk of severely screwing up your server.

After 5 years as a systems administrator, I'm still amazed that people think that cheating like this has no effect on the server. IT DOES! Don't do it!!! Configure and compile php properly, or use the official plugins for it (obtained through your vendor), or you WILL have problems in the longrun.
Geekdownloads - http://www.geekdownloads.net
Containing a variety of Geeklog plugins and downloads, updated to work with the latest versions of Geeklog
 Quote

flawless_reality

Anonymous
hey you guys...dont worry bout it....you all who are having trouble with mysql even after doing everything right..just follow this:
--remove the semicolon from ;extension=php_mysql.dll in php.ini
--make sure that the extension_dir is correct.
--copy the php5apache2.dll or php5apache2_2.dll (depending on whether ur using apache 2.0 or apache 2.2) and libmysql.dll files in ur c:/windows directory.
--make sure that the same copy of php.ini exists in the c:/windows directory AS WELL AS in ur main php folder.

enjoy!!
 Quote

mister p

Anonymous
Quote by: flawless_reality

hey you guys...dont worry bout it....you all who are having trouble with mysql even after doing everything right..just follow this:
--remove the semicolon from ;extension=php_mysql.dll in php.ini
--make sure that the extension_dir is correct.
--copy the php5apache2.dll or php5apache2_2.dll (depending on whether ur using apache 2.0 or apache 2.2) and libmysql.dll files in ur c:/windows directory.
--make sure that the same copy of php.ini exists in the c:/windows directory AS WELL AS in ur main php folder.

enjoy!!



This was the real valid only (and any other cualified words) solution :banghead: :banghead: :doh: :doh: :rtfm: :rtfm: :doh: :doh: :banghead: :banghead:
 Quote

Prabhdeep Singh

Anonymous
brainy
On Windows NT, 2000, XP and 2003:

step1: Go to Control Panel and open the System icon (Start -> Settings -> Control Panel -> System, or just Start -> Control Panel -> System for Windows XP/2003)

Go to the Advanced tab

Click on the 'Environment Variables' button

Look into the 'System Variables' pane

Find the Path entry (you may need to scroll to find it)

Double click on the Path entry

Enter your PHP directory at the end, including ';' before (e.g. ;C:\php)

Press OK and restart your computer


On Windows 98/Me you need to edit the autoexec.bat file:

Open the Notepad (Start -> Run and enter notepad)

Open the C:\autoexec.bat file

Locate the line with PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;..... and add: ;C:\php to the end of the line

Save the file and restart your computer


Note: Be sure to reboot after following the steps above to ensure that the PATH changes are applied.


step2:How to make the php.ini file available to PHP on windows?

There are several ways of doing this. If you are using Apache, read their installation specific instructions (Apache 1, Apache 2), otherwise you must set the PHPRC environment variable:

On Windows NT, 2000, XP and 2003:

Go to Control Panel and open the System icon (Start -> Settings -> Control Panel -> System, or just Start -> Control Panel -> System for Windows XP/2003)

Go to the Advanced tab

Click on the 'Environment Variables' button

Look into the 'System variables' pane

Click on 'New' and enter 'PHPRC' as the variable name and the directory where php.ini is located as the variable value (e.g. C:\php)

Press OK and restart your computer


On Windows 98/Me you need to edit the autoexec.bat file:

Open the Notepad (Start -> Run and enter notepad)

Open the C:\autoexec.bat file

Add a new line to the end of the file: set PHPRC=C:\php (replace C:\php with the directory where php.ini is located). Please note that the path cannot contain spaces. For instance, if you have installed PHP in C:\Program Files\PHP, you would enter C:\PROGRA~1\PHP instead.

Save the file and restart your computer

and u must be done.


if you have any problems please contact me on lovelyprabh18@gmail.com


 Quote

Mick

Anonymous
I realise this is an old thread but it is high in google hits for this problem so for anyone seeing this with a regular ubuntu installation the following worked for me (Ubuntu Ubuntu 10.04.2 LTS):

>sudo apt-get install php5-cli
>sudo apt-get install php5 php5-mysql
 Quote

Status: offline

Corine

Forum User
Newbie
Registered: 01/27/12
Posts: 1
I'm getting this error also, thanks for your help!
 Quote

All times are EDT. The time is now 06:06 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content