View previous topic :: View next topic |
Author |
Message |
jbain n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 24 Mar 2004 Posts: 53
|
Posted: Tue Jun 22, 2004 5:05 am Post subject: php and MySQL help needed |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
teknomage1 Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/1170945783f87171277cf3.png)
Joined: 05 Aug 2003 Posts: 1239 Location: Los Angeles, CA
|
Posted: Tue Jun 22, 2004 5:15 am Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
jbain n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 24 Mar 2004 Posts: 53
|
Posted: Tue Jun 22, 2004 5:21 am Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
teknomage1 Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/1170945783f87171277cf3.png)
Joined: 05 Aug 2003 Posts: 1239 Location: Los Angeles, CA
|
Posted: Tue Jun 22, 2004 5:52 am Post subject: |
|
|
edit /etc/make.conf |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
switchblade1983 n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 21 Jun 2004 Posts: 12
|
Posted: Tue Jun 22, 2004 7:24 am Post subject: |
|
|
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 :
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 |
|
![](templates/gentoo/images/spacer.gif) |
Souperman Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/16129548073feed6fbf1b26.jpg)
Joined: 14 Jul 2003 Posts: 449 Location: Cape Town, South Africa
|
Posted: Tue Jun 22, 2004 12:26 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
hanj Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/104414163441b8c6c1a6b4e.gif)
Joined: 19 Aug 2003 Posts: 1500
|
Posted: Tue Jun 22, 2004 7:07 pm Post subject: |
|
|
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)
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:
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 |
|
![](templates/gentoo/images/spacer.gif) |
Lajasha Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/11620018224767f02dae8ff.jpg)
Joined: 17 Mar 2004 Posts: 1040 Location: Vibe Central
|
Posted: Tue Jun 22, 2004 7:23 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
|