LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-22-2004, 06:20 PM   #1
marghorp
Senior Member
 
Registered: Jan 2004
Location: Slovenia
Distribution: Slackware 10.1, SLAX to the MAX :)
Posts: 1,040

Rep: Reputation: 45
fuzzy mysql with PHP


I have this silly problem with mysql that I don't understand.

First of all, the mysqld is up and running smoothly. I can connect to it with mysql and do with the tables whatever I please.

The funny thing is that with PHP I cannot insert stuff into tables. I have used Grant all on ... command to ensure that users apache and mysql have privileges to mysql.

It doesn't seem to work.

Reading from a database however works great.

I don't know where the problem is.

Help!
 
Old 04-22-2004, 08:40 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
I'm sure if you give us a sample output of code, someone might tell you where the problem is along with the errors you get, etc. More details or were as clueless as you are.
 
Old 04-22-2004, 08:56 PM   #3
tuxguy
Member
 
Registered: Mar 2004
Location: North Bay, Ontario - CANADA
Distribution: Debian
Posts: 77

Rep: Reputation: 16
did you install the php4-mysql (or php3-mysql) mod?
 
Old 04-23-2004, 02:00 AM   #4
miknight
Member
 
Registered: Oct 2002
Location: Sydney, Australia
Distribution: Gentoo, Ubuntu, Debian
Posts: 184

Rep: Reputation: 30
Re: fuzzy mysql with PHP

Quote:
Originally posted by marghorp
I have this silly problem with mysql that I don't understand.
What version of MySQL and PHP are you using?
 
Old 04-23-2004, 02:18 AM   #5
marghorp
Senior Member
 
Registered: Jan 2004
Location: Slovenia
Distribution: Slackware 10.1, SLAX to the MAX :)
Posts: 1,040

Original Poster
Rep: Reputation: 45
Yes that's the joke. Te code worked before (reinstall). And yes, I have installed all the components needed for it to work (at instalation). I don't get any errors from executing the code. If I didn't install it correctly there would be some errors.

The fuzzines is in the fact, that php reads nicely from mysql database but won't for some reason write to it. I don't know what's going on.

I am running PHP-4.3.3
I am running MySQL-3.23.58

I know it works, because it reads from it. But why oh why won't it write to it. I will give you a list of my user table and db table.


USER table
+-----------+--------+----------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+
| Host | User | Password | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv |
+-----------+--------+----------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+
| localhost | root | | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
| soba-210 | root | | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
| localhost | | | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
| soba-210 | | | N | N | N | N | N | N | N | N | N | N | N | N | N | N |
| localhost | apache | | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
| localhost | bojan | | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
| localhost | mysql | | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | N | Y | Y | Y |
+-----------+--------+----------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+


DB table
+------+---------+------+-------------+-------------+-------------+-------------+-------------+-----------+------------+-----------------+------------+------------+
| Host | Db | User | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Grant_priv | References_priv | Index_priv | Alter_priv |
+------+---------+------+-------------+-------------+-------------+-------------+-------------+-----------+------------+-----------------+------------+------------+
| % | test | | Y | Y | Y | Y | Y | Y | N | Y | Y | Y |
| % | test\_% | | Y | Y | Y | Y | Y | Y | N | Y | Y | Y |
+------+---------+------+-------------+-------------+-------------+-------------+-------------+-----------+------------+-----------------+------------+------------+

Hope this tells someone something.
 
Old 04-23-2004, 05:45 AM   #6
miknight
Member
 
Registered: Oct 2002
Location: Sydney, Australia
Distribution: Gentoo, Ubuntu, Debian
Posts: 184

Rep: Reputation: 30
So I assume that if you use a mysql shell you can do write operations to the DB when using the same login credentials as what you have your PHP script using?

And the MySQL server is on the same machine as Apache isn' it?
 
Old 04-23-2004, 06:41 AM   #7
marghorp
Senior Member
 
Registered: Jan 2004
Location: Slovenia
Distribution: Slackware 10.1, SLAX to the MAX :)
Posts: 1,040

Original Poster
Rep: Reputation: 45
Probably

I tried loging in as apache and mysql and in the shell it worked fine. Is it possible that apache is using any other user or PHP is using any other user. in httpd.conf there is user apache and group apache, which I haven't changed

This is really starting to annoy me. Why doesn't it work if it works Reading yes, writing no. There must be something fishy.

And yes Apache and MySQL are both on the same machine.

I checked /var/log/mysqld.log and found these:

Cannot initialize InnoDB as 'innodb_data_file_path' is not set.
If you do not want to use transactional InnoDB tables, add a line
skip-innodb
to the [mysqld] section of init parameters in your my.cnf
or my.ini. If you want to use InnoDB tables, add to the [mysqld]
section, for example,
innodb_data_file_path = ibdata1:10M:autoextend
But to get good performance you should adjust for your hardware
the InnoDB startup options listed in section 2 at
http://www.innodb.com/ibman.html
/usr/libexec/mysqld: ready for connections

Anyone knows what it means. And is there a log for every mysql transaction?

Last edited by marghorp; 04-23-2004 at 07:19 AM.
 
Old 04-23-2004, 10:21 AM   #8
miknight
Member
 
Registered: Oct 2002
Location: Sydney, Australia
Distribution: Gentoo, Ubuntu, Debian
Posts: 184

Rep: Reputation: 30
Hmm InnoDB... you probably don't want to use that table type. I don't ave any experience with it, or if that error message even indicates you are using it, but you might wanna try and make sure your tables are MyISAM.

Maybe check out http://dev.mysql.com/doc/mysql/en/Table_types.html
 
Old 04-23-2004, 11:15 AM   #9
marghorp
Senior Member
 
Registered: Jan 2004
Location: Slovenia
Distribution: Slackware 10.1, SLAX to the MAX :)
Posts: 1,040

Original Poster
Rep: Reputation: 45
I just want to shoot myself now. The reason the bloody thing wasn't working is my own stupidity. I had PHP code designed so that it would work under Linux and Windows. I did some modifications to it under windows, but I didn't make those same modifications to it for Linux. Sorry, for presenting an unsolvable problem to you guys.

Thanks for banging your head against the wall anyway. Appreciate it.

I just excluded code problems, because under windows it worked, but now I migrated over to Linux (about time) and it just stoped.

Thanks anyway!
 
Old 04-23-2004, 03:18 PM   #10
tuxguy
Member
 
Registered: Mar 2004
Location: North Bay, Ontario - CANADA
Distribution: Debian
Posts: 77

Rep: Reputation: 16
lol... been there done that... glad to see ya got it going!!

Jesse
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql-server4.1 and mod php-mysql conflig kernelvn *BSD 0 06-18-2005 11:52 AM
Problem getting PHP to recognize MySQL, Using PHP 4.0 and MySQL 4.0.20 d2army Programming 4 06-27-2004 08:54 PM
php4 mysql, installation, php-pages with mysql info stay empty dnla Linux - Software 2 03-14-2004 02:54 PM
Installing MySQL.4.0.17 and php support for Mysql on RedHat 9.0 Neha Linux - Software 13 12-29-2003 12:06 AM
Apache Mysql Php: mysql with php doesn't work breakerfall Linux - Networking 6 12-27-2003 08:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration