[PHP] PDO question

2012-11-28 Thread ad...@buskirkgraphics.com

Guys,
I am not quiet sure what is happening but every time i try to connect to a
remote host it refers back to localhost.

$pdo = new PDO('mysql:host=171.16.23.44;dbname=test', 'user','password');

ERROR: Access denied for user 'user'@'localhost' (using password: YES) in
/var/www/html/text.php

Any clue as to WHY it keeps referring back to localhost when i clearly set the
host parameter to another server.
I checked the /etc/hosts records to see if there was a referral for that domain
back to it's self there is NOT.


Re: [PHP] Re: PDO question

2012-11-28 Thread ad...@buskirkgraphics.com

On November 28, 2012 at 4:11 PM Jim Giner jim.gi...@albanyhandball.com wrote:
 On 11/28/2012 3:58 PM, ad...@buskirkgraphics.com wrote:
 
  Guys,
  I am not quiet sure what is happening but every time i try to connect to a
  remote host it refers back to localhost.
 
  $pdo = new PDO('mysql:host=171.16.23.44;dbname=test', 'user','password');
 
  ERROR: Access denied for user 'user'@'localhost' (using password: YES) in
  /var/www/html/text.php
 
  Any clue as to WHY it keeps referring back to localhost when i clearly set
  the
  host parameter to another server.
  I checked the /etc/hosts records to see if there was a referral for that
  domain
  back to it's self there is NOT.
 
 Just a WAG from a guy who's never tried to do this.

 Could the localhost in question actually be the server you are failing
 to connect to, and not your client machine? You are sure about your
 uid/pswd? dbname?


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


I actually do not allow the user in the connection string to connect locally
which makes me think it is not accepting the host parameter and defaulting to
the localhost.
I would expect this if connecting localhost but the IP is not the local host IP.

My question is WHY is it changing the host parameter?

Re: [PHP] Re: PDO question

2012-11-28 Thread ad...@buskirkgraphics.com

 On November 28, 2012 at 4:11 PM Jim Giner jim.gi...@albanyhandball.com
 wrote:
 On 11/28/2012 3:58 PM, ad...@buskirkgraphics.com wrote:
 
  Guys,
  I am not quiet sure what is happening but every time i try to connect to a
  remote host it refers back to localhost.
 
  $pdo = new PDO('mysql:host=171.16.23.44;dbname=test', 'user','password');
 
  ERROR: Access denied for user 'user'@'localhost' (using password: YES) in
  /var/www/html/text.php
 
  Any clue as to WHY it keeps referring back to localhost when i clearly set
  the
  host parameter to another server.
  I checked the /etc/hosts records to see if there was a referral for that
  domain
  back to it's self there is NOT.
 
 Just a WAG from a guy who's never tried to do this.

 Could the localhost in question actually be the server you are failing
 to connect to, and not your client machine? You are sure about your
 uid/pswd? dbname?


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


In reading your question again, I get what you are saying. Let me explain.

It is not actually saying 'localhost' it is saying 'server1.mydomain.com' of the
server I am connecting from.
not the server2.mydomain.com.

I have ensured the path is correct, PING, NSLOOKUP from the server trying to
make the connection.
It changes the domain


[PHP] PDO mysql Connection issue

2012-11-28 Thread ad...@buskirkgraphics.com
I am having a PDO mysql connection issue I cant explain.

On server server1.mydomain.com
I have a test script
?php
$pdo = new PDO('mysql:host=171.16.23.44;dbname=test', 'user','password');
?
171.16.23.44 is by an A record called server2.mydoamin.com  they are 2 different
servers.
This script returns an error:
ERROR: Access denied for user 'user'@'server1.mydomain.com' (using password:
YES)

I find this ODD because that is not the server i am connecting TO but FROM.
Why would the PDO connection be referring back to its own localhost instead of
the intended domain.
I have tried this by fully qualified domain name, same thing.
I have ensured the route does exist on the connecting server.
I have ensured there is no local reference to the domain name/IP back to its
self.

I log into 171.16.23.44 and there is NO record of the failed attempt.
I validate the user has remote access rights.
I validate there is not a firewall rule blocking the host/port/you name it.
I telnet from the server to the destination via port 3306 it connects.

BTW (171.16.23.44) IS FAKE I AM USING THE IP AS AN EXAMPLE HERE.

Any clue as to WHY the host parameter is not setting or is it setting and
something else is wrong?

Re: [PHP] include path in httpd.conf

2010-04-05 Thread ad

Ash,

Nice call.   .htaccess was not being processed at all which led me to a 
cname configuration error for the sub domain.


Thanks!.

On 4/5/2010 8:27 PM, Ashley Sheridan wrote:

On Mon, 2010-04-05 at 19:40 -0400, ad wrote:

I have several virtual hosts on a dedicated server.
In a IFmodule mod_php5c container in an httpd.conf  include file I have
the following to create a unique include path for each virtual host:

IfModule mod_php5.c
php_value include_path .:/home/virtual/site#/path/to/include
php_admin_flag safe_mode off
/IfModule

  For one of the virtual hosts I've set up a dev site in a subdomain at
  dev.site#.com for development.
  In the root directory of this development site I have an .htacces file
  to create another unique include_path solely for this development subdomain.

  php_value include_path  .:/home/virtual/site#/path/to/dev/includes

  Also in the httpd.conf I have
  Directory /home/virtual/site#/path/to/dev/root/
  Allow from all
  AllowOverride All
  Order allow,deny
  /Directory


  The configuration is CentOS 5.3, Apache/2.2.3, PHP 5.1.6

  I recently upgraded the OS from FC6 and the PHP version and I have not
  been able to get the include_path to change for this dev.subdomain.
  Even after restarting apache it PHPinfo tells me it is reading the
  server php.ini and the virtual host include path for the httpd.conf but
  it is ignoring the .htaccess file.

  I've even tried putting the php.ini with specific settings in the
  /home/virtual/site#/root directory to no avail.

Any ideas how to make this work or even a better set up?

Thanks in advance.


 


Are you able to determine if you can set any attributes with the 
.htaccess file? Is it possible the .htaccess isn't being processed at all?


I'm not sure why the virtual server settings are being ignored in the 
httpd.conf file though. Have you checked any other .conf files in that 
directory to see that they are not being set there? As far as I can 
remember, the .conf files in that directory are executed in 
alphabetical order, so a different file might be overriding your settings?


Thanks,
Ash
http://www.ashleysheridan.co.uk






[PHP] Fatal error: Call to undefined function: mysql_connect()

2003-03-04 Thread AD
I'm getting this error while testing the script below just for connectivity.
Mysql is running on XP and apache and php are on openbsd. It seems like I
don't have something configured right in php I guess but I'm not sure. Here
is the script:

?php
$link = mysql_connect(192.168.2.4, root, )
or die (Could not connect);
print (Connected successfully);
mysql_select_db (mort)
or die (Could not select database);

$query = SELECT * FROM leads;

  //make sure you've got this area correct
  // and if you're not sure check the snazzy phpmyadmin cheat sheat
   // on creating queries!

$result = mysql_query ($query)
or die (Query failed);

// printing HTML result

print table\n;
while ($line = mysql_fetch_array($result)) {
print \ttr\n;
while(list($col_name, $col_value) = each($line)) {
print \t\ttd$col_value/td\n;
}
print \t/tr\n;
}
print /table\n;

mysql_close($link);
?


Thanks in advance for any help.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] RE: PHP object communication

2001-10-29 Thread ad

Sorry, it was Tim that suggested that what I required wasn't really OO. My
apologies Tim, and thanks for your emails.

adam



Adam Beecher - CEO  Core Geek - ieWebs™

e  ...  [EMAIL PROTECTED]
w  ...  http://www.iewebs.com
m  ...  Box 81, Eglinton St, Cork, Ireland



 -Original Message-
 From: Tim Ward [mailto:[EMAIL PROTECTED]]
 Sent: 25 October 2001 12.04
 To: [EMAIL PROTECTED]; Tim Ward; [EMAIL PROTECTED]
 Subject: RE: PHP object communication


 see below for comments

   Tim Ward
   Senior Systems Engineer

 Please refer to the following disclaimer in respect of this message:
 http://www.stivesdirect.com/e-mail-disclaimer.html


  -Original Message-
  From:   [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
  Sent:   Thursday, October 25, 2001 11:56 AM
  To: Tim Ward; [EMAIL PROTECTED]
  Subject:RE: PHP object communication
 
  Hi Tim,
 
   If you want access to error functions within the db class it
 must either
   extend the error class or have an error object within it. Either ...
  
  I'll go for the latter, because extends isn't appropriate in this case:
   [Tim Ward]  I think I would use the second option in your case as
 well, but always consider inheritance, it's beter where it is appropriate

   Class DB
   { var $error;
   ...
 function DB() // constructor
 {   ...
 $this-error = new Error();
 }
   ...
   }
  
   Class Core
   { var $db;
 var error;
  
 function Core() // constructor
 {   ...
 $this-db = new DB();
 $this-error = new Error();
 ...
 }
   }
 at the end of the day, both these are ways of getting around the
   lack of multiple inheritance
  
 
  In this case, don't I have a completely different error object in
  $Core-db?
 [Tim Ward]  Yes, which is exactly what you want.

 the classes DB and Core both need to handle their own errors.
 What you don't
 want to do is handle errors in DB within an instance of Core. That would
 mean DB cannot cannot function except as part of Core. Remember  .. there
 are 2 O's in OOP, the second one is important. Each class should be
 complete. if you try to get DB to use error functions defined (or
 inherited
 by) in Core you are effectively trying to get a parent to inherit from a
 child.
 
  adam



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] RE: PHP object communication

2001-10-25 Thread ad

Hi Tim,

 If you want access to error functions within the db class it must either
 extend the error class or have an error object within it. Either ...

I'll go for the latter, because extends isn't appropriate in this case:

 Class DB
 { var $error;
 ...
   function DB() // constructor
   {   ...
   $this-error = new Error();
   }
 ...
 }

 Class Core
 { var $db;
   var error;

   function Core() // constructor
   {   ...
   $this-db = new DB();
   $this-error = new Error();
   ...
   }
 }
   at the end of the day, both these are ways of getting around the
 lack of multiple inheritance


In this case, don't I have a completely different error object in $Core-db?

adam


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP object communication

2001-10-24 Thread ad

Not coming from a programming background, I'm going to have difficulty
explaining this one... :)

I would like to handle an entire application through one object, which in
turn contains objects. I only recently got classes though, and I don't
fully understand if what I want to do is possible, or if I'm going about it
the wrong way. Consider:

?php

// All of these will be in separate files.
// The first two are separated simply because
// I want to keep my include files small.

class Config {
// Base config class.
// Just contains data.
}

class Core extends Config {
// Base application class.
// Just contains methods.
}

class Error {
// Error handler.
}

class DB {
// Database handler.
}

?

Tying the first two together is no problem, I can just extend the Config
class. However I would like to incorporate the third and fourth as objects
inside the main object:

?

// In fact these would be instantiated (is that the
// right word?) inside the Core class.

$Core= new Core;
$Core-Error = new Error;
$Core-DB= new DB

?

This is fine when working in the main application, or in the $Core object,
but where I get stuck is with communication between the $Core-Error and
$Core-DB objects. Say for example that within the DB class I encountered an
error, and wanted to talk to the Error object - I /could/ do this:

?

class DB {

var $Error;

function DB() {
global $Core;
$this-Error = $Core-Error;
}

}

?

But if I extend the application later and add a bunch of new classes, it
means I have to do the same for each object I add. I get the impression that
I might be able to do this with references, but I can't get a handle on them
for the life of me. Can someone explain?

Sorry for the lengthy post.

Thanks,
adam


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Form Question

2001-10-21 Thread AD

Why not just post to the same script, then you don't have to worry about
this?

Hth,

-AD

Chip Landwehr [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I can't do that because  the form is to big and there is a limit to how
much
 data you can send via the URL bar.  Any other ideas?





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] download script

2001-08-21 Thread AD

Hi,

I'm working on a download script

header(Content-Type: application/octet-stream\n);
header(Content-Length: $size\n);
header(Content-Disposition: attachment; filename=\$file\\n);
header(Content-Description: Download\n);
readfile($path.$file);

This works, but when the initial file download box pops up it says
downloading file download.php (the name of the script), instead of the
filename. The correct filename does appear in the next save as box. Does
anyone know how to get the filename to show up in the initial file download
box? Or, alternatively, how to bypass the first box alltogether (like it is
done at downloads.com, for example)?

Thanks,

Adam



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]