Reply to Re: Return info about PHP installation mySQL compatibility

Your name:

Reply:


Posted by Anonymous on 01/10/08 23:28

"Robin S." wrote:

> Currently, the WebsiteOS program (on the website host server) lists
> PHP5 as being used. PHP4 is an option, but it's not currently used (I
> tried to switch it about two hours ago. Same errors, but slightly
> different error messages, but no further ahead. The shopping cart
> should be compatible with PHP4 anyway, but I guess that's not too
> important right now).

If the cart works with PHP5 stick with that.

> Actually, the first error listed in my origianl message is generated
> on a password line of a mysql_pconnect in the session.inc script. See
> code:
>
> *************************
> $mysql_connect = mysql_pconnect ($this->hostName,
> $this->userName,
> $this->password);

Let's try some error checking. Replace that line with:

---
$mysql_connect = mysql_pconnect ($this->hostName, $this->userName,
$this->password)
or die("MySQL Connect failed.\n
Hostname= $this->hostName\n
Username= $this->userName\n
Password= $this->password\n
Reason= " . mysql_error());
---

If the database connection fails the script should stop and give you the
reason. Is Hostname, Username and Password correct? What is the reason
for the failed connect?


> $mysql_db = mysql_select_db ($this->database);
> **************************
> *btw - the original programmer explicidly states that a mysql_pconnect
> is required, just just mysql_connect...

Can you rephrase that sentence?

>
> The first error I listed is generated on the third line down:
>
> ($this->password);

This is a part of the mysql_pconnect function, not a line of its own. A
newline does not mean anything in PHP, you could just as well replace it
with a space.

>
> and the second error is generated on the following line:
>
> $mysql_db = mysql_select_db ($this->database);

Of course, if the connect to the database server fails you can't select
a database.

> > It looks to me like a configuration problem on your hosts side.
>
> Any thoughts spcifically? I'm sure there are a couple dozen things
> that could be wrong, but if I can lead the tech support guys in the
> right direction, perhaps they can solve it...

I think Jerry has the right idea about that. PHP tries to connect
through a socket instead of the TCP/IP stack.

> > P.S.: You can connect to the MySQL server of your host from your local
> > computer? That's a security nightmare! You should consider switching
> > hosts in any case.
>
> Well, Apache/PHP installed on my computer seems to be able to perform
> queries on the remove SQL server, although it requires the appropriate
> user/pass. This shouldn't be the case?

Some providers configure their MySQL servers that way, but as I already
said, that's a security nightmare. Someone who figures out the password
of the MySQL server's root account (or can hack the server through some
vulnerability) can download and change any customer's database. That's
far more difficult if the server is not accessible openly.

A configuration like that would make me wary about that provider because
they are not very network security aware.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация