Re: [PHP] function problem

2005-01-03 Thread Viktor Popov
Hi!
Thank you for the reply!
I have change the function:

function doReg($fname1=,$family1=,$company1=, $MOL1=, $dannum1=,

$bulstat1=, $phone1=, $email1=, $username1=, $password1=,
$payment1=,

$maillist1=, $Addr1=, $City1=, $zipcode1=, $Country1=,
$shippingName1=,

$shippingFamily1=, $shippingphone1=, $shippingAddr1=,
$shippingcity1=,

$shippingzipcode1=, $shippingCountry1=)
{

  if(!($link = mysql_pconnect ($DB_SERVER, $DB_LOGIN, $DB_PASSWORD)))
 {
   echo the connection failed;
   exit();
 }


  if(!($newresult = mysql_db_query($DB, insert into
users(name,family,company, MOL,

taxnum, bulstat, phone, email, username, password, payment, maillist, Addr,
City,

zipcode, Country, shippingName, shippingFamily, shippingphone, shippingAddr,

shippingcity, shippingzipcode, shippingCountry)
values('$fname1','$family1','$company1', '$MOL1', '$dannum1', '$bulstat1',
'$phone1',

'$email1', '$username1', '$password1', '$payment1', '$maillist1', '$Addr1',
'$City1',

'$zipcode1', '$Country1','$shippingName1','$shippingFamily1',

'$shippingphone1','$shippingAddr1', '$shippingcity1', '$shippingzipcode1',

'$shippingCountry1'
 {
   echo the insertiont cannot be done;
   exit();
 }
header(Location:http://$HTTP_HOST/$DOCROOT/allright.html;);
 exit();
}

When i try to insert -  the problem is in the insertion. The message  the
insertiont cannot be done; appears. Do you know what could be the mistake?

Thank you!

Viktor

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



[PHP] Re: function problem

2005-01-03 Thread Viktor Popov
Hi, thank you for your reply! I'll consider carefully this holes. Thank you!

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



Re: [PHP] Using SSL

2005-01-03 Thread Jonel Rienton
Consulting the Apache documentation is better, seems like you just 
missed configuring the conf file of Apache. Have you created the 
certificate for your domain?  SSL will not be loaded unless you 
configure it in the conf file(httpd.conf/apache2.conf)

regards,
http://jonel.road14.com
--
I not know English well, but I know 7 computer languages.
anonymous
On Jan 2, 2005, at 11:41 PM, Daniel Lahey wrote:
I've posted about this before, and I guess I'm just thick, but I'm 
just not getting it.

I need to implement secure transactions for a client, but I just can't 
figure out how to open a page with an https prefix.  The server has 
mod-ssl and OpenSSL compiled into it:

Apache/1.3.33 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 
mod_bwlimited/1.4 PHP/4.3.9 FrontPage/5.0.2.2635 mod_ssl/2.8.22 
OpenSSL/0.9.7a PHP-CGI/0.1b

Here's the PHP config:
'./configure' '--with-apxs=/usr/local/apache/bin/apxs' '--with-xml' 
'--enable-bcmath' '--enable-calendar' '--with-curl' '--with-dom' 
'--with-dom-xslt' '--with-dom-exslt' '--enable-exif' '--enable-ftp' 
'--with-gd' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr' 
'--with-xpm-dir=/usr/X11R6' '--with-gettext' '--with-imap' 
'--with-imap-ssl' '--with-kerberos' '--enable-mbstring' 
'--enable-mbstr-enc-trans' '--enable-mbregex' '--with-mcrypt' 
'--with-mhash' '--with-ming=../ming-0.2a' '--enable-magic-quotes' 
'--with-mysql' '--with-openssl' '--enable-discard-path' '--with-pear' 
'--with-pspell' '--enable-sockets' '--enable-track-vars' '--with-ttf' 
'--with-freetype-dir=/usr' '--enable-gd-native-ttf' 
'--enable-versioning' '--enable-wddx' '--with-xmlrpc' '--with-zlib'

I'm unable to open any pages with an https prefix, .html or .php.  I 
get the message:

The requested URL /index.html was not found on this server.
(or whatever page I try to open other than index.html)  This is in 
Firefox.

If I try it locally, I get Connection refused when attempting to 
contact localhost.  This is in Firefox.  If I try to open a page on 
the server in Safari, I get redirected to http://www.netidentity.com/  
Huh?  If I try it locally in Safari, I get 'Safari can't connect to 
the server.  Safari can't open the page https://localhost/ because it 
cannot connect to the server localhost.'  (I get the standard Apache 
default page as http://localhost/).

From everything I've read and been told, all that should be necessary 
is to compile ssl into the server and PHP and add the https prefix.  
Aargh.

Should I be consulting an Apache mail list?  Try to get a gig bagging 
groceries?  Any advice as to where to find information about using SSL 
would be HUGELY appreciated.  TIA

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

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


[PHP] or-die option - Opinions please...

2005-01-03 Thread gustav
Hi there all!

I'm thinking of the or die suffix (or option or whatever it is called)...

I can use or die together with opening a db.

open_mysqldb(bla.bla.) or die(couldn't connect to db);

But this is just useful when developing?

I don't want my users to see that a specific table can't be opened?
Or do I want that? What's your opinion?

/G
@varupiraten.se

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



Re: [PHP] or-die option - Opinions please...

2005-01-03 Thread Burhan Khalid
[EMAIL PROTECTED] wrote:
Hi there all!
I'm thinking of the or die suffix (or option or whatever it is called)...
I can use or die together with opening a db.
open_mysqldb(bla.bla.) or die(couldn't connect to db);
But this is just useful when developing?
I don't want my users to see that a specific table can't be opened?
Or do I want that? What's your opinion?
For production sites, turn of error reporting and turn on error logging, 
or write your own error handler functions.

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


Re: [PHP] unable to write a text file larger than 10Mb

2005-01-03 Thread Burhan Khalid
Sagar C Nannapaneni wrote:
Hello All,
This is very imp and urgent for me. I've a very large db on my remote website. I want to get a backup of that db. phpmyadmin is installed on the server..but if failed to create the backup (may b coz of the time outs). so i wrote my own class to get the backup. Its working fine except that PHP is not able to write a file larger than 10Mb. I've tried to export the data to Excel...The same problem repeated again. Is there any parameters to change in php to make it write larger files...???
Are you sure your script isn't timing out?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: function problem

2005-01-03 Thread Viktor Popov
Hi,

Thank you for your reply!

I have changed the function like this:

function doReg($fname1=,$family1=,$company1=, $MOL1=, $dannum1=,
$bulstat1=, $phone1=, $email1=, $username1=, $password1=,
$payment1=, $maillist1=, $Addr1=, $City1=, $zipcode1=,
$Country1=, $shippingName1=, $shippingFamily1=, $shippingphone1=,
$shippingAddr1=, $shippingcity1=, $shippingzipcode1=,
$shippingCountry1=)
{

  mysql_pconnect ($DB_SERVER, $DB_LOGIN, $DB_PASSWORD) or
die(mysql_error());



 mysql_select_db($DB) or die(mysql_error());
  mysql_query( insert into users(name,family,company, MOL, taxnum, bulstat,
phone, email, username, password, payment, maillist, Addr, City, zipcode,
Country, shippingName, shippingFamily, shippingphone, shippingAddr,
shippingcity, shippingzipcode, shippingCountry)
values('$fname1','$family1','$company1', '$MOL1', '$dannum1', '$bulstat1',
'$phone1', '$email1', '$username1', '$password1', '$payment1', '$maillist1',
'$Addr1', '$City1', '$zipcode1',
'$Country1','$shippingName1','$shippingFamily1',
'$shippingphone1','$shippingAddr1', '$shippingcity1', '$shippingzipcode1',
'$shippingCountry1')) or die (mysql_error());


}

I think that the problem is not in the insertion string because when write
the function body :
 mysql_pconnect(.);
mysql_select_db($DB) or die(mysql_error());
mysql_query(insert into );

instead doReg() in register.php, everything works. I have inserted some data
in this way.
The problem is that A DATABASE is  NOT SELECTED. This is the message when I
use doReg().

The register.php   is   in the DOCROOT-emagazine.  In the subdirectory
script are common.inc  and  functions.php. In common.inc is this:

?php
 $DB_SERVER=localhost;
 $DB_LOGIN=admin;
 $DB_PASSWORD=**;
 $DB=emagazine;
 $HTTP_HOST=localhost:3000;
 $DOCROOT=emagazine;

?

Is it all right? I think that $DB=emagazine  should work. Here I select
the $DB, which name is emagazine.

I don't understand what's going on:)



Thank you!

Viktor

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



[PHP] Calculate No Of Days

2005-01-03 Thread khuram noman
Hi 

Is there any function avialable in PHP to calculate
the no of days by passing 2 dates like 1 argument is
1/1/2005 and the second one is 1/2/2005 then it
returns the no of days or how can i do that if there
is no builtin function .

Regards
Khuram Noman

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



[PHP] Register Globals=ON

2005-01-03 Thread HarryG
Which process is better to use in PHP?

Having register_globals=on and referring to variables as if($name){} or
using $_GET  $_POST statements like if(isset($_GET['name']))?

What is the main advantage/disadvantage in both cases.

Thanks
HarryG

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



Re: [PHP] unable to write a text file larger than 10Mb

2005-01-03 Thread Sagar C Nannapaneni
yes,,

I'm sure that my script is not timing out...

Also i set mysql connection timeout to max.

/sagar
- Original Message -
From: Burhan Khalid [EMAIL PROTECTED]
To: Sagar C Nannapaneni [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Monday, January 03, 2005 3:37 PM
Subject: Re: [PHP] unable to write a text file larger than 10Mb


 Sagar C Nannapaneni wrote:
  Hello All,
 
  This is very imp and urgent for me. I've a very large db on my remote
website. I want to get a backup of that db. phpmyadmin is installed on the
server..but if failed to create the backup (may b coz of the time outs). so
i wrote my own class to get the backup. Its working fine except that PHP is
not able to write a file larger than 10Mb. I've tried to export the data to
Excel...The same problem repeated again. Is there any parameters to change
in php to make it write larger files...???

 Are you sure your script isn't timing out?

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





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



Re: [PHP] Calculate No Of Days

2005-01-03 Thread RaTT
Hi Khuram 

I use this function 

function daysLeft($startDate,$endDate=false){
// convert to timestamps

$start_stamp = strtotime($startDate);
$end_stamp   = ($endDate)?strtotime($endDate):time();

if($start_stamp  $end_stamp){
// start date is passed end date
return 0;
}
$difference = $end_stamp - $start_stamp;
return floor($difference/(24*60*60));
}

echo  daysleft(today, 01/05/2005);

Note, remeber to use the correct dat format otherwise you will see
some unexpected results.

Jarratt 


On Mon, 3 Jan 2005 02:33:58 -0800 (PST), khuram noman
[EMAIL PROTECTED] wrote:
 Hi
 
 Is there any function avialable in PHP to calculate
 the no of days by passing 2 dates like 1 argument is
 1/1/2005 and the second one is 1/2/2005 then it
 returns the no of days or how can i do that if there
 is no builtin function .
 
 Regards
 Khuram Noman
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around
 http://mail.yahoo.com
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



[PHP] Total Server Sessions

2005-01-03 Thread HarryG
Is there an easier way to count the total number of sessions running on a
PHP webserver? something like session_count();

I've seen some php site where it tells you how many people are currently
online, which I guess is being done by keeping a count of total sessions
running on the server

Thanks
HarryG

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



[PHP] Re: Calendar Script

2005-01-03 Thread HarryG
Cool.. just tried your script. I might try to convert it to Smarty template 
compatible code, in my spare time. Have you used Smarty Templates??
  Joe Harman [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
  Hello,

  I just finished writing a basic calendar script... I wanted to pass it out to 
everyone here... maybe someone could use it... or, even better optimize it.. 
.and maybe share that with me.

  ?php

  function Cal_Month()
   {
// Get Today's Date
 $todays_date = getdate();

// Determine what month to display
 if(isset($_GET['month']))
  {
   $resolve_time = 1 .$_GET['month']. .$_GET['year'];
   $resolve_first_day_of_month = strtotime($resolve_time);
   $resolved_date = getdate($resolve_first_day_of_month);
  }
  else
  { $resolved_date = $todays_date; }

// if this is the current month - say it's okay to mark today on the 
calendar
 if($todays_date['year'] == $resolved_date['year']  $todays_date['month'] 
== $resolved_date['month'])
  {  $mark_today_on_calendar = TRUE; }

// HOW MANY DAYS ARE IN THIS MONTH
 $days_in_current_month = cal_days_in_month(CAL_GREGORIAN, 
$resolved_date['mon'], $resolved_date['year']);

// STRING TO START THE CALENDAR ON THE FIRST DAY OF THE MONTH
 $show_month = $resolved_date['month'];
 $show_year = $resolved_date['year'];

// Get Info for Current Displayed Month 
 $string_time = 1 .$show_month. .$show_year;
 $first_day_of_month = strtotime($string_time);
 $first_day = getdate($first_day_of_month); //**
 $the_first_day_of_the_month = getdate($first_day_of_month); // Starts from 
the 1st
 
 $num_days_week = 7;
 $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, 
$resolved_date['mon'], $resolved_date['year']);

// Get info for NEXT month 
 $show_next = strtotime(+1 Month, $first_day_of_month); 
 $show_next_month_first_day = getdate($show_next);
 
// Get info for PREV month 
 $show_prev = strtotime(-1 Month, $first_day_of_month); 
 $show_prev_month_first_day = getdate($show_prev);
 
 $next_month = $show_next_month_first_day['month'];
 $next_year = $show_next_month_first_day['year'];
 $prev_month = $show_prev_month_first_day['month'];
 $prev_year = $show_prev_month_first_day['year']; 
 
 $link_next_month = a 
href=\?month=.$next_month.year=.$next_year.\Next Month /a;
 $link_prev_month = a 
href=\?month=.$prev_month.year=.$prev_year.\Prev Month /a;

// Table Size Variables... will be moved to CSS eventually
 $table_align = center;
 $table_width = 500;
 $table_height = 50;
 $cell_width = $table_width/7;   
// Start HTML for Building Calendar

  $cal_generated .= center.$link_prev_month. 
.$link_next_month./center;
  $cal_generated .= table width=\.$table_width.\ border=\1\ 
align=\.$table_align.\;
  $cal_generated .=  trtd 
colspan=\7\center.$the_first_day_of_the_month['month']. 
.$the_first_day_of_the_month['year']./center/td/tr;
  $cal_generated .= trtd width=\.$cell_width.\Sun/tdtd 
width=\.$cell_width.\Mon/td;
  $cal_generated .= td width=\.$cell_width.\Tue/tdtd 
width=\.$cell_width.\Wed/tdtd width=\.$cell_width.\Thu/td;
  $cal_generated .= td width=\.$cell_width.\Fri/tdtd 
width=\.$cell_width.\Sat/td/tr;
  
// Initial Calendar Buildin Variables
  $first_week_marked = FALSE;
  $month_day_count = 1;
  $week_day_count = 0;

// Start The Calendar Loop
  do {
if($mark_today_on_calendar == TRUE  $todays_date['mday'] == 
$month_day_count)
 { 
  $highlight_today_open = font color=\#99\; 
  $highlight_today_close = /font;
 }
else
 { 
  $highlight_today_open = font color=\#00\; 
  $highlight_today_close = /font;
 }
  
   // If it is the first day of the week open a ROW
if($week_day_count == 0)
  { 
   $cal_generated .= tr; 
  }

 if ($first_week_marked == FALSE)
  {
   $blank_cell = 0;
do {
 if($the_first_day_of_the_month['wday']  $blank_cell)
  {
   $cal_generated .= td height=\.$table_height.\ 
valign=\top\/td;
   $blank_cell++;
  }
 else
  { 
   
   
   $cal_generated .= td height=\.$table_height.\ 
valign=\top\.$highlight_today_open 
..$month_day_count..$highlight_today_close./td;
   $first_week_marked = TRUE;
  }
  
$week_day_count = $the_first_day_of_the_month['wday'];
 
   } while ($first_week_marked == FALSE);

  }
 else
  {
   $cal_generated .= td height=\.$table_height.\ 
valign=\top\.$highlight_today_open 
..$month_day_count..$highlight_today_close./td;
  }
  

Re: [PHP] Calculate No Of Days

2005-01-03 Thread tg-php
Greetings!

I've posted this before, but there are always new readers so here's my script 
solution.  One of these days I'll make it a function or something, but this 
should give you a good general idea of how to do such a thing in case you need 
it again in the future.

btw: This also calculates hours, minutes, seconds, etc between two dates.  I 
start with date/times in string format just for ease of reading but you really 
only need them in serial date/time format ($stimestamp and $etimestamp):

?php
# Standard format dates and times
$startdate = 10/30/02;
$starttime = 13:05:01;

$enddate = 12/30/03;
$endtime = 14:06:02;

# Break apart dates and times for mktime
list($smonth,$sday,$syear) = explode(/,$startdate);
list($emonth,$eday,$eyear) = explode(/,$enddate);
list($shour,$sminute,$ssecond) = explode(:,$starttime);
list($ehour,$eminute,$esecond) = explode(:,$endtime);

# Number of seconds in each timeframe, 1 month = 30 days
$secondsequiv = array(Years=31536000,
   Months=2592000,
   Days=86400,
   Hours=3600,
   Minutes=60);

# How many seconds between two dates/times
$stimestamp = mktime($shour,$sminute,$ssecond,$smonth,$sday,$syear);
$etimestamp = mktime($ehour,$eminute,$esecond,$emonth,$eday,$eyear);
$daydiff = $etimestamp - $stimestamp;

# Just to make sure I didn't use $remainder somewhere else in my script and 
forgot
if (isset($remainder)) unset($remainder);

# Cycle through timeframes checking to see if number is large enough to be a 
full year/month/day/etc
# If so, find out how many and store remainder for further processing
# If not, set to zero and continue processing
foreach ($secondsequiv as $timeframe=$seconds) {
  if (isset($remainder)) { $checkvalue = $remainder; } else { $checkvalue = 
$daydiff; }
  if ($checkvalue = $seconds) {
   $daydiffarr[$timeframe] = floor($checkvalue/$seconds);
   $remainder = $daydiff % $seconds;
  } else {
   $daydiffarr[$timeframe] = 0;
  }
}

# If $reminder is never used, then we're dealing with less than a minute's 
worth of time diff
if (isset($remainder)) {
  $daydiffarr[Seconds] = $remainder;
} else {
  $daydiffarr[Seconds] = $daydiff;
}

# Display results
foreach ($daydiffarr as $timeframe=$count) {
  echo $timeframe = $countbr\n;
}
?

= = = Original message = = =

Hi 

Is there any function avialable in PHP to calculate
the no of days by passing 2 dates like 1 argument is
1/1/2005 and the second one is 1/2/2005 then it
returns the no of days or how can i do that if there
is no builtin function .

Regards
Khuram Noman

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



[PHP] migrating to PHP 5 + Apache 2 from PHP 4.3.8 + Apache 1.3.33.

2005-01-03 Thread symbulos partners
Dear friends,

we would like to migrate a server where we host several websites (in virtual
hosting) to PHP 5 with Apache 2.

Technical support at the hosting provider told us there are still problems
about safety of threads on php 5 + Apache 2 (management of memory). They
would propose to migrate Apache to the pre-fork version in order to avoid
these problems (but we would be unable to use all the features of Apache
2). 

Is that right?

Has anybody switched to that combination already?

Any suggestion about recommended php, Apache versions?
-- 
symbulos partners
-.-
symbulos - ethical services for your organisation
http://www.symbulos.com

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



Re: [PHP] migrating to PHP 5 + Apache 2 from PHP 4.3.8 + Apache 1.3.33.

2005-01-03 Thread Rasmus Lerdorf
symbulos partners wrote:
Dear friends,
we would like to migrate a server where we host several websites (in virtual
hosting) to PHP 5 with Apache 2.
Technical support at the hosting provider told us there are still problems
about safety of threads on php 5 + Apache 2 (management of memory). They
would propose to migrate Apache to the pre-fork version in order to avoid
these problems (but we would be unable to use all the features of Apache
2). 

Is that right?
Has anybody switched to that combination already?
Any suggestion about recommended php, Apache versions?
You want to stay away from the threaded MPM's in Apache2.
Which specific Apache2 features are you looking for?
-Rasmus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] png.h not found, something's going wrong in my PHP installation

2005-01-03 Thread Aaron Paulley
I found a thread a couple of weeks ago where someone had to create
symbolic links in order to get their install of PHP to work because
PHP wasn't able to find png.h.

I am having the same problem. I made no changes to the installation of
libpng, installed it in its default location and PHP cannot find
png.h, no matter what I set the dir= flag to.

Here is my ./configure:

./configure --with-mysql --with-apxs=/www/bin/apxs --with-xml
--enable-ftp --with-gd --enable-magic-quotes --with-jpeg-dir=/usr
--with-mcrypt --with-png-dir=/usr --enable-sockets --enable-track-vars
--enable-versioning --with-zlib --enable-bcmath --enable-calendar
--with-xpm-dir=/usr/X11R6 --enable-memory-limit

png.h on my system is located in /usr/lib

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



Re: [PHP] migrating to PHP 5 + Apache 2 from PHP 4.3.8 + Apache 1.3.33.

2005-01-03 Thread symbulos partners
Rasmus Lerdorf wrote:
 You want to stay away from the threaded MPM's in Apache2.

Why?

-- 
symbulos partners
-.-
symbulos - ethical services for your organisation
http://www.symbulos.com

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



Re: [PHP] How to argue with ASP people...

2005-01-03 Thread John Sands
I was happy as an ASP developer - you can use MSXSL for XML
processing, ADO for database, and the file scripting object for file
processing. The weakness shows up when you want to do something that
Microsoft has not built into ASP or JavaScript or the COM objects I
just listed. You're stuck writing your own COM object in VB or C++. I
was in a C++ shop and writing C++ COM components for use in ASP is
just horrible. PHP has a much larger library.

Try to find something you need to do that will require you to write a
COM component if you use ASP, and it's built into PHP.


On Thu, 30 Dec 2004 08:38:18 -0800, Tony Di Croce [EMAIL PROTECTED] wrote:
 I am fairly new to PHP, but I am loving it... I have recently gotten
 involved in a business venture and I have been using PHP so far...
 Recently I have taken on a partner, and he is a big ASP guy...
 
 I am not totally against ASP, but it would have to be pretty good to
 get me to switch at this point (PHP seems to do everything I need)...
 But I will need to convince him of this...
 
 What points can I bring up in PHP's favor? In what areas does PHP trounce ASP?
 
 --
 
 td
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



Re: [PHP] migrating to PHP 5 + Apache 2 from PHP 4.3.8 + Apache 1.3.33.

2005-01-03 Thread symbulos partners
Symbulos Partners wrote:

 Rasmus Lerdorf wrote:
 You want to stay away from the threaded MPM's in Apache2.
 
 Why?
 

Which versions would be recommended then? We would like to be able to use
the new PHP object model, and at the same time use features like the
possibility of running scriping languages using a lower rights users, as in
apache 2.
-- 
symbulos partners
-.-
symbulos - ethical services for your organisation
http://www.symbulos.com

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



Re: [PHP] php vs java....

2005-01-03 Thread Greg Donald
On Sun, 2 Jan 2005 21:48:01 -0500, GH [EMAIL PROTECTED] wrote:
 Can you please explain Threads to me?

Multiple isolated tasks executing at the same time.


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



Re: [PHP] Register Globals=ON

2005-01-03 Thread Greg Donald
On Mon, 3 Jan 2005 22:21:48 +1100, HarryG [EMAIL PROTECTED] wrote:
 Which process is better to use in PHP?
 
 Having register_globals=on and referring to variables as if($name){} or
 using $_GET  $_POST statements like if(isset($_GET['name']))?
 
 What is the main advantage/disadvantage in both cases.

It's all right there in the fine manual:

http://us2.php.net/register_globals


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



Re: [PHP] Is there any way that PHP will issue a warning when using undeclared vars?

2005-01-03 Thread Greg Donald
On Sun, 2 Jan 2005 16:23:34 -0800, Dan Eloff [EMAIL PROTECTED] wrote:
 My single biggest beef with PHP is the fact that it silently fails
 when I use a variable that has never been declared. Like if($sumbit)
 will always be false because the variable was really named $submit. My
 only clue that this is happening is whe the program fails to work as
 intended and I waste lots of time trying to find out why the block
 never executes.
 
 Or if you forget to use $this-var and you just use $var. I just had
 that happen to me too. Wasted another 30 min.
 
 Is there any way at all to control this? I went into my PHP.ini file,
 but my errors are set to E_ALL  E_STRICT which seems to be the
 highest level I can set.
 
 If not I think we should seriously push for E_STRICT warnings if a
 variable is used without every being assigned to.

I usally do something like this when I start a project, so I can
easily turn it back off later when my code goes production:
 
if( $debug )
{
error_reporting( E_ALL );
ini_set( 'display_errors', 1 );
ini_set( 'log_errors', 1 );
}
else
{
error_reporting( E_ERROR | E_WARNING | E_PARSE );
ini_set( 'display_errors', 0 );
}


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



[PHP] newbie.. $_GET $_POST

2005-01-03 Thread Pablo D Marotta
Hi there..
I need to pass variables to a page through an html link.
I do it like this:

A href=Extra/excelListing3.php?buildQuery=?php echo $buildQuery
?Export/A

where 'buildQuery' is the variable I´m passing.

In the destination page, I capture it with $_GET and that´s it.

I want to know if there is any way of doing it without showing the variables in
the direction bar.

Thanks!

Pablo



American Express made the following
 annotations on 01/03/05 06:43:25
--
**

 This message and any attachments are solely for the intended recipient 
and may contain confidential or privileged information. If you are not the 
intended recipient, any disclosure, copying, use, or distribution of the 
information included in this message and any attachments is prohibited.  If you 
have received this communication in error, please notify us by reply e-mail and 
immediately and permanently delete this message and any attachments.  Thank 
you.

**

==

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



Re: [PHP] Total Server Sessions

2005-01-03 Thread Greg Donald
On Mon, 3 Jan 2005 23:02:19 +1100, HarryG [EMAIL PROTECTED] wrote:
 Is there an easier way to count the total number of sessions running on a
 PHP webserver? something like session_count();
 
 I've seen some php site where it tells you how many people are currently
 online, which I guess is being done by keeping a count of total sessions
 running on the server

It's a piece of cake if you use database driven PHP sessions.

http://destiney.com/pub/Destiney_db_sessions_0.1.0.tar.bz2

Once you get your PHP sessions running inside a database counting the
sessions is just a select count(*) from sessions query.  You can even
force garbage collection before the count to get a realtime count.


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



[PHP] newbie.. $_GET $_POST

2005-01-03 Thread Pablo D Marotta
Hi there..
I need to pass variables to a page through an html link.
I do it like this:

A href=Extra/excelListing3.php?buildQuery=?php echo $buildQuery
?Export/A

where 'buildQuery' is the variable I´m passing.

In the destination page, I capture it with $_GET and that´s it.

I want to know if there is any way of doing it without showing the variables in
the direction bar.

Thanks!

Pablo



American Express made the following
 annotations on 01/03/05 06:54:38
--
**

 This message and any attachments are solely for the intended recipient 
and may contain confidential or privileged information. If you are not the 
intended recipient, any disclosure, copying, use, or distribution of the 
information included in this message and any attachments is prohibited.  If you 
have received this communication in error, please notify us by reply e-mail and 
immediately and permanently delete this message and any attachments.  Thank 
you.

**

==

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



Re: [PHP] migrating to PHP 5 + Apache 2 from PHP 4.3.8 + Apache 1.3.33.

2005-01-03 Thread Rasmus Lerdorf
symbulos partners wrote:
Symbulos Partners wrote:

Rasmus Lerdorf wrote:
You want to stay away from the threaded MPM's in Apache2.
Why?

Which versions would be recommended then? We would like to be able to use
the new PHP object model, and at the same time use features like the
possibility of running scriping languages using a lower rights users, as in
apache 2.
How does Apache2 let you do that?
As far as threading goes, it is simply not a good idea for a large 
complex system.  There are too many moving parts to ensure that 
everything will be threadsafe.  Most of the parts are actually 
threadsafe, but the huge problem is that we don't have a clear picture 
of which libraries out there aren't, and it is nearly impossible to 
debug a thread-related race condition.  These race conditions tend to 
only happen under heavy load and only in certain conditions so they 
aren't reproducable which makes our job of tracking them down that much 
harder.  People have reported success with PHP under Apache2 with a 
threaded MPM so you can give it a try and see how it goes.  It may work 
perfectly, or it may work perfectly for weeks and then suddenly fall 
over.  Unless you really know what you are doing we are not going to be 
able to help you with any occasional crashes.

I am a big believer in keeping the base infrastructure as simple as 
possible.  You are going to layer a lot of complexity on top of Apache 
and PHP in the form of your web applications.  You want to make sure 
that your building blocks are rock solid so if you see a problem you can 
be confident that it is something you did wrong.  If your base is shaky 
everything you build on top of it is going to be that much more unstable.

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


Re: [PHP] newbie.. $_GET $_POST

2005-01-03 Thread John Nichel
Pablo D Marotta wrote:
Hi there..
I need to pass variables to a page through an html link.
I do it like this:
A href=Extra/excelListing3.php?buildQuery=?php echo $buildQuery
?Export/A
where 'buildQuery' is the variable I´m passing.
In the destination page, I capture it with $_GET and that´s it.
I want to know if there is any way of doing it without showing the variables in
the direction bar.
Turn it into a form, and post it.
form name=whatever action=Extra/excelListing3.php method=post
input type=hidden name=buildQuery value=?php echo ( $buildQuery 
); ? /
a href=JavaScript:document.whatever.submit()Export/a
/form

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] migrating to PHP 5 + Apache 2 from PHP 4.3.8 + Apache 1.3.33.

2005-01-03 Thread symbulos partners
Rasmus Lerdorf wrote:
 
 As far as threading goes, it is simply not a good idea for a large
 complex system. 


I do not understand why, probably because I am not well prepared. Can you
explain me? As far as I know, threading should be a noticeable improvement
in case of large systems. Is there something in the implementation of PHP 5
which does not allow for safe threading? If so, what it is?

 
 I am a big believer in keeping the base infrastructure as simple as
 possible.  You are going to layer a lot of complexity on top of Apache
 and PHP in the form of your web applications.  You want to make sure
 that your building blocks are rock solid so if you see a problem you can
 be confident that it is something you did wrong.  If your base is shaky
 everything you build on top of it is going to be that much more unstable.

I totally agree. Our problem is that we want to use the new php 5 object
model, and at the same time would like to move to Apache 2 for several
different reasons.

There are 4 alternative solutions

0)php 5 + Apache 2
1)php 5 + Apache 2 pre-fork (not totally satisfactory, but better than have
a  system that is unstable)
2)php 5 + Apache 1.3.33 (which is not totally satisfactory, less than 0,1 in
any case, but better than have a system that is unstable)
3)php 4 + Apache 2 (which is not totally satisfactory, less than 0,1,2 in
any case, better than have a system that is unstable)

which one does satisfy your condition of rock solid foundation? Or shall we
stick with php 4 + Apache 1.3.33, which is VERY unsatisfactory because we
cannot use the new object model?

The server is a production server, so we must have rock solid solutions on
it.

Thanks in advance.
-- 
symbulos partners
-.-
symbulos - ethical services for your organisation
http://www.symbulos.com

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



Re: [PHP] newbie.. $_GET $_POST

2005-01-03 Thread Robby Russell
On Mon, 2005-01-03 at 10:54 -0300, Pablo D Marotta wrote:
 Hi there..
 I need to pass variables to a page through an html link.
 I do it like this:
 
 A href=Extra/excelListing3.php?buildQuery=?php echo $buildQuery
 ?Export/A
 
 where 'buildQuery' is the variable Im passing.
 
 In the destination page, I capture it with $_GET and thats it.
 
 I want to know if there is any way of doing it without showing the variables 
 in
 the direction bar.
 
 Thanks!
 
 Pablo

You can store it in POST, GET, in the SESSION, track the user in the
database... lots of ways to do it.

POST might be the easiest route without showing in the URL.

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting  Development
*--- Now supporting PHP5 ---
/

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



Re: [PHP] migrating to PHP 5 + Apache 2 from PHP 4.3.8 + Apache 1.3.33.

2005-01-03 Thread Greg Beaver
Symbulos Partners wrote:
There are 4 alternative solutions
0)php 5 + Apache 2
1)php 5 + Apache 2 pre-fork (not totally satisfactory, but better than have
a  system that is unstable)
2)php 5 + Apache 1.3.33 (which is not totally satisfactory, less than 0,1 in
any case, but better than have a system that is unstable)
3)php 4 + Apache 2 (which is not totally satisfactory, less than 0,1,2 in
any case, better than have a system that is unstable)
which one does satisfy your condition of rock solid foundation? Or shall we
stick with php 4 + Apache 1.3.33, which is VERY unsatisfactory because we
cannot use the new object model?
The server is a production server, so we must have rock solid solutions on
it.
php5 + Apache 1.3.33 works just fine, have you tried that?  I would 
DEFINITELY wait until PHP 5.1 to put it into production though, there 
are a number of features being added, as well as the time spent testing 
and developing php 5 will help assure its stability as well.  If you 
have the possibility of setting up a test server on another port to test 
php5 with apache 1.3.33, this will be your safest bet to develop the 
software you will use without compromising the current setup.

You might also experiment with setting up Apache2 on another port, and 
then once you can be sure that your solution works in Apache and in 
Apache2, you have the ability to switch back to Apache in the blink of 
an eye just by modifying which port each process is listening to.  It 
would require maintaining parallel setups for a while, which is a real 
pain, but you would get the cutting-edge features you are looking for 
with a safety fallback, which your clients would be looking for.

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


[PHP] Re: Total Server Sessions

2005-01-03 Thread Rob Adams
HarryG [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Is there an easier way to count the total number of sessions running on a
 PHP webserver? something like session_count();

If you're using file based sessions, you could count the number of files in 
the directory where the sessions get saved.  If there are files in there 
other than just session files, you'll have to look for just the session 
files.  On all my systems, they've started with sess.

  -- Rob 

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



[PHP] Re: newbie.. $_GET $_POST

2005-01-03 Thread Greg Beaver
Pablo D Marotta wrote:
Hi there..
I need to pass variables to a page through an html link.
I do it like this:
A href=Extra/excelListing3.php?buildQuery=?php echo $buildQuery
?Export/A
where 'buildQuery' is the variable I´m passing.
In the destination page, I capture it with $_GET and that´s it.
I want to know if there is any way of doing it without showing the variables in
the direction bar.
Hi Pablo,
The method you are using to send the query is not a very secure method 
(depending on how you run it.)

Based on the source code shown, I imagine you have something like this 
code in excelListing3.php:

$buildQuery = $_GET['buildQuery'];
somedb_query($buildQuery);
What this means is that someone who knows your database structure can 
type this into their web browser:

http://www.yourhost.com/excelListing3.php?buildQuery=DROP+DATABASE+yourdb
and your program will happily execute it.
Far better is to parameterize your queries and limit the possible input. 
 By this I mean to define a few queries that can be executed, and give 
them numbers

A href=Extra/excelListing3.php?queryType=exportqueryVar1=?php echo 
$queryVar1 ?queryVar2=?php echo $queryVar2 ?Export/A

switch ($_GET['queryType']) {
case 'export' :
$query = 'SELECT * FROM yourdb WHERE queryVar1=' . 
mysql_escape_string($_GET['queryVar1']) . ' AND queryVar2=' . 
mysql_escape_string($_GET['queryVar2']) . '';
}

and so on.  I am assuming here that you are using mysql, but simply 
substitute the appropriate escaping function for another database.

Web security hinges on ensuring that your allowed input is finite and 
verifiable.

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


Re: [PHP] php vs java....

2005-01-03 Thread Brent Baisley
Perhaps in specific areas related to the web. But Java is so much more  
extensive than PHP, I doubt PHP will ever eclipse it.

On Jan 1, 2005, at 1:07 PM, Lewis LaCook wrote:
...just looking for opinions: will PHP eclipse (IS PHP
eclipsing) Java?
bliss
lewis lacook
=
*** 


Lewis LaCook --Poet-Programmer|||http://www.lewislacook.com/|||
Web Programmer|||http://www.corporatepa.com/|||
XanaxPop:Mobile Poem Blog- http://www.lewislacook.com/xanaxpop/
Collective Writing Projects-- The Wiki--  
http://www.lewislacook.com/wiki/ Appendix M  
-http://www.lewislacook.com/AppendixM/




__
Do you Yahoo!?
Send holiday email and support a worthy cause. Do good.
http://celebrity.mail.yahoo.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] migrating to PHP 5 + Apache 2 from PHP 4.3.8 + Apache 1.3.33.

2005-01-03 Thread Matthew Weier O'Phinney
* Symbulos Partners [EMAIL PROTECTED]:
 Rasmus Lerdorf wrote:
  
  As far as threading goes, it is simply not a good idea for a large
  complex system. 


 I do not understand why, probably because I am not well prepared. Can you
 explain me? As far as I know, threading should be a noticeable improvement
 in case of large systems. Is there something in the implementation of PHP 5
 which does not allow for safe threading? If so, what it is?

My understanding is that not all of the libraries to which PHP links
have been tested with threads -- it's not a PHP issue, per se, but one
of PHP extensions. If you know for a fact that the libraries with which
you plan to compile PHP *are* threadsafe -- e.g., MySQL --  you're
probably okay; if not, better to stick with Apache2's prefork model or
stay with Apache1.

  I am a big believer in keeping the base infrastructure as simple as
  possible.  You are going to layer a lot of complexity on top of Apache
  and PHP in the form of your web applications.  You want to make sure
  that your building blocks are rock solid so if you see a problem you can
  be confident that it is something you did wrong.  If your base is shaky
  everything you build on top of it is going to be that much more unstable.

 I totally agree. Our problem is that we want to use the new php 5 object
 model, and at the same time would like to move to Apache 2 for several
 different reasons.

 There are 4 alternative solutions

 0)php 5 + Apache 2
 1)php 5 + Apache 2 pre-fork (not totally satisfactory, but better than have
 a  system that is unstable)
 2)php 5 + Apache 1.3.33 (which is not totally satisfactory, less than 0,1 in
 any case, but better than have a system that is unstable)
 3)php 4 + Apache 2 (which is not totally satisfactory, less than 0,1,2 in
 any case, better than have a system that is unstable)

 which one does satisfy your condition of rock solid foundation? Or shall we
 stick with php 4 + Apache 1.3.33, which is VERY unsatisfactory because we
 cannot use the new object model?

I *have* seen errors with PHP4 and Apache2, and I doubt these would be
any different with PHP5. However, where I work, we're developing on an
Apache2 prefork with PHP5, and performance is solid.

I did recently see a benchmark of PHP with Apache1 vs PHP with Apache2,
however, and it showed that the former outperformed the latter by 27 -
31%:

http://ilia.ws/archives/32-Apache-1-vs-Apache-2-Performance.html

If performance is less critical than features, then Apache2 will work
fine. 

I guess the big question is: are the features for which you want Apache2
available with the prefork model or not? If not, there's no benefit to
going to Apache2 -- and it might make more sense to run multiple
servers -- some with Apache1 and PHP5 and others running Apache2 and
whatever other modules you need.

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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



Re: [PHP] migrating to PHP 5 + Apache 2 from PHP 4.3.8 + Apache 1.3.33.

2005-01-03 Thread symbulos partners
We would really give preference to the possibility of using PHP 5, in order
to use the new object model.

Is Apache 1 + php 5 rock stable? How are performances?

-- 
symbulos partners
-.-
symbulos - ethical services for your organisation
http://www.symbulos.com

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



Re: [PHP] migrating to PHP 5 + Apache 2 from PHP 4.3.8 + Apache 1.3.33.

2005-01-03 Thread Rasmus Lerdorf
symbulos partners wrote:
Rasmus Lerdorf wrote:
As far as threading goes, it is simply not a good idea for a large
complex system. 
I do not understand why, probably because I am not well prepared. Can you
explain me? As far as I know, threading should be a noticeable improvement
in case of large systems. Is there something in the implementation of PHP 5
which does not allow for safe threading? If so, what it is?
I thought I just explained that.  The problem is that the dozens of 
libraries you are likely to link into you Apache+PHP system may or may 
not be threadsafe.  It doesn't have much to do with PHP itself.  If you 
are 100% certain that every library you plan on linking in is 
threadsafe, then go for it.  And there is no difference between PHP4 and 
PHP5 when it comes to a threaded Apache2, so your matrix there doesn't 
make much sense.  Either use Apache1 or Apache2-prefork if you want to 
make sure you have a robust system.  Then choose the version of PHP you 
prefer after that.

For my production servers I use Apache1 and PHP4 currently with new 
development being done on Apache1-PHP5.  I don't have anything that 
needs any of the features from Apache2.

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


[PHP] Persistent PHP web application?

2005-01-03 Thread Josh Whiting
Dear list,

My web application (an online classifieds server) requires a set of
fairly large global arrays which contain vital information that most all
the page scripts rely upon for information such as the category list,
which fields belong to each category, and so on. Additionally, there are
a large number of function definitions (more than 13,000 lines of code
in all just for these global definitions).

These global arrays and functions never change between requests.
However, the PHP engine destroys and recreates them every time. After
having spent some serious time doing benchmarking (using Apache Bench),
I have found that this code takes at least 7ms to parse per request on
my dual Xeon 2.4ghz server (Zend Accelerator in use*). This seriously
cuts into my server's peak capacity, reducing it by more than half.

My question is: is there a way to define a global set of variables and
functions ONCE per Apache process, allowing each incoming hit to run a
handler function that runs within a persistent namespace? OR, is it
possible to create some form of shared variable and function namespace
that each script can tap?

AFAIK, mod_python, mod_perl, Java, etc. all allow you to create a
persistent, long-running application with hooks/handlers for individual
Apache requests. I'm surprised I haven't found a similar solution for
PHP.

In fact, according to my work in the past few days, if an application
has a large set of global functions and variable definitions, mod_python
FAR exceeds the performance of mod_php, even though Python code runs
significantly slower than PHP code (because in mod_python you can put
all these definitions in a module that is loaded only once per Apache
process).

The most promising prospect I've come across is FastCGI, which for Perl
and other languages, allows you to run a while loop that sits and
receives incoming requests (e.g. while(FCGI::accept() = 0) {..}).
However, the PHP/FastCGI modality seems to basically compare to mod_php:
every request still creates and destroys the entire application
(although the PHP interpreter itself does persist).

Essentially I want to go beyond a persistent PHP *interpreter* (mod_php,
PHP/FastCGI) and create a persistent PHP *application*... any
suggestions?

Thanks in advance for any help!
Regards,
J. Whiting

* - Please note that I am using the Zend Accelerator (on Redhat
Enterprise with Apache 1.3) to cache the intermediate compiled PHP code.
My benchmarks (7ms+) are after the dramatic speedup provided by the
accelerator. I wouldn't even bother benchmarking this without the
compiler cache, but it is clear that a compiler cache does not prevent
PHP from still having to run the (ableit precompiled) array and function
definition code itself.

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



Re: [PHP] unable to write a text file larger than 10Mb

2005-01-03 Thread Richard Lynch
At 10Mb, I'm guessing you could be hitting the Memory limit in php.ini

I have NO IDEA why anybody would try to cram all of a MySQL dump into RAM
before writing it to disk or sending it out to the browser, but that might
be what's happening.

That said -- show us your class and its source code.

It should not be that much code...


Sagar C Nannapaneni wrote:
 yes,,

 I'm sure that my script is not timing out...

 Also i set mysql connection timeout to max.

 /sagar
 - Original Message -
 From: Burhan Khalid [EMAIL PROTECTED]
 To: Sagar C Nannapaneni [EMAIL PROTECTED]
 Cc: php-general@lists.php.net
 Sent: Monday, January 03, 2005 3:37 PM
 Subject: Re: [PHP] unable to write a text file larger than 10Mb


 Sagar C Nannapaneni wrote:
  Hello All,
 
  This is very imp and urgent for me. I've a very large db on my remote
 website. I want to get a backup of that db. phpmyadmin is installed on the
 server..but if failed to create the backup (may b coz of the time outs).
 so
 i wrote my own class to get the backup. Its working fine except that PHP
 is
 not able to write a file larger than 10Mb. I've tried to export the data
 to
 Excel...The same problem repeated again. Is there any parameters to change
 in php to make it write larger files...???

 Are you sure your script isn't timing out?

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





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




-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Total Server Sessions

2005-01-03 Thread John Holmes
HarryG wrote:
Is there an easier way to count the total number of sessions running on a
PHP webserver? something like session_count();
I've seen some php site where it tells you how many people are currently
online, which I guess is being done by keeping a count of total sessions
running on the server
$num_sessions = count(glob(session_save_path() . '/sess_*'));
echo There are about {$num_sessions} active sessions.;
It will be fairly active so long as your garbage collection is triggered 
fairly often.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] newbie.. $_GET $_POST

2005-01-03 Thread Richard Lynch
Pablo D Marotta wrote:
 Hi there..
 I need to pass variables to a page through an html link.
 I do it like this:

 A href=Extra/excelListing3.php?buildQuery=?php echo $buildQuery
 ?Export/A

 where 'buildQuery' is the variable I´m passing.

 In the destination page, I capture it with $_GET and that´s it.

 I want to know if there is any way of doing it without showing the
 variables in
 the direction bar.

You could convert that to a POST quite easily:
FORM ACTION=Extra/excelListing3.php METHOD=POST
  INPUT TYPE=HIDDEN NAME=buildQuery VALUE=?php echo $buildQuery?
  INPUT TYPE=SUBMIT VALUE=Export
/FORM

NOTES:
This is only nominally more secure than the GET argument version.
Anybody with half a clue (okay a tenth of a clue) can use View Source in
their browser to see your query.

DEFINITELY follow Greg's advice and pass in *ONLY* the variables to your
query, and go even further and check what comes in to be sure it looks
like what you expect.  For example, if you expect an integer, type-cast
the value you get to an integer.  If it should be positive, check that it
*IS* positive.  If there are only a limited number of valid values for a
given input, make sure it fits.

Examples:
?php
  //A MySQL record id: (positive integer)
  $record_id = (int) isset($_POST['record_id']) ? $_POST['record_id'] : NULL;
  if (!$record_id || $record_id  1){
//Log the actual bogus input, so you can figure out what the
//bad guy is trying to do.  Or what mistake you made sending the data.
$invalid = @$_POST['record_id'];
trigger_error(Invalid record ID: $invalid, E_USER_ERROR);
  }

  //A limited selection from radio/select/checkbox:
  $colors = array('red', 'blue', 'green');
  $color = isset($_POST['color']) ? $_POST['color'} : NULL;
  if (!in_array($color, $colors)){
trigger_error(Invalid color: $color, E_USER_ERROR);
  }
?
For text chunks, use http://php.net/preg to filter out anything except
what's a kosher character in what you expect people to type.
Also use http://php.net/strlen to see if it's a reasonable length.

For uploaded files, use the file-system 'file' command to see if it looks
right  For images, a simple http://php.net/getimagesize will be easier
than that, and about as good, maybe even better.

You CANNOT trust the data coming into your site from a browser.

Sooner or later somebody will decide to mess with you.

Protect yourself.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Register Globals=ON

2005-01-03 Thread John Holmes
HarryG wrote:
Having register_globals=on and referring to variables as if($name){} or
using $_GET  $_POST statements like if(isset($_GET['name']))?
What is the main advantage/disadvantage in both cases.
Doesn't matter if it's on or off, really.
1) Don't trust any input from the user
2) Always initialize any variables you use
Follow those two rules and you can program secure programs that will not 
depend upon register globals.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] migrating to PHP 5 + Apache 2 from PHP 4.3.8 + Apache 1.3.33.

2005-01-03 Thread Matthew Weier O'Phinney
* Symbulos Partners [EMAIL PROTECTED]:
 We would really give preference to the possibility of using PHP 5, in order
 to use the new object model.

 Is Apache 1 + php 5 rock stable? How are performances?

I have no benchmarks, but PHP5 has showed itself to be at least as
stable as PHP4 on Apache1 in the installations I've used; YMMV. Since
most of the applications we develop where I work are relatively
short-lived (i.e., execute in small fractions of a second), we haven't
noticed any notable performance differences.

For what it's worth, this is the combo that most PHP developers (those
writing the language) who bother to mention it report using. (Rasmus
Lerdorf just said this is what he uses on this very list.)

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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



[PHP] Re: Persistent PHP web application?

2005-01-03 Thread Matthew Weier O'Phinney
* Josh Whiting [EMAIL PROTECTED]:
 My web application (an online classifieds server) requires a set of
 fairly large global arrays which contain vital information that most all
 the page scripts rely upon for information such as the category list,
 which fields belong to each category, and so on. Additionally, there are
 a large number of function definitions (more than 13,000 lines of code
 in all just for these global definitions).

 These global arrays and functions never change between requests.
 However, the PHP engine destroys and recreates them every time. After
 having spent some serious time doing benchmarking (using Apache Bench),
 I have found that this code takes at least 7ms to parse per request on
 my dual Xeon 2.4ghz server (Zend Accelerator in use*). This seriously
 cuts into my server's peak capacity, reducing it by more than half.

 My question is: is there a way to define a global set of variables and
 functions ONCE per Apache process, allowing each incoming hit to run a
 handler function that runs within a persistent namespace? OR, is it
 possible to create some form of shared variable and function namespace
 that each script can tap?

Run it as a SOAP server, and have the web requests communicate with the
SOAP server. That way you can keep the heavy-hitting stuff in memory,
but still maintain the flexibility of a traditional PHP web app.

