Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
php and MySQL help needed
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
jbain
n00b
n00b


Joined: 24 Mar 2004
Posts: 53

PostPosted: Tue Jun 22, 2004 5:05 am    Post subject: php and MySQL help needed Reply with quote

I"m just starting to learn how to use PHP and MySQL, jsut got them both installed today.

PHP seems to be working okay, and MySQL seems to be working okay but i can't connect the two. I have some php scripts that i know to work that use mysql, but i get this error message:

Fatal error: Call to undefined function: mysql_connect() in /var/www/localhost/htdocs/athena/memory.php on line 27

can anyone help me? many thanks!
Back to top
View user's profile Send private message
teknomage1
Veteran
Veteran


Joined: 05 Aug 2003
Posts: 1239
Location: Los Angeles, CA

PostPosted: Tue Jun 22, 2004 5:15 am    Post subject: Reply with quote

Perhaps if you post your script we could be more helpful? On the face of it I'd ask if you had mysql in your USE flags when you compiled php.
Back to top
View user's profile Send private message
jbain
n00b
n00b


Joined: 24 Mar 2004
Posts: 53

PostPosted: Tue Jun 22, 2004 5:21 am    Post subject: Reply with quote

shiot, i don't think i did >.< that would make sense cause i just trie compiling a program that uses MySQL and it didn't work and gave some error about sql i think...where do i chage the USE flags again?
Back to top
View user's profile Send private message
teknomage1
Veteran
Veteran


Joined: 05 Aug 2003
Posts: 1239
Location: Los Angeles, CA

PostPosted: Tue Jun 22, 2004 5:52 am    Post subject: Reply with quote

edit /etc/make.conf
Back to top
View user's profile Send private message
switchblade1983
n00b
n00b


Joined: 21 Jun 2004
Posts: 12

PostPosted: Tue Jun 22, 2004 7:24 am    Post subject: Reply with quote

Code:
emerge nmap
nmap localhost

is mySQL running :

3306/tcp open mysql

If not, start it with mysqld.

If this is running, the next thing it could be will be the fact that you are using an invalid password to get into the mysql database. Try connecting to mySQL, using :

Code:
mysql -u


Add a user if necessary, add the required database this way and make your tables. Then your script may acess them. I had problems with the script making the actual database stuff...

If this is not the case, and it is all set up lovely jubly, then it is your php script somewhere...
Back to top
View user's profile Send private message
Souperman
Guru
Guru


Joined: 14 Jul 2003
Posts: 449
Location: Cape Town, South Africa

PostPosted: Tue Jun 22, 2004 12:26 pm    Post subject: Reply with quote

switchblade1983 wrote:
Code:
emerge nmap
nmap localhost

is mySQL running :

The error message "Call to undefined function" indicates that PHP does not have MySQL support compiled in. If the error message said that the connection failed, then you'd have to check that MySQL is running.
_________________
moo
Back to top
View user's profile Send private message
hanj
Veteran
Veteran


Joined: 19 Aug 2003
Posts: 1500

PostPosted: Tue Jun 22, 2004 7:07 pm    Post subject: Reply with quote

Looks like you emerge'd pieces seperately and didn't provide support for each other.

As Souperman mentioned.. the line "Call to undefined function" is the clear indication of this. It is saying that PHP has no idea what mysql is.

I would make sure all of your USE flags are set correctly. Make sure the following flag are set in /etc/make.conf

Code:
apache2
mysql
php
ssl


A handy tool to manage your USE flags is ufed (Use Flag EDitor)
Code:
# emerge ufed

Just run this program.. and check/uncheck any flags you want/don't want.

Then I would re-emerge apache, mod_php, mysql

Code:
# emerge -pv apache mod_php mysql


make sure your are seeing +mysql +php +apache +ssl in the each package's use flags. Then do it for real.

Code:
#emerge -v apache mod_php mysql


Once all of this is done, make sure they are added to the default runlevel, so they will start

Code:
#rc-update add apache2 default
#rc-update add mysql default


Then start the services

Code:
# /etc/init.d/mysql start
# /etc/init.d/apache2 start


You can quickly verify if services are running:
Code:

#rc-status


Then to make sure you have mysql listening properly

Code:
#netstat -lnp | grep mysql


Should show you process is listening on port 3306

I hope this helps
hanj
Back to top
View user's profile Send private message
Lajasha
Veteran
Veteran


Joined: 17 Mar 2004
Posts: 1040
Location: Vibe Central

PostPosted: Tue Jun 22, 2004 7:23 pm    Post subject: Reply with quote

Quote:
Then I would re-emerge apache, mod_php, mysql

Code:
# emerge -pv apache mod_php mysql


make sure your are seeing +mysql +php +apache +ssl in the each package's use flags. Then do it for real.


If you have the correct flags in the /etc/make.conf as hanj said then all you will need to do is an emerge -pv mpd_php or the others as the rest will be deps of the one you emerge. This will save you time as the above would have you possibley recompiling the apache and family multiple times
_________________
Come and play in my land
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum