|
Home > Archive > MySQL Server Forum > March 2005 > My AMP application does not know the mysql data files reside on the same linux server
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
My AMP application does not know the mysql data files reside on the same linux server
|
|
|
| A programmer developed an AMP (Apache/MySQL/PHP) application
for me. When he was done, he sent me the PHP files and the MySQL
dump file. Now, when I connect to the application on my LAN using
http://192.168.1.106/~mlh/credifree/index.php the AMP app still
thinks the data resides somewhere else. It runs fine - as long as I
leave my LAN's external internet connection up. But if I unplug my
LAN from the world, my app locks up.
Before I even created and installed the mysql database on the linux
server, the application was accessing the data from its remote
location (the same one used during programmer's development).
Installing the data here did not, of course, change that pointer.
I am quite new with AMP and linux. I'm uncertain just how these
items tie together.
How do I tell the PHP files that the data now resides on the same
linux server? And, is that all I have to do - just make configuration
changes in PHP?
| |
|
| Actually, digging through the many PHP files, I found this one.
Changing the values in it, I am now successfully connecting...
<?
// $connect =
mysql_connect("mysql01.inertiaservers.net","username","password");
// mysql_select_db("old_db");
$connect = mysql_connect("localhost","newuser","newpass");
mysql_select_db("new_db");
?>
xxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxx
xxxxxxxx
On Wed, 30 Mar 2005 13:16:35 GMT, jerry gitomer <jgitomer@verizon.net>
wrote:
>MLH wrote:
>
>
>I just double checked a dump file and it will restore to
>whatever directory MySQL is using. As a result I suspect that
>your problem is an apache problem and not a MySQL problem.
>
>When you access your application from the browser are you using:
>
> http://localhost
>
>If so, and you have an out of the box standard install, Apache
>should be looking for your programs in /var/www. You can verify
>this by running phpinfo.php (http://phpinfo.php) and seeing
>what the value is for Document_Root in the apache Environment
>section of the output.
>
>Also check to see if apache is aware of MySQL by looking further
>down in the phpinfo.php output for a section called "mysql".
>(In my output it falls between "ctype" and "overload".)
>
>HTH
>Jerry
>
>Check the output of phpinfo.php and y
| |
|
| Bill, you hit it on the nose EXACTLY!
Digging through the many PHP files, I found this one.
Changing the values in it, I am now successfully connecting...
<?
// $connect = mysql_connect("mysql01.inertiaservers.net","old
user","oldpass");
// mysql_select_db("old_db");
$connect = mysql_connect("localhost","newuser","newpass");
mysql_select_db("new_db");
?>
xxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxx
xxxxxx
On Wed, 30 Mar 2005 22:13:36 -0800, Bill Karwin <bill@karwin.com>
wrote:
xxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxx
xx
>MLH wrote:
>
>Sounds like the PHP files are specifying the server name where the MySQL
>database resides. It should probably specify 'localhost' if PHP and the
>database are on the same server.
>
>Typically in the PHP language one uses a function called mysql_connect()
>to specify the name of the host, and the MySQL user and password to use
>when connecting to the MySQL database (the database name is specified in
>a different function call, after the PHP application successfully
>connects to the MySQL server).
>
>Look for "mysql_connect" in your PHP files. The first argument to the
>function should be the name of the host where the MySQL database lives.
> I'm guessing it contains some external Internet site name or IP
>address, and you can probably replace that with "localhost":
>
> $link = mysql_connect('local
host', 'mysql_user', 'mysql_password');
>
>See http://us4.php.net/function.mysql-connect for more reference docs
>and examples for this function.
>
>Be sure to search for _all_ places where PHP calls mysql_connect().
>There's no guarantee it's used in only one place in the code.
>
>Regards,
>Bill K.
|
|
|
|
|