PHP5 has native soap functions (http://php.net/soap), but you could also
use the PEAR SOAP libraries (http://pear.php.net/packages/soap).

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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



Re: [PHP] Register Globals=ON

2005-01-03 Thread Richard Lynch
HarryG wrote:
 Which process is better to use in PHP?

 Having register_globals=on and referring to variables as if($name){} or
 using $_GET  $_POST statements like if(isset($_GET['name']))?

 What is the main advantage/disadvantage in both cases.

The only advantage in register_globals = ON is a slight convenience factor
in using: $foo instead of $_GET['foo'].

The disadvantages include:
#1: Major security issue.  This is documented with a clear-cut example at:
http://us3.php.net/register_globals
Read this page, and re-read this page, and keep asking questions until you
COMPLETELY understand the issue.

#1a: It's possible that you're a PERFECT programmer and would never write
code like this...  But then you go installing that PHP forum, or database
abstraction class, or enhanced (cough, cough) email sending class or ...
and you have to rely on the OTHER guy being a perfect programmer...  Not
gonna happen, my friend.  Turn register_globals OFF

#2: Your code should be self-documenting in terms of WHERE the variables
come from.  $foo tells me nothing about where it came from. $_GET['foo']
tells me it came from the URL after the ? with a ?foo=xxx.  $_POST['foo']
tells me it came from a form with some kind of INPUT tag with NAME=foo
(or possibly NAME=foo[] or even NAME=foo[index] .  You can even use
$_REQUEST['foo'] to indicate that your script happily accepts either POST
or GET data.

#3: I've never seen it measured, but I suppose there is some
infinitesimally small performance advantage to register_globals = OFF,
since then PHP doesn't have to loop through and set all the values... 
This is a non-issue unless you are passing a *TON* of variables through
HTTP, which is probably a Bad Idea (tm) in the first place.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Total Server Sessions

2005-01-03 Thread Richard Lynch




Greg Donald wrote:
 On Mon, 3 Jan 2005 23:02:19 +1100, HarryG [EMAIL PROTECTED] wrote:
 Is there an easier way to count the total number of sessions running on
 a
 PHP webserver? something like session_count();

 I've seen some php site where it tells you how many people are currently
 online, which I guess is being done by keeping a count of total sessions
 running on the server

 It's a piece of cake if you use database driven PHP sessions.

 http://destiney.com/pub/Destiney_db_sessions_0.1.0.tar.bz2

 Once you get your PHP sessions running inside a database counting the
 sessions is just a select count(*) from sessions query.  You can even
 force garbage collection before the count to get a realtime count.

It would probably be more realistic to add some kind of 'where' clause
which counts only people active in the last N seconds/minutes, for MOST
sessions.

It all depends on your application's needs, of course, but most
applications probably have sessions that live a fairly long time for the
convenience of the user who walks away and comes back after not TOO long a
time, but that person can not realistically be reported as on-line if
you want an idea of how active the application is.

I've seen several chat applications where I got sucked in to using them
because there were people there -- only there really weren't any people
there, and it was dead, dead, dead.  Don't do that.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Total Server Sessions

2005-01-03 Thread Josh Whiting
 $num_sessions = count(glob(session_save_path() . '/sess_*'));
 echo There are about {$num_sessions} active sessions.;
 
 It will be fairly active so long as your garbage collection is triggered 
 fairly often.

it is worth noting that this doesn't work if you are using the recursive
directory structure method to store sessions, or any other session
storage method other than the default (in-memory sessions, database
sessions, etc).  and on a shared host, you may be counting the total
number of sessions for all the virtual hosts on the server. also, on a
shared host, it is usually up the sysadmins how PHP stores sessions, so
your mileage may vary.

/jw

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



Re: [PHP] handling large files w/readfile

2005-01-03 Thread Richard Lynch
Sebastian wrote:
 yea. all the files aren't 100MB though.. some are 2mb (even less) while
 some
 files are over 300MB as well.
 so, does this need to be adjusted depending on the filesize?

I believe that at a certain point, your setting there will be worse for
the system if you make it too big instead of too small, regardless of the
filesize to be written/read.

This is because no matter how big your file is, there are buffers all
along the chain of events between http://php.net/fread and the actual
electrical signals re-aligning the magnetic spots on your hard drive disc.

You're defining a buffer for fread.
PHP may have an internal buffer in a layer deeper than that (probably not,
but *could* have one)
The C library may have a buffer in the next layer down.  Again, probably
not, but it *could* have one.
The library inside the OS that the C library is calling maybe has a buffer.
The OS File System that the OS library calls probably has a buffer.
The physical hardware almost for sure has a buffer, probably several.
If you have fancy hardware and/or RAID software, then there are even more
buffers involved.

And, of course, the RAM available to PHP at the time of doing this work
will drastically affect performance -- If your server is loaded, and this
fread with your (possibly over-sized) buffer forces PHP and/or the OS to
swap something in/out to the hard drive, then you are going to KILL your
system.

At every step of the way, the data being buffered in a faster/cheaper
storage medium will have an effect on your performance.

Hopefully, for most uses, that is an overall Good effect.

But nobody on Earth can tell you for sure for sure that it's all optimum
for *YOUR* application's needs on *YOUR* hardware.

So given your OS, and your hard drive and your file system, and your
files, and the usual load on your server (RAM) there is some ideal
number for that collection of hardware/software that you use.

The only way to find your ideal number is to trial and error benchmark it.

I'd try numbers that match up with:
  the cache size on the hard drive
  any internal buffers in PHP's fread() functions
  any buffer in your File System and/or OS of choice
  very large numbers
  very small numbers
  a random assortment of nice numbers (1Mb 2Mb 4Mb ...)

Now, if your code has to run on LOTS of different hardware, you'd want to
benchmark on as many different sets of hardware as you can to find the
ideal number for *most* hardware.

Or, you could, I suppose, try to write a system that detects certain
specific categories of hardware/software and choose your buffer size based
on that.

Now, having said all that, the difference to the performance for MOST
applications is going to be negligible.  Find a number that works fast
enough for your application (with reasonable testing/benchmarking) and
move on with life.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Persistent PHP web application?

2005-01-03 Thread Richard Lynch
Josh Whiting wrote:
 My web application (an online classifieds server) requires a set of
 fairly large global arrays which contain vital information that most all
 the page scripts rely upon for information such as the category list,
 which fields belong to each category, and so on.

For this, you should look into:

Putting all this stuff in MySQL, but only getting the data you NEED right
now at any given time.  This will probably be slower, but it will give you
a good base-line benchmark, and prepare you for the next step.

Moving all that into LDAP. http://php.net/ldap/

However, given your programming philosophy so far, and the fact that you
are worried about 7ms and that you specifically requested some kind of
shared memory space in PHP, you should Read This:
http://us4.php.net/manual/en/ref.sem.php

That pretty much is exactly what you asked for.

Be forewarned that few PHP scripters have needed this stuff, and it's not
anywhere near as hammered on (read: debugged) as the other options above.

 Additionally, there are
 a large number of function definitions (more than 13,000 lines of code
 in all just for these global definitions).

You should look into breaking these up into groups of functionality -- I'm
willing to bet you could segment these and have many pages that only call
in a few functions.

 These global arrays and functions never change between requests.
 However, the PHP engine destroys and recreates them every time. After
 having spent some serious time doing benchmarking (using Apache Bench),
 I have found that this code takes at least 7ms to parse per request on
 my dual Xeon 2.4ghz server (Zend Accelerator in use*). This seriously
 cuts into my server's peak capacity, reducing it by more than half.

I'm not sure I'm right, but several things in this paragraph tweak my gut...

You're never going to get that 7ms to go to down *TOO* far if you insist
on loading all the data and all the functions for your entire site for
pages that don't really really need *ALL* of that...

 My question is: is there a way to define a global set of variables and
 functions ONCE per Apache process, allowing each incoming hit to run a
 handler function that runs within a persistent namespace? OR, is it
 possible to create some form of shared variable and function namespace
 that each script can tap?

Variables would be easy:
http://us4.php.net/manual/en/ref.sem.php

Functions, not so much...
Though I suppose if you created all of this as classes, and instantiated a
class and dumped a singleton into shared memory, you MIGHT trick PHP into
keeping all its class definitions and whatnot in RAM instead of loading
from the hard drive...

You could also patch Apache and get all your data into your Apache
$_SERVER space, or you could (I think) hack your Apache user's shell and
get all the data into their shell environment $_ENV.  Those would be a bit
more hack-y than using shared memory, but they technically fit what you
describe...

 PHP/FastCGI) and create a persistent PHP *application*... any
 suggestions?

This part here suggests an entirely different approach...

Depending on your application, you could also consider running a loop in
PHP which responds to requests on sockets.

http://us4.php.net/manual/en/ref.sockets.php

You could then define your own server protocol -- Kind of like making up
your own HTTP/FTP/RPC rules for your own specific application.

So if what your application mostly does is load in all this data and
respond to requests, you could write a *SINGLE* PHP application which
listened on port 12345 (or whatever port you like) and responded with the
data requested.  Like writing your own web-server, only it's a
_-server where you get to fill in the blank with whatever your
application does.

 * - Please note that I am using the Zend Accelerator (on Redhat
 Enterprise with Apache 1.3) to cache the intermediate compiled PHP code.
 My benchmarks (7ms+) are after the dramatic speedup provided by the
 accelerator. I wouldn't even bother benchmarking this without the
 compiler cache, but it is clear that a compiler cache does not prevent
 PHP from still having to run the (ableit precompiled) array and function
 definition code itself.

Actually, Zend and others could be interested in your comparisons of
with and without cache...

To Summarize:

The solution that most closely approximates what you think you want is
shared memory features in PHP.

The solution that might lead to a much better application would be to
segment the data and functions needed into smaller files, and only suck in
the ones you REALLY need.

An alternative solution that MIGHT fit what you think you want, if you
feel up to defining your own XYZ protocol, and if your only goal is to
provide the data/functions to respond to requests, is to write a single
PHP application that loads the data/functions once, and then sits there
listening on a socket to respond to requests.

Hope that helps...  Almost feel like I ought to 

[PHP] Re: Persistent PHP web application?

2005-01-03 Thread Manuel Lemos
Hello,
on 01/03/2005 02:28 PM Josh Whiting said the following:
* - Please note that I am using the Zend Accelerator (on Redhat
Enterprise with Apache 1.3) to cache the intermediate compiled PHP code.
My benchmarks (7ms+) are after the dramatic speedup provided by the
accelerator. I wouldn't even bother benchmarking this without the
compiler cache, but it is clear that a compiler cache does not prevent
PHP from still having to run the (ableit precompiled) array and function
definition code itself.
Why don't you just create a daemon started from the command line 
(shell/DOS) and have it accept socket connections from your Web server 
PHP scripts and provide a SOA (Services Oriented API) to the code that 
accesses your data structures pre-loaded in memory?

--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] function problem

2005-01-03 Thread Richard Lynch

 '$shippingCountry1'
  {
echo the insertiont cannot be done;

echo mysql_error();

http://php.net/mysql_error

exit();
  }
 header(Location:http://$HTTP_HOST/$DOCROOT/allright.html;);

DON'T DO THAT!!!

Just do:
include 'allright.html';

The Location header is for a document that has *MOVED* to a new URL.

Your document has not moved.

  exit();
 }

 When i try to insert -  the problem is in the insertion. The message
 the
 insertiont cannot be done; appears. Do you know what could be the
 mistake?

We don't know, but any time you get an error like that, the software that
caused that error will have more infomation available if you dig for it.
http://php.net/mysql_error
is just what you use for MySQL.

If it wasn't MySQL you were using, but something else in some other code,
there would still be some function to tell you what went wrong.

Get in the habit of not only checking for errors, but LOGGING them
somewhere and reviewing those logs.

You can use:
http://php.net/error_log to do like this:
error_log(__FILE__ . ': ' __LINE__  . ' ' . @mysql_error() .  $query );

Or you could even get serious and use http://php.net/error_handler with
http://php.net/trigger_error to catch and log all errors.

By default, your errors will be in the Apache error_log file (usually
/usr/local/apache/logs/error_log) but you can send them any place you
want.


-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] How to argue with ASP people...

2005-01-03 Thread Richard Lynch
You can spend a small fortune in ASP adding in COM objects (or writing
them) so it will eventually have maybe HALF the functionality of PHP.

http://php.net/



ASP's Object Oriented feature set is a joke.
All the object-ness is built into pre-packaged stuff from MS -- You
can't actually create a class.


ASP has no include function.  This makes life very very very difficult to
write decent code.


ASP database drivers are slower than PHP's, for those few databases that
ASP even supports.


$$$ -- ASP costs a *LOT* more than PHP, by the time you get done factoring
in *ALL* expenses.


-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Help with pack unpack functions

2005-01-03 Thread Scott E. Young
Hello All,

