php-windows Digest 30 Mar 2004 07:02:47 -0000 Issue 2187

Topics (messages 23296 through 23309):

Virtual Hosts - How to Configure
        23296 by: James
        23298 by: Shrock, Court

Re: PEAR vs. PHPLib
        23297 by: Justin Patrin

Re: Proper coding?
        23299 by: Jason Barnett

Re: Session destruction FAILED
        23300 by: Jason Barnett

Re: Apache running...now what?
        23301 by: Leo g. Divinagracia III

Re: isset() question
        23302 by: Jason Barnett

Re: I need to display records of a Database on html,
        23303 by: Jason Barnett

Re: Page/Form caching
        23304 by: Jason Barnett

(PHP-WIN) I need to view a summary within a specified date
        23305 by: zosimo miravite, jr.
        23308 by: Jason Barnett
        23309 by: Svensson, B.A.T. (HKG)

Re: AdoDB error
        23306 by: Jason Barnett
        23307 by: Jason Barnett

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
I am setting up apache/php on a windows box as a test, and would like to
know how to set up php so that each virtual host has their own smtp /
mailserver settings.  As I understand the config now, they will share the
settings in the php.ini file located in the windows folder.  Is there an
alternate or additional config that would allow virtual host (1) have smtp =
host1domain.com and virtual host (2) have smtp = host2domain.com?

Any help is appreciated.


James

--- End Message ---
--- Begin Message ---
The most straight forward that I can see would be to always prepend a php
file that does the appropriate ini_set's based on $_SERVER['HTTP_HOST'] or
$_SERVER['SERVER_NAME'].  For example:


::::: your php.ini :::::
include_path = ".;c:\php\includes"
auto_prepend_file = setup_vhost.php


::::: c:\php\includes\setup_vhost.php :::::
$settingFile = 'vhosts/'.$_SERVER['HTTP_HOST'].'php';
if (file_exists($settingFile)) {
  $settings = parse_ini_file('vhosts/'.$_SERVER['HTTP_HOST']);
  foreach($settings as $setting=>$value) {
    ini_set($setting, $value);
  }// foreach
}// if


::::: vhosts/www.host1.com.php :::::
; <?php exit; ?>  # this line is here to make sure nothing happens if
executed
smtp = host1domain.com
sendmail_from = [EMAIL PROTECTED]


::::: vhosts/www.host2.com.php :::::
; <?php exit; ?>  # this line is here to make sure nothing happens if
executed
smtp = host2domain.com
sendmail_from = [EMAIL PROTECTED]



of course, you could pull the data from a db and make the logic in
setup_vhost more complex; but you should get the point from this simplified
example.