I am trying to write some PHP code that will act as a client to a
homegrown server interface developed in C. The client/server interfaces
exchange data using two C structures defined as:

/* struct for client requests to server */

struct client_request {
char stringA[20];
char stringB[17];
char stringC[10];
char stringD[7];
char stringE[200];
char stringF[12];
char stringG[11];
char stringH[50];
char stringI[11];
short  numA;
short  numB;
};

/* struct for server replies to client */

#define REPLY_MSG_SIZE 4000

struct reply_msg {
short numA;
short numB;
short numC;
short data_len;
char data[REPLY_MSG_SIZE + 1];
};

I am able to use pack() successfully to post a request message to the
server, but the unpack() function never seems to work on the reply
message struct that gets returned to the client.

Here's my example of the pack() function that works correctly:

$p = pack(a20a17a10a7a200a12a11a50a11ss, $strA, $strB, $strC,
   $strD, $strE, $strF,
   $strG, $strH, $strI,
   $numA, $numB);

$fp = fsockopen($host, $port);
if ($fp) {
$serv_stat = fgets($fp, 3);
}
if ($serv_stat == UP) {   // server connected and awaiting msg...
$nb = fwrite($fp, $p, strlen($p));
print(Wrote $nb bytes.\n);

$servResp = fread($fp, 3);
print([ . $servResp . ]\n);
}


Now once the server receives the request successfully (which it does),
it will reply back to the client using the second struct, and this is
where I begin having problems with unpack():

.
.
.
   do {
   if (false == ($buf = socket_read($msgsock, 2048,
PHP_BINARY_READ))) {
   echo socket_read() failed: reason:  . socket_strerror($ret)
. \n;
   break 2;
   }
   if (!$buf = trim($buf)) {
   continue;
   } else {
   printf(Read %d bytes.\n, strlen($buf));
   
   $format =
@0/sval0/@1/sval1/@2/sval2/@3/sval3/@4/sval4/@5/sval5/@6/C*;

   $respData = unpack($format, $buf);

   print_r($respData);
   }
   }
.
.
.

My first thought was that it had something to do with the endian-ess
between the client machine and the server system. But, I have tried just
about every possible combination of formatting codes, all to no avail.
The client is a Solaris SPARC platform and the server is running on a
mainframe (big endian).

What is strange is that I can always get the char data[] structure
member, and sometimes I get meaningful data in a few of the shorts, but
never all of the structure's members at the same time.

Any help is appreciated.

-- 
Scott E. Young
Area Mgr - NMA Software Solutions
[EMAIL PROTECTED]
(713) 567-8625

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



Re: [PHP] Persistent PHP web application?

2005-01-03 Thread Rasmus Lerdorf
Josh Whiting wrote:
Dear list,
My web application (an online classifieds server) requires a set of
fairly large global arrays which contain vital information that most all
the page scripts rely upon for information such as the category list,
which fields belong to each category, and so on. Additionally, there are
a large number of function definitions (more than 13,000 lines of code
in all just for these global definitions).
These global arrays and functions never change between requests.
However, the PHP engine destroys and recreates them every time. After
having spent some serious time doing benchmarking (using Apache Bench),
I have found that this code takes at least 7ms to parse per request on
my dual Xeon 2.4ghz server (Zend Accelerator in use*). This seriously
cuts into my server's peak capacity, reducing it by more than half.
My question is: is there a way to define a global set of variables and
functions ONCE per Apache process, allowing each incoming hit to run a
handler function that runs within a persistent namespace? OR, is it
possible to create some form of shared variable and function namespace
that each script can tap?
AFAIK, mod_python, mod_perl, Java, etc. all allow you to create a
persistent, long-running application with hooks/handlers for individual
Apache requests. I'm surprised I haven't found a similar solution for
PHP.
In fact, according to my work in the past few days, if an application
has a large set of global functions and variable definitions, mod_python
FAR exceeds the performance of mod_php, even though Python code runs
significantly slower than PHP code (because in mod_python you can put
all these definitions in a module that is loaded only once per Apache
process).
The most promising prospect I've come across is FastCGI, which for Perl
and other languages, allows you to run a while loop that sits and
receives incoming requests (e.g. while(FCGI::accept() = 0) {..}).
However, the PHP/FastCGI modality seems to basically compare to mod_php:
every request still creates and destroys the entire application
(although the PHP interpreter itself does persist).
Essentially I want to go beyond a persistent PHP *interpreter* (mod_php,
PHP/FastCGI) and create a persistent PHP *application*... any
suggestions?
PHP's model is to be completely sandboxed such that every request is 
completely separate from every other.  Having a persistent interpreter 
as you describe would break that rule and break the infinite horizontal 
scalability model of PHP.

Of course, there is nothing that prevents you from storing persistent 
data somewhere more permanent.  If it is just simple read-only data you 
have a lot of options.  For example, you could put them in a .ini file 
that is only loaded on Apache startup and use get_cfg_var() to fetch 
them.  If you compile PHP with the --with-config-file-scan-dir switch to 
configure a configuration scan directory you can just drop your own ini 
file in that directory and it will be read on startup.  This is just 
key=value pairs and not PHP code, of course.

If you need to do something fancier you can stick things in shared 
memory.  Many of the accelerators give you access to their shared memory 
segments.  For example, the CVS version of pecl/apc provides apc_store() 
and apc_fetch() which lets you store PHP datatypes in shared memory 
directly without needing to serialize/unserialize them.

And finally, the big hammer is to write your own PHP extension.  This is 
a lot easier than people think and for people who are really looking for 
performance this is the only way to go.  You can write whatever code you 
want in your MINIT hook which only gets called on server startup and in 
that hook you can create whatever persistent variables you need, pull 
stuff from a DB, etc.  At the same time you will likely want to pull 
some of your heavier business logic identified by your profiling into 
the extension as well.  This combination of C and PHP is extremely hard 
to beat performance-wise regardless of what you compare it to.

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


Re: [PHP] Re: Persistent PHP web application?

2005-01-03 Thread Rory Browne
I've only skimmed this(have to go soon), but it sounds like something
you could port the FastCGI dev library to PHP for(perhaps using SWIG).
Bare in mind that this is just from the top of my head, and is
probably irrational.


On Mon, 03 Jan 2005 16:21:35 -0200, Manuel Lemos [EMAIL PROTECTED] wrote:
 Hello,
 
 on 01/03/2005 02:28 PM Josh Whiting said the following:
  * - Please note that I am using the Zend Accelerator (on Redhat
  Enterprise with Apache 1.3) to cache the intermediate compiled PHP code.
  My benchmarks (7ms+) are after the dramatic speedup provided by the
  accelerator. I wouldn't even bother benchmarking this without the
  compiler cache, but it is clear that a compiler cache does not prevent
  PHP from still having to run the (ableit precompiled) array and function
  definition code itself.
 
 Why don't you just create a daemon started from the command line
 (shell/DOS) and have it accept socket connections from your Web server
 PHP scripts and provide a SOA (Services Oriented API) to the code that
 accesses your data structures pre-loaded in memory?
 
 --
 
 Regards,
 Manuel Lemos
 
 PHP Classes - Free ready to use OOP components written in PHP
 http://www.phpclasses.org/
 
 PHP Reviews - Reviews of PHP books and other products
 http://www.phpclasses.org/reviews/
 
 Metastorage - Data object relational mapping layer generator
 http://www.meta-language.net/metastorage.html
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



Re: [PHP] function problem

2005-01-03 Thread Matthew Weier O'Phinney
* Richard Lynch [EMAIL PROTECTED]:

  '$shippingCountry1'
   {
 echo the insertiont cannot be done;

 echo mysql_error();

 http://php.net/mysql_error

 exit();
   }
  header(Location:http://$HTTP_HOST/$DOCROOT/allright.html;);

 DON'T DO THAT!!!

 Just do:
 include 'allright.html';

 The Location header is for a document that has *MOVED* to a new URL.

 Your document has not moved.

Actually, untrue. From the W3C HTTP 1.1 specs:

The Location response-header field is used to redirect the recipient
to a location other than the Request-URI for completion of the
request or identification of a new resource.

Yes, one of its primary uses is for 3xx errors, and it is used in that
arena to indicate a change in a page's location. However, it can also be
used in 2xx responses to indicate a page dynamically created for the
request or simply to indicate that a 'pass-thru' was used in the
request.

It's a very common practice in web application programming -- not just
PHP, but the field in general -- after a successful form submission to
redirect to another page. Doing so can help prevent back-button issues
when forms need to be filled out in series -- for example, when you
don't want duplicate records created in the database.

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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



Re: [PHP] Re: function problem

2005-01-03 Thread Richard Lynch
If you were trying to use the result from mysql_pconnect() as the second
optional argument to mysql_query() in your function, be sure you declare
it 'global' inside the function.

Read PHP docs on variable scope if this is what tripped you up.

If not, I have no idea why the database is not selected, but you can now
focus on figuring out where/when it got selected, and where/when it got
un-selected, and there may even be a query you could send to ask MySQL
what database it thinks you are using.  Sprinkle a lot of those through
your code to find out where it changes from what you expect to not
working

Viktor Popov wrote:
 Hi,

 Thank you for your reply!

 I have changed the function like this:

 function doReg($fname1=,$family1=,$company1=, $MOL1=, $dannum1=,
 $bulstat1=, $phone1=, $email1=, $username1=, $password1=,
 $payment1=, $maillist1=, $Addr1=, $City1=, $zipcode1=,
 $Country1=, $shippingName1=, $shippingFamily1=, $shippingphone1=,
 $shippingAddr1=, $shippingcity1=, $shippingzipcode1=,
 $shippingCountry1=)
 {

   mysql_pconnect ($DB_SERVER, $DB_LOGIN, $DB_PASSWORD) or
 die(mysql_error());



  mysql_select_db($DB) or die(mysql_error());
   mysql_query( insert into users(name,family,company, MOL, taxnum,
 bulstat,
 phone, email, username, password, payment, maillist, Addr, City, zipcode,
 Country, shippingName, shippingFamily, shippingphone, shippingAddr,
 shippingcity, shippingzipcode, shippingCountry)
 values('$fname1','$family1','$company1', '$MOL1', '$dannum1', '$bulstat1',
 '$phone1', '$email1', '$username1', '$password1', '$payment1',
 '$maillist1',
 '$Addr1', '$City1', '$zipcode1',
 '$Country1','$shippingName1','$shippingFamily1',
 '$shippingphone1','$shippingAddr1', '$shippingcity1', '$shippingzipcode1',
 '$shippingCountry1')) or die (mysql_error());


 }

 I think that the problem is not in the insertion string because when write
 the function body :
  mysql_pconnect(.);
 mysql_select_db($DB) or die(mysql_error());
 mysql_query(insert into );

 instead doReg() in register.php, everything works. I have inserted some
 data
 in this way.
 The problem is that A DATABASE is  NOT SELECTED. This is the message when
 I
 use doReg().

 The register.php   is   in the DOCROOT-emagazine.  In the subdirectory
 script are common.inc  and  functions.php. In common.inc is this:

 ?php
  $DB_SERVER=localhost;
  $DB_LOGIN=admin;
  $DB_PASSWORD=**;
  $DB=emagazine;
  $HTTP_HOST=localhost:3000;
  $DOCROOT=emagazine;

 ?

 Is it all right? I think that $DB=emagazine  should work. Here I select
 the $DB, which name is emagazine.

 I don't understand what's going on:)



 Thank you!

 Viktor

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




-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Help with pack unpack functions

2005-01-03 Thread Richard Lynch
 What is strange is that I can always get the char data[] structure
 member, and sometimes I get meaningful data in a few of the shorts, but
 never all of the structure's members at the same time.

Do you consistently get the same problems on the FIRST record returned?

Anything after that is suspect, as you may be so far off-sequence that the
rest are meaningless.

What data do you actually get for the first record?

Also, call me crazy, but, like, aren't you THROWING AWAY most of your
buffer?...

Or, in this case, reading only HALF (roughly) of a record at a time.

You read 2048 bytes.
You trim it (probably a bad idea)...
You try to unpack all 2048 bytes as if it was a single record.
You ignore anything after that in the buffer, and loop to get 2048 more
bytes.

But each record you receive is supposedly:
short+short+short+short+REPLY_MSG_SIZE+1 bytes long.
2 + 2 + 2 + 2 + 4000 + 1
4009
bytes for a single record.

I think you want something more like this:

$socket_buffer = '';
$parse_buffer = '';
$format = @0/sval0/@1/sval1/@2/sval2/@3/sval3/@4/sval4/@5/sval5/@6/C*;
while ($socket_buffer = socket_read($msgsock, 2048, PHP_BINARY_READ)){
  if (false == $little_buffer){
//Your $ret was not defined...
echo Failed socket read , socket_strerror(socket_last_error($msgsock));
//If you are gonna keep going, clear the socket error.
socket_clear_error($msgsock);
break 2;
  }
  $parse_buffer .= $socket_buffer;
  $socket_buffer = '';
  //Now parse whatever we've got so far, leaving behind any partial record,
  //but only if we've got at least one full record to start with.
  while  (strlen($parse_buffer) = 4009)){
$record = unpack($format, $parse_buffer);
print_r($record);
$parse_buffer = substr($parse_buffer, 4009); //4010?
  }
}

The point being that you can't expect to get a full record when you only
read 2048 bytes at a time, and then you can't expect to find record
boundaries if you then parse only half of a record and move on to the
next record when you only got half a record, and then at that point
you're getting just under half of the first record, plus a little bit of
the second record...

Actually, since you know each record is exactly 4009 bytes long, you might
wanna change your buffer size from 2048 to 4009 (or 4010 if that's what
works) and simplify the code a lot.

Course, if they ever re-define #define REPLY_MSG_SIZE 4000 then you'll
have to adjust, so you probably should express everything in terms of your
own REPLY_MSG_SIZE as well, using a http://php.net/define and then writing
things like REPLY_MSG_SIZE + 8 or REPLY_MSG_SIZE + 8 + 1 for the places
where you need to add to get to the byte you want.

Hope all of that makes sense and is of some use...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] php vs java....

2005-01-03 Thread Richard Lynch
GH wrote:
 Can you please explain Threads to me?

Well, you start with some sheep... :-)


Real Answer:

[with gross simplifiations and outright lies to keep things easy]

Imagine that you have a program that wants to SEEM to be doing multiple
things at once.

For example, it wants to have a background window downloading and checking
email with a nice progress bar, while in the front window, you are reading
your email, deleting the junk, writing email, etc but *NOT* waiting for
the download to finish.

So, in essence, your program has two little separate programs running
inside of it, even though it's really really only one program.

Those two little programs are called threads

And once you can have two threads, there ain't nothing to stop you from
having three, four, or a hundred threads...  In theory.  You're going to
run out of system resources like RAM and stuff at some point.

Now, on the plus side, that makes it possible to do certain things that
were not feasible before.  Like having two things going on at once

On the downside, there is some overhead for each thread just to run.  And
really really only *ONE* thread can be truly running on the processor at
any given time.  Multiple CPUs increase the number of threads that can
run, at least in theory, but you can only run one thread at one time in
one processor.  So a Xeon Quad could have four truly simultaneous threads
going at one time, all from the same program.

The bigger downside is that writing good threads that don't step on each
others' toes is REALLY REALLY REALLY REALLY REALLY REALLY HARD.

They add huge major complexities to your code base, because EVERY line of
code in thread A has to worry about what it *MIGHT* do that *MIGHT* screw
up the code in thread B.

So, take the number of lines in your program, times the number of lines in
your program, and that's the number of potential flaws you have to watch
out for. :-)

Threads complicate the ability to scale your application by only throwing
more hardware at it (as Rasmus just said).

So hard, that many (all?) PHP Core Team Members don't think adding threads
is a Good Idea (tm) because the benefits are outweighed by the costs for
the target audience of PHP scripters.

Other languages have other features, and the language designers have made
informed (or not) desicions to add (or not) those features.

I personally don't think PHP *needs* threads, and it would complicate far
too many things if they were added -- certainly they shouldn't just be
on automatically so PHP scripters can start making threads willy-nilly!
That way lies madness.  You'd have a zillion BAD scripts out there using
threads in wildly inappropriate situations.

I suppose that a 'thread' extension could be added, at least in theory...

By all means, those of you who want such a feature are free to start
coding :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Using SSL

2005-01-03 Thread Richard Lynch
Daniel Lahey wrote:
 I need to implement secure transactions for a client, but I just can't
 figure out how to open a page with an https prefix.  The server has
 mod-ssl and OpenSSL compiled into it:

Ah, but did you muck around with the settings in your httpd.conf to turn
it *ON* and set up port 443 (the default) as the SSL port and...

If you've never ever edited your httpd.conf by hand, then maybe just
installing those packages will alter the file, but most likely you changed
it, and most likely the SSL software then assumed you'd rather change it
by hand rather than over-write your previous changes with the default
httpd.conf+SSL turned on. [*]

* I think the installers are more smart/complicated than this, but that's
what it boils down to in the end, even if they can sorta sometimes figure
out your httpd.conf and fix it to make SSL work.

PS Since you don't have plain old SSL working without .php, it really
*DID* belong on an Apache mailing list.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Help with pack unpack functions

2005-01-03 Thread Scott E. Young
First, let me say thanks for responding. My other responses are embedded
within your reply:

  What is strange is that I can always get the char data[] structure
  member, and sometimes I get meaningful data in a few of the shorts, but
  never all of the structure's members at the same time.
 
 Do you consistently get the same problems on the FIRST record returned?

Yes.

 
 Anything after that is suspect, as you may be so far off-sequence that the
 rest are meaningless.
 
 What data do you actually get for the first record?

Depends on what formatting I use with the unpack, but I've been able to
get one of the shorts to contain an expected value. I kept the
description short and didn't include the fact that most of the server
responses are much less than the 4K buffer size. But in all cases I seem
to get the char data that appears in the 4K buffer.

 
 Also, call me crazy, but, like, aren't you THROWING AWAY most of your
 buffer?...

Well, the code snippet is from a proof of concept. I could easily write
a C-lang client, call it from a PHP exec() call, etc, etc...  BUT, that
doesn't help us determine if we can use PHP for this purpose. So, at
this point I don't really care, but I see why you would question my
logic.

 
 Or, in this case, reading only HALF (roughly) of a record at a time.
 
 You read 2048 bytes.
 You trim it (probably a bad idea)...

This was robbed from a prior example on www.php.net, but I can remove it
to see if it helps.

 You try to unpack all 2048 bytes as if it was a single record.
 You ignore anything after that in the buffer, and loop to get 2048 more
 bytes.
 
 But each record you receive is supposedly:
 short+short+short+short+REPLY_MSG_SIZE+1 bytes long.
 2 + 2 + 2 + 2 + 4000 + 1
 4009
 bytes for a single record.
 
 I think you want something more like this:
 
 $socket_buffer = '';
 $parse_buffer = '';
 $format = @0/sval0/@1/sval1/@2/sval2/@3/sval3/@4/sval4/@5/sval5/@6/C*;
 while ($socket_buffer = socket_read($msgsock, 2048, PHP_BINARY_READ)){
   if (false == $little_buffer){
 //Your $ret was not defined...
 echo Failed socket read , socket_strerror(socket_last_error($msgsock));
 //If you are gonna keep going, clear the socket error.
 socket_clear_error($msgsock);
 break 2;
   }
   $parse_buffer .= $socket_buffer;
   $socket_buffer = '';
   //Now parse whatever we've got so far, leaving behind any partial record,
   //but only if we've got at least one full record to start with.
   while  (strlen($parse_buffer) = 4009)){
 $record = unpack($format, $parse_buffer);
 print_r($record);
 $parse_buffer = substr($parse_buffer, 4009); //4010?
   }
 }
 
 The point being that you can't expect to get a full record when you only
 read 2048 bytes at a time, and then you can't expect to find record
 boundaries if you then parse only half of a record and move on to the
 next record when you only got half a record, and then at that point
 you're getting just under half of the first record, plus a little bit of
 the second record...

Makes some sense, I just didn't see it to be a problem at this point,
but maybe it is... I also think that the server is NULL padding the
buffer up to the 4K limit after all of the text is stored in it. (I'll
have to check to validate my theory here).

 
 Actually, since you know each record is exactly 4009 bytes long, you might
 wanna change your buffer size from 2048 to 4009 (or 4010 if that's what
 works) and simplify the code a lot.
 
 Course, if they ever re-define #define REPLY_MSG_SIZE 4000 then you'll
 have to adjust, so you probably should express everything in terms of your
 own REPLY_MSG_SIZE as well, using a http://php.net/define and then writing
 things like REPLY_MSG_SIZE + 8 or REPLY_MSG_SIZE + 8 + 1 for the places
 where you need to add to get to the byte you want.

Always a good idea for production code...They in this case is ME
anyway! So I'll have no one to blame but myself should this ever occur.

 
 Hope all of that makes sense and is of some use...

Make sense, don't know if it'll help yet, but I'm fixin to try some of
your suggestions. Thanks again.

-- 
Scott E. Young
Area Mgr - NMA Software Solutions
[EMAIL PROTECTED]
(713) 567-8625

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



Re: [PHP] Total Server Sessions

2005-01-03 Thread HarryG
How do I have database driven php sessions. Any examples??