> -----Original Message-----
> From: James [mailto:[EMAIL PROTECTED] 
> Sent: Monday, March 29, 2004 8:27 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Virtual Hosts - How to Configure
> 
> 
> I am setting up apache/php on a windows box as a test, and 
> would like to know how to set up php so that each virtual 
> host has their own smtp / mailserver settings.  As I 
> understand the config now, they will share the settings in 
> the php.ini file located in the windows folder.  Is there an 
> alternate or additional config that would allow virtual host 
> (1) have smtp = host1domain.com and virtual host (2) have 
> smtp = host2domain.com?
> 
> Any help is appreciated.
> 
> 
> James
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message --- Jim Macdiarmid wrote:

Can anyone shed some light on these two?  Pros and Cons, etc.  I've just
ran across an article that mentions that PHPLib is the "defacto"
standard. I've recently started using the PEAR::DB in a web application
and I'd like to make sure that I'm working with something that is
reliable. Can anyone give me their feelings on these two
(methodologies?) please?

Thank you,
Jim

I've been using PEAR packages for quite a while now in a production environment and they've all been very stable (when marked stable ;-) and extremely useful. Even though I don't plan to change our DBs, I still use PEA::DB as it is very nice to have all of its added functionality and automatic resource handling as well as a unified API to ALL DB backends.


--
paperCrane <Justin Patrin>

--- End Message ---
--- Begin Message --- Jim Macdiarmid wrote:

In the index.php file I have the following code:

require_once('include/db_connect.php'); require_once('include/db_functions.php');

/* includes commonly used functions */
require_once('common.php');

$sphist_rec_count =
GetRecCount('RecentActiveSpaces','RECENT_SPACE_COUNT');


In my db_functions.php, I have the function called GetRecCount(). It
basically retrieves the
Record count from a mySQL table. For some reason, the "db_object" object
doesn't get created unless I include the db_connect.php inside the GetRecCount function. Something

This sounds like a problem with your PEAR::DB object's scope. Without more information about your db_connect file it's hard to say exactly what's wrong. However, you if you go to this page you should be able to figure out what's wrong:
http://www.zend.com/manual/language.variables.scope.php


tells me that this is not proper
Coding, and I was wondering if someone could tell me if there is another
way to do this?

common.php: require_once 'include/db_functions.php'; require_once 'include/db_connect.php';

index.php:
require_once 'common.php';

Now any file that uses common.php will have access to db_connect.php and db_functions.php


Thanks, Jim

--- End Message ---
--- Begin Message --- Can you give us some code to try to reproduce the error? Without seeing anything, my guess is you use a function to destroy sessions and it is being called when it shouldn't be.
--- End Message ---
--- Begin Message --- jota wrote:

I believe I have already done everything to install PHP, and Apache starts
up fine for me (Apache 1.3.29).

But, it seems that Apache still doesn't know what to do with the PHP files.




have you tried to d/l packages like SWAMP, FOX-SERV, which are just a couple of the numerous stuff that people have setup to install the (W)AMP onto a windows box...


they can coexist on a machine with a previous apache setup. just dont start either apaches as an automatic service.

see what the diff is in the config files.


http://swamp.sourceforge.net


http://www.foxserv.net
--- End Message ---
--- Begin Message --- Anthony Ritter wrote:

The following script is from Kevin Yank's book (Sitepoint).

When I test it _without_ entering a name in the text box and hit submit, the
_next_  page
loads - however the same page should load beacuse of the conditional
........
if (!isset($name) ):
.....

If I replace

!isset()

This only checks if a variable has not been set. Any value, including an empty string "" can cause !isset($name) to fail; this is correct.



with


empty()


like


if (empty($name)):

Right... now you're checking if $name is empty. Empty($name) would fail this test, which is correct also.




and do not enter a name then the _same_ page loads which is what is supposed to happen.

Why doesn't the call to !isset() with the negation mark loads the next page
when a name is not entered?


Because the tutorial writer meant it to work that way? Sometimes it is useful to pass empty strings to a php script. But in any case, you understand the PHP functions correctly.

--- End Message ---
--- Begin Message --- M.Feoli wrote:

Hi, I am rephrasing my last question,

I have a database which I need to access via Web,  and display multiple
pages of the resulting records of the select statement I issue.

Is there a code for this out there, which I could start with.


thanks

You might also check out the Pager class that comes with PEAR. You can download it from pear.php.net, or if you have PHP 4.3.2+ then you should already have it in your PEAR directory.

--- End Message ---
--- Begin Message --- Jim Macdiarmid wrote:

Hi everyone,

I think I'm having some issues with page/form caching and I'm not sure
how to turn it off just for the current page, or if that is the proper
thing to do. When I click submit on the form, the page redisplays
however it doesn't seem like any processing is taking place. This is how
I've structured my page..

I have the form action calling $_SERVER['PHP_SELF'] and the method is
post.

Setting action = $_SERVER['PHP_SELF'] is why you are getting the same page back.




<?php

/* attempting to loop through the $_POST global here

I hope you're doing variable checking here. Perhaps something like:


<?php
$valid = true;
if (empty($_POST['emptyvar'])) {
    $valid = false;
}
if (!is_string($_POST['stringvar'])) {
    $valid = false;
}
...
if ($valid) {
    header('next_script.php');
}
?>

Although if you have the time to invest, I suggest you try a PEAR package called HTML_QuickForm. Once you learn how to use it you can create new forms (with validation) quickly.


?>


<HTML>
<HEAD></HEAD>
<BODY>
..etc...
</BODY>
</HTML>

<?php

/* php function code here */

?>


Any help to resolve this will be very appreciated,


Jim

--- End Message ---
--- Begin Message ---
Clear DayHi, i am a new member here. i have a prblem regarding with my php
script - viewing a summary of my report. i have already encoded several
reports. all i need is to view it within a specified date. like for
instance, from May 1, 2004 to Sep 31, 2004. inputting these dates,
automatically views the report within these dates. is there a code for this.
PLS HELP. THANKS.

--- End Message ---
--- Begin Message --- Zosimo Miravite wrote:

Clear DayHi, i am a new member here. i have a prblem regarding with my php
script - viewing a summary of my report. i have already encoded several
reports. all i need is to view it within a specified date. like for
instance, from May 1, 2004 to Sep 31, 2004. inputting these dates,
automatically views the report within these dates. is there a code for this.
PLS HELP. THANKS.

Use a database like MySQL, insert your reports into one of the database tables, and send a query to the database table when you need the report.
PEAR::DB is a great package for accessing databases.

--- End Message ---
--- Begin Message ---
Do you fetch this data from and RDBSM? 
If so, then you should be able to do a selection on dates.

-----Original Message-----
From: zosimo miravite, jr.
To: php
Sent: 2004-03-30 05:15
Subject: [PHP-WIN] (PHP-WIN) I need to view a summary within a specified
date

Clear DayHi, i am a new member here. i have a prblem regarding with my
php script - viewing a summary of my report. i have already encoded several
reports. all i need is to view it within a specified date. like for
instance, from May 1, 2004 to Sep 31, 2004. inputting these dates,
automatically views the report within these dates. is there a code for
this.
PLS HELP. THANKS.

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

--- End Message ---
--- Begin Message --- Bruno Reato wrote:

Hi!! i'm newbie in PHP's world and i trying execute a simple query with php
5 and interbase 7, but, when i execute
$db = ADONewConnection('ibase'), get the next error:

PHP Fatal error: Class ADODB_Iterator contains 1 abstract methods and must
therefore be declared abstract (Iterator::hasMore) in
c:\PHP\adodb\adodb-iterator.inc.php on line 66

what's wrong?

Thanks.
Bruno

This is related to the new PHP object model, see


Abstract functions (like Iterator::hasMore) CAN NOT be called, but they are listed so that people will extend the class and create their own function with that name, like:

class MyIterator extends Iterator
    function hasMore() {
        // Does whatever you code here, see notes from Iterator author
    }
}

Contact whoever created that file, and ask them to either make the Iterator class abstract or get rid of the abstract functions. If the author makes the Iterator class abstract, you'll need to do something like I have above.
--- End Message ---
--- Begin Message ---
Sorry, forgot the link:
https://www.zend.com/php5/articles/engine2-php-oo.php

--- End Message ---

Reply via email to