Greg Donald [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Mon, 3 Jan 2005 23:02:19 +1100, HarryG [EMAIL PROTECTED] wrote:
  Is there an easier way to count the total number of sessions running on
a
  PHP webserver? something like session_count();
 
  I've seen some php site where it tells you how many people are currently
  online, which I guess is being done by keeping a count of total sessions
  running on the server

 It's a piece of cake if you use database driven PHP sessions.

 http://destiney.com/pub/Destiney_db_sessions_0.1.0.tar.bz2

 Once you get your PHP sessions running inside a database counting the
 sessions is just a select count(*) from sessions query.  You can even
 force garbage collection before the count to get a realtime count.


 -- 
 Greg Donald
 Zend Certified Engineer
 http://destiney.com/

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



Re: [PHP] Total Server Sessions

2005-01-03 Thread Greg Donald
On Tue, 4 Jan 2005 10:40:51 +1100, HarryG [EMAIL PROTECTED] wrote:
 How do I have database driven php sessions. Any examples??

Hmm..  maybe you missed the url the first time, here it is again:

http://destiney.com/pub/Destiney_db_sessions_0.1.0.tar.bz2


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



Re: [PHP] How to argue with ASP people...

2005-01-03 Thread Leif Gregory
Hello Richard,

Monday, January 3, 2005, 11:27:05 AM, you wrote:
RL ASP has no include function. This makes life very very very
RL difficult to write decent code.

Not that I like ASP, and I'm not an ASP guru by any means, but this
statement is incorrect AFAICS. I use to do this all the time in ASP.

!-- #include virtual=includes/databaseconnect.asp --


Cheers,
Leif Gregory 

-- 
TB Lists Moderator (and fellow registered end-user)
PCWize Editor  /  ICQ 216395  /  PGP Key ID 0x7CD4926F
Web Site http://www.PCWize.com

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



[PHP] Forgive me

2005-01-03 Thread Wiberg
AFAICS

What does that mean? *feeling stupid*

/G
@varupiraten.se

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.296 / Virus Database: 265.6.7 - Release Date: 2004-12-30

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



Re: [PHP] Forgive me

2005-01-03 Thread John Nichel
Wiberg wrote:
AFAICS
What does that mean? *feeling stupid*
As Far As I Can See
--
By-Tor.com
...it's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] apache_child_terminate?

2005-01-03 Thread Robin Getz
I am trying to turn on apache_child_terminate with PHP V4.3.10 / Apache 2.0.52
According to: 
http://php.planetmirror.com/manual/en/function.apache-child-terminate.php

I should be able to turn this on with 'child_terminate' in php.ini
However, I do this, and when I do a phpinfo(); it returns a:
apache2handler with only three Directives:
- engine
- last_modified
- xbithack
When I look at others with apache 1.3, it lists, child_terminate.
Does this function only work with Apache 1.3?
Thanks
-Robin  

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


[PHP] multiple deleting and updating (addnew)

2005-01-03 Thread Sejati Opreker
Hi all,
I meet a problem when I want to deleting a multiple
row, I have a table that contain columns UserID, name,
company name, and bill. UserID is uniq.
perhaps, some of UserID, say it five UserID I have to
delete, how to delete all raw that contain that UserID
? and if I want to update bill of a users (multiple
user) that data of users taking from a file ( so the
file contain user UserId and bill), how to make it ?

Thanks,

Aji

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



[PHP] Always Include

2005-01-03 Thread The Disguised Jedi
I have a file that contains certain functions for proper function of
my website scripting pages, and they need to be callable all the time.
 I know that this can be done through an include() or require()
statement, but it would be easier if I could have it automatically
done.  Is there a way in Apache or PHP (this is going to both lists)
that this can be accomplished, or should I just stick with my
require() statements?

Thanks in advance . . .

-- 
The Disguised Jedi
[EMAIL PROTECTED]

PHP rocks!
Knowledge is Power.  Power Corrupts.  Go to school, become evil

Disclaimer: Any disclaimer attached to this message may be ignored.
This message is Certified Virus Free

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



Re: [PHP] multiple deleting and updating (addnew)

2005-01-03 Thread Tatang Widyanto
DELETE FROM TableName
WHERE UserID IN ('User1', 'User2', '', ..)
UPDATE TableName
SET fieldName='NewValue'
WHERE UserID IN ('User1', 'User2', '', ..)
Sejati Opreker wrote:
Hi all,
I meet a problem when I want to deleting a multiple
row, I have a table that contain columns UserID, name,
company name, and bill. UserID is uniq.
perhaps, some of UserID, say it five UserID I have to
delete, how to delete all raw that contain that UserID
? and if I want to update bill of a users (multiple
user) that data of users taking from a file ( so the
file contain user UserId and bill), how to make it ?
Thanks,
Aji
__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: [PHP] newbie.. $_GET $_POST

2005-01-03 Thread The Disguised Jedi
Yes, very true.  When dealing with externally provided data in your
script, always assume first that data is tainted, and make sure it
isn't before you try to do anything with it.  Follow Richard  Greg's
advice on checking your data.  You could also use some kind of
priveleged authentication thing, if the page you are using doesn't
have to be publicly accessible.  But, ALWAYS check data before sending
it to the DB.

On Mon, 3 Jan 2005 08:58:15 -0800 (PST), Richard Lynch [EMAIL PROTECTED] 
wrote:
 Pablo D Marotta wrote:
  Hi there..
  I need to pass variables to a page through an html link.
  I do it like this:
 
  A href=Extra/excelListing3.php?buildQuery=?php echo $buildQuery
  ?Export/A
 
  where 'buildQuery' is the variable I´m passing.
 
  In the destination page, I capture it with $_GET and that´s it.
 
  I want to know if there is any way of doing it without showing the
  variables in
  the direction bar.

 You could convert that to a POST quite easily:
 FORM ACTION=Extra/excelListing3.php METHOD=POST
   INPUT TYPE=HIDDEN NAME=buildQuery VALUE=?php echo $buildQuery?
   INPUT TYPE=SUBMIT VALUE=Export
 /FORM

 NOTES:
 This is only nominally more secure than the GET argument version.
 Anybody with half a clue (okay a tenth of a clue) can use View Source in
 their browser to see your query.

 DEFINITELY follow Greg's advice and pass in *ONLY* the variables to your
 query, and go even further and check what comes in to be sure it looks
 like what you expect.  For example, if you expect an integer, type-cast
 the value you get to an integer.  If it should be positive, check that it
 *IS* positive.  If there are only a limited number of valid values for a
 given input, make sure it fits.

 Examples:
 ?php
   //A MySQL record id: (positive integer)
   $record_id = (int) isset($_POST['record_id']) ? $_POST['record_id'] : NULL;
   if (!$record_id || $record_id  1){
 //Log the actual bogus input, so you can figure out what the
 //bad guy is trying to do.  Or what mistake you made sending the data.
 $invalid = @$_POST['record_id'];
 trigger_error(Invalid record ID: $invalid, E_USER_ERROR);
   }

   //A limited selection from radio/select/checkbox:
   $colors = array('red', 'blue', 'green');
   $color = isset($_POST['color']) ? $_POST['color'} : NULL;
   if (!in_array($color, $colors)){
 trigger_error(Invalid color: $color, E_USER_ERROR);
   }
 ?
 For text chunks, use http://php.net/preg to filter out anything except
 what's a kosher character in what you expect people to type.
 Also use http://php.net/strlen to see if it's a reasonable length.

 For uploaded files, use the file-system 'file' command to see if it looks
 right  For images, a simple http://php.net/getimagesize will be easier
 than that, and about as good, maybe even better.

 You CANNOT trust the data coming into your site from a browser.

 Sooner or later somebody will decide to mess with you.

 Protect yourself.

 --
 Like Music?
 http://l-i-e.com/artists.htm

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




--
The Disguised Jedi
[EMAIL PROTECTED]

PHP rocks!
Knowledge is Power.  Power Corrupts.  Go to school, become evil

Disclaimer: Any disclaimer attached to this message may be ignored.
This message is Certified Virus Free

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



Re: [PHP] Always Include

2005-01-03 Thread Jason Wong
On Tuesday 04 January 2005 10:56, The Disguised Jedi wrote:
 I have a file that contains certain functions for proper function of
 my website scripting pages, and they need to be callable all the time.
  I know that this can be done through an include() or require()
 statement, but it would be easier if I could have it automatically
 done.  Is there a way in Apache or PHP (this is going to both lists)
 that this can be accomplished, or should I just stick with my
 require() statements?

php.ini  auto_prepend_file

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP] Always Include

2005-01-03 Thread James Stewart
On Jan 3, 2005, at 9:56 PM, The Disguised Jedi wrote:
I have a file that contains certain functions for proper function of
my website scripting pages, and they need to be callable all the time.
 I know that this can be done through an include() or require()
statement, but it would be easier if I could have it automatically
done.  Is there a way in Apache or PHP (this is going to both lists)
that this can be accomplished, or should I just stick with my
require() statements?
If you  can use a .htaccess file, try putting this in there:
php_value auto_prepend_file /path/to/your/file
James.
--
James Stewart : Freelance Web Developer
Work : http://jystewart.net
Play : http://james.anthropiccollective.org
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Calculate No Of Days

2005-01-03 Thread Jerry Kita
Khuram Noman wrote:
Hi 

Is there any function avialable in PHP to calculate
the no of days by passing 2 dates like 1 argument is
1/1/2005 and the second one is 1/2/2005 then it
returns the no of days or how can i do that if there
is no builtin function .
Regards
Khuram Noman
__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
Here's a piece of code that I use on my website. It calculates the 
number of days from today to some future date (which happens to be July 
16, 2005) It's not exactly what you asked for but it might be helpful to 
you. No one will confuse me with being a professional programmer but 
this seems to work well on my site.

snippet 
$timeuntilcamp = mktime(12,0,0,7,16,2005,-1) - time();
$daysuntilcamp = round($timeuntilcamp/86400);
if ($daysuntilcamp  0)
  {
  print h4Days until start of 2005 Camp: .$daysuntilcamp./h4\n;
  }
 snippet
You can see it in action by visiting:
http://www.salkehatchiehuntersville.com/Salkehatchie_2005_Camp.php
--
Jerry Kita
http://www.salkehatchiehuntersville.com
email: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] apache_child_terminate?

2005-01-03 Thread Curt Zirzow
* Thus wrote Robin Getz:
 I am trying to turn on apache_child_terminate with PHP V4.3.10 / Apache 
 2.0.52
 
 According to: 
 http://php.planetmirror.com/manual/en/function.apache-child-terminate.php
 
 I should be able to turn this on with 'child_terminate' in php.ini
 
 However, I do this, and when I do a phpinfo(); it returns a:
 
 apache2handler with only three Directives:
 - engine
 - last_modified
 - xbithack
 
 When I look at others with apache 1.3, it lists, child_terminate.

Are you running apache in multithreaded per chance?

  http://php.net/manual/en/function.apache-child-terminate.php

Of course this begs the question why you want all php script's to
terminage apache, this will only provide extra cpu usage.


Curt
-- 
Quoth the Raven, Nevermore.

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



Re: [PHP] png.h not found, something's going wrong in my PHP installation

2005-01-03 Thread Curt Zirzow
* Thus wrote Aaron Paulley:
 I found a thread a couple of weeks ago where someone had to create
 symbolic links in order to get their install of PHP to work because
 PHP wasn't able to find png.h.

A reference to that thread could be helpfull.

 
 I am having the same problem. I made no changes to the installation of
 libpng, installed it in its default location and PHP cannot find
 png.h, no matter what I set the dir= flag to.
 
 Here is my ./configure:
 
 ./configure --with-mysql --with-apxs=/www/bin/apxs --with-xml
 --enable-ftp --with-gd --enable-magic-quotes --with-jpeg-dir=/usr
 --with-mcrypt --with-png-dir=/usr --enable-sockets --enable-track-vars
 --enable-versioning --with-zlib --enable-bcmath --enable-calendar
 --with-xpm-dir=/usr/X11R6 --enable-memory-limit
 
 png.h on my system is located in /usr/lib

png.h should *not* be located in /usr/lib it should be located in
/usr/include



Curt
-- 
Quoth the Raven, Nevermore.

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



[PHP] php5 webhosting

2005-01-03 Thread Greg Donald
Anyone found any good deals with webhosts supporting PHP5 yet?

Thanks,

-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



[PHP] Re: php5 webhosting

2005-01-03 Thread Greg Beaver
Greg Donald wrote:
Anyone found any good deals with webhosts supporting PHP5 yet?
it's not exactly for newbies, but bluga.net has been doing a fine job 
for me.

Greg
P.S. ZCE doesn't exactly imply newbie :) this is for others on the list
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PDFlib-Lite-6.0.1

2005-01-03 Thread 2wsxdr5
http://www.pdflib.com/products/pdflib/download/601src/PDFlib-Lite-6.0.1.tar.gzI 
am trying to install PDFlib-Lite-6.0.1  on my testing server.  So far no 
luck.  I am starting with php 4.3.3 and apache 2.0 on an SUSE 9.0 
machine.  Apache and php were installed with the OS.  I started by 
getting tiff-3.7.1.tar.gz and jpegsrc.v6b.tar.gz and those both 
installed with out a problem then I got PDFlib-Lite-6.0.1.tar.gz and 
that configured compiled fine then came the problems.  Here is the 
command and out put...

PIII500x2:~ # pear install pdflib
downloading pdflib-2.0.4.tgz ...
...done: 36,082 bytes
7 source files, building
running: phpize
Configuring for:
 PHP Api Version:   20020918
 Zend Module Api No:   20020429
 Zend Extension Api No:   20021010
`phpize' failed
Any ideas?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How to argue with ASP people...

2005-01-03 Thread M Saleh EG
Not to offend u or backup ASP but ur just wrong...

You said:
You
can't actually create a class.

That's not true! u might not be knowing the syntax of creating a class
in vb or js script. Sorry but this is the truth my friend.


On Mon, 3 Jan 2005 10:27:05 -0800 (PST), Richard Lynch [EMAIL PROTECTED] 
wrote:
 You can spend a small fortune in ASP adding in COM objects (or writing
 them) so it will eventually have maybe HALF the functionality of PHP.
 
 http://php.net/
 
 ASP's Object Oriented feature set is a joke.
 All the object-ness is built into pre-packaged stuff from MS -- You
 can't actually create a class.
 
 ASP has no include function.  This makes life very very very difficult to
 write decent code.
 
 ASP database drivers are slower than PHP's, for those few databases that
 ASP even supports.
 
 $$$ -- ASP costs a *LOT* more than PHP, by the time you get done factoring
 in *ALL* expenses.
 
 --
 Like Music?
 http://l-i-e.com/artists.htm
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
M.Saleh.E.G
97150-4779817

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



Re: [PHP] How to argue with ASP people...

2005-01-03 Thread Sagar C Nannapaneni
I'm a passionate freak of PHP from the past 4 years (that i can remember).
And i love everything that php can do. But just 2 days ago i came along a
situation where i have to write a hit counter for my website without using
a database or a text file. Just using a global variable i wanted to do this.

I dont know whether php can do this...(or may b i missed it out)...but i
couldnt
get any equivalent thing in php like we have GLOBAL.ASA in ASP.

/sagar
- Original Message -
From: M Saleh EG [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: John Sands [EMAIL PROTECTED]; php-general@lists.php.net
Sent: Tuesday, January 04, 2005 11:14 AM
Subject: Re: [PHP] How to argue with ASP people...


 Not to offend u or backup ASP but ur just wrong...

 You said:
 You
 can't actually create a class.

 That's not true! u might not be knowing the syntax of creating a class
 in vb or js script. Sorry but this is the truth my friend.


 On Mon, 3 Jan 2005 10:27:05 -0800 (PST), Richard Lynch [EMAIL PROTECTED]
wrote:
  You can spend a small fortune in ASP adding in COM objects (or writing
  them) so it will eventually have maybe HALF the functionality of PHP.
 
  http://php.net/
 
  ASP's Object Oriented feature set is a joke.
  All the object-ness is built into pre-packaged stuff from MS -- You
  can't actually create a class.
 
  ASP has no include function.  This makes life very very very difficult
to
  write decent code.
 
  ASP database drivers are slower than PHP's, for those few databases that
  ASP even supports.
 
  $$$ -- ASP costs a *LOT* more than PHP, by the time you get done
factoring
  in *ALL* expenses.
 
  --
  Like Music?
  http://l-i-e.com/artists.htm
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


 --
 M.Saleh.E.G
 97150-4779817

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




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