php-general Digest 28 Aug 2012 06:03:41 -0000 Issue 7940

2012-08-28 Thread php-general-digest-help

php-general Digest 28 Aug 2012 06:03:41 - Issue 7940

Topics (messages 318879 through 318897):

Re: syntax error breaking in and out of php into html code
318879 by: Tedd Sperling

get question
318880 by: Jack S
318881 by: Jim Giner
318882 by: Ashley Sheridan
318885 by: Jim Lucas
318892 by: Ashley Sheridan
318895 by: Jim Giner

Error connecting with DB
318883 by: Rod Lindgren
31 by: Rod Lindgren

include selectively or globally?
318884 by: Haluk Karamete
318889 by: Matijn Woudt
318896 by: Adam Richardson
318897 by: tamouse mailing lists

Re: What's the best way to make a dynamic plugin architecture?
318886 by: Mark
318890 by: Larry Garfield
318891 by: Matijn Woudt
318893 by: Larry Garfield

Cannot retrieve KRB5CCNAME if logged in with kerberos ticket
318887 by: Mauricio Tavares

Re: [modauthkerb] Cannot retrieve KRB5CCNAME if logged in with kerberos ticket
318894 by: Benjamin Kahn

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
On Aug 26, 2012, at 1:36 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote:
 Well, it turns out that I'm just an idiot...
 -- 
 Thanks,
 Ash

That was easy -- anyone of us could have told you that. :-)

Cheers,

tedd

PS: We all have our time in the barrel.

_
t...@sperling.com
http://sperling.com

---End Message---
---BeginMessage---
Hello All,

Trying to figure out why when I include the page that contains this
code, I'm not able to get the $calling_page populated with any values.
Any help appreciated...


?
# Dynamic Content based in page
$calling_page = $_GET['page'];

# Home Page 
--
if(!($calling_page)) {
$title = Title 1 - $calling_page;
$body = body /;

} elseif ($calling_page == index) {
$title = Title 2 - $calling_page;
$body = body /;

# Non Specified Page
--
} else {
$title = Title 3 - $calling_page;
$body = body /;

}

echo title.$title./title;
?


-- 
Thanks!
Joey
---End Message---
---BeginMessage---

On 8/27/2012 3:17 PM, Jack S wrote:

Hello All,

Trying to figure out why when I include the page that contains this
code, I'm not able to get the $calling_page populated with any values.
Any help appreciated...


?
# Dynamic Content based in page
$calling_page = $_GET['page'];

# Home Page 
--
if(!($calling_page)) {
 $title = Title 1 - $calling_page;
$body = body /;

} elseif ($calling_page == index) {
 $title = Title 2 - $calling_page;
$body = body /;

# Non Specified Page
--
} else {
 $title = Title 3 - $calling_page;
$body = body /;

}

echo title.$title./title;
?


Since this code does nothing other than assign a value to $calling_page 
based upon the content of a GET variable, what do you mean by not able 
to get the $calling_page populated with any values..


Are you simply saying that $calling_page does not have a value assigned 
to it?  And if that is what you meant to say, then the answer is that 
your GET array does not contain an index of 'page'.  Of course, even if 
that were true, you would in fact have a value in $calling_page and it 
would be simply: Title 1 - .


---End Message---
---BeginMessage---
On Mon, 2012-08-27 at 15:56 -0400, Jim Giner wrote:

 On 8/27/2012 3:17 PM, Jack S wrote:
  Hello All,
 
  Trying to figure out why when I include the page that contains this
  code, I'm not able to get the $calling_page populated with any values.
  Any help appreciated...
 
 
  ?
  # Dynamic Content based in page
  $calling_page = $_GET['page'];
 
  # Home Page 
  --
  if(!($calling_page)) {
   $title = Title 1 - $calling_page;
  $body = body /;
 
  } elseif ($calling_page == index) {
   $title = Title 2 - $calling_page;
  $body = body /;
 
  # Non Specified Page
  --
  } else {
   $title = Title 3 - 

php-general Digest 28 Aug 2012 19:07:12 -0000 Issue 7941

2012-08-28 Thread php-general-digest-help

php-general Digest 28 Aug 2012 19:07:12 - Issue 7941

Topics (messages 318898 through 318913):

Separate apc-caches for each fpm-pool
318898 by: Simon Schick

Re: [PHP-DEV] Separate apc-caches for each fpm-pool
318899 by: Simon Schick

Who is responsible for NFD or NFC formated UTF8 text? PHP, my application or 
the system-administrator?
318900 by: Simon Schick

Re: include selectively or globally?
318901 by: Matijn Woudt
318908 by: David Harkness
318911 by: Adam Richardson

Re: What's the best way to make a dynamic plugin architecture?
318902 by: Matijn Woudt

Re: [modauthkerb] Cannot retrieve KRB5CCNAME if logged in with kerberos ticket
318903 by: Mauricio Tavares
318912 by: Benjamin Kahn

FoxPro Table Structure
318904 by: Floyd Resler
318905 by: Paul M Foster
318906 by: Floyd Resler

PHP to XLS Security Alert issue
318907 by: admin

MSSQL Stored Proc
318909 by: Phillip Baker
318910 by: Andrew Ballard

Re: OT (maybe not): Drupal vs WordPress
318913 by: Larry Garfield

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
Hi, all

Not to get the bugfix https://bugs.php.net/bug.php?id=57825 too much
off-topic, I write this question in the mailinglist here:

Taking the case I have two fpm-pools on different sockets - the first
pool is responsible for www.example1.com and the second one for
www.example2.com.

If www.example1.com has 4 workers, they're all using the same
apc-cache. That's absolutely as expected. But also the workers of
www.example2.com are using this cache. In my opinion it would be nice
if the pools would have a separate cache.

I now found a solution for this: Just use more than one fpm-master
that is controlling the pools. (http://groups.drupal.org/node/198168)

Is this the way to go, or do you know of another way?
Should this be added to the APC- or fpm-documentation or is it enough
that you can find f.e. it using Google, if you need it?

Bye
Simon
---End Message---
---BeginMessage---
Sorry, I first posted it with the wrong subject ([PHP-DEV] instead of [PHP])
http://news.php.net/php.general/318898

On Mon, Aug 20, 2012 at 11:44 AM, Simon Schick simonsimc...@gmail.com wrote:
 Hi, all

 Not to get the bugfix https://bugs.php.net/bug.php?id=57825 too much
 off-topic, I write this question in the mailinglist here:

 Taking the case I have two fpm-pools on different sockets - the first
 pool is responsible for www.example1.com and the second one for
 www.example2.com.

 If www.example1.com has 4 workers, they're all using the same
 apc-cache. That's absolutely as expected. But also the workers of
 www.example2.com are using this cache. In my opinion it would be nice
 if the pools would have a separate cache.

 I now found a solution for this: Just use more than one fpm-master
 that is controlling the pools. (http://groups.drupal.org/node/198168)

 Is this the way to go, or do you know of another way?
 Should this be added to the APC- or fpm-documentation or is it enough
 that you can find f.e. it using Google, if you need it?

 Bye
 Simon
---End Message---
---BeginMessage---
Hi, all

Yesterday I ran into a big issue I didn't know about before:

There are many ways in UTF8 to save the same character. This applies
to all characters that can be combined of other characters. An example
for that is the German umlaut ö. In theory it can be saved simply as ö
or it can be saved as o followed by ¨.
I raised a question on stackoverflow on that and got tons of helpful
information.
http://stackoverflow.com/questions/12147410/different-utf-8-signature-for-same-diacritics-umlauts-2-binary-ways-to-write

If you don't know what NFD, NFC and those are, take the time and read
this article http://www.unicode.org/reports/tr15/ or at least take a
view at the figures 3-6.

As you read, I moved a page from a MacOSX Server to a Linux Server.
During this movement the filenames got converted from NFD to NFC.

Now my question is:
Is this a common issue?
What can I do to prevent it in the future?
Who's responsible of taking care of that?
I myself, Wordpress, the system I use, or I as the
system-administrator moving the website?

For example I don't know if Windows f.e. converts every filename to
NFC, but MacOSX (using HFS+) forces filenames to be NFD compliant.

Bye
Simon
---End Message---
---BeginMessage---
On Tue, Aug 28, 2012 at 3:49 AM, Adam Richardson simples...@gmail.com wrote:
 On Mon, Aug 27, 2012 at 6:54 PM, Matijn Woudt tijn...@gmail.com wrote:
 On Mon, Aug 27, 2012 at 10:56 PM, Haluk Karamete
 halukkaram...@gmail.com wrote:

 Now, the question is... should you use a global include 

Re: [PHP] include selectively or globally?

2012-08-28 Thread tamouse mailing lists
What do your performance measurements show so you have actual data
comparisons to make a valid decsion?

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



[PHP] Separate apc-caches for each fpm-pool

2012-08-28 Thread Simon Schick
Hi, all

Not to get the bugfix https://bugs.php.net/bug.php?id=57825 too much
off-topic, I write this question in the mailinglist here:

Taking the case I have two fpm-pools on different sockets - the first
pool is responsible for www.example1.com and the second one for
www.example2.com.

If www.example1.com has 4 workers, they're all using the same
apc-cache. That's absolutely as expected. But also the workers of
www.example2.com are using this cache. In my opinion it would be nice
if the pools would have a separate cache.

I now found a solution for this: Just use more than one fpm-master
that is controlling the pools. (http://groups.drupal.org/node/198168)

Is this the way to go, or do you know of another way?
Should this be added to the APC- or fpm-documentation or is it enough
that you can find f.e. it using Google, if you need it?

Bye
Simon

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



[PHP] Re: [PHP-DEV] Separate apc-caches for each fpm-pool

2012-08-28 Thread Simon Schick
Sorry, I first posted it with the wrong subject ([PHP-DEV] instead of [PHP])
http://news.php.net/php.general/318898

On Mon, Aug 20, 2012 at 11:44 AM, Simon Schick simonsimc...@gmail.com wrote:
 Hi, all

 Not to get the bugfix https://bugs.php.net/bug.php?id=57825 too much
 off-topic, I write this question in the mailinglist here:

 Taking the case I have two fpm-pools on different sockets - the first
 pool is responsible for www.example1.com and the second one for
 www.example2.com.

 If www.example1.com has 4 workers, they're all using the same
 apc-cache. That's absolutely as expected. But also the workers of
 www.example2.com are using this cache. In my opinion it would be nice
 if the pools would have a separate cache.

 I now found a solution for this: Just use more than one fpm-master
 that is controlling the pools. (http://groups.drupal.org/node/198168)

 Is this the way to go, or do you know of another way?
 Should this be added to the APC- or fpm-documentation or is it enough
 that you can find f.e. it using Google, if you need it?

 Bye
 Simon

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



[PHP] Who is responsible for NFD or NFC formated UTF8 text? PHP, my application or the system-administrator?

2012-08-28 Thread Simon Schick
Hi, all

Yesterday I ran into a big issue I didn't know about before:

There are many ways in UTF8 to save the same character. This applies
to all characters that can be combined of other characters. An example
for that is the German umlaut ö. In theory it can be saved simply as ö
or it can be saved as o followed by ¨.
I raised a question on stackoverflow on that and got tons of helpful
information.
http://stackoverflow.com/questions/12147410/different-utf-8-signature-for-same-diacritics-umlauts-2-binary-ways-to-write

If you don't know what NFD, NFC and those are, take the time and read
this article http://www.unicode.org/reports/tr15/ or at least take a
view at the figures 3-6.

As you read, I moved a page from a MacOSX Server to a Linux Server.
During this movement the filenames got converted from NFD to NFC.

Now my question is:
Is this a common issue?
What can I do to prevent it in the future?
Who's responsible of taking care of that?
I myself, Wordpress, the system I use, or I as the
system-administrator moving the website?

For example I don't know if Windows f.e. converts every filename to
NFC, but MacOSX (using HFS+) forces filenames to be NFD compliant.

Bye
Simon

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



Re: [PHP] include selectively or globally?

2012-08-28 Thread Matijn Woudt
On Tue, Aug 28, 2012 at 3:49 AM, Adam Richardson simples...@gmail.com wrote:
 On Mon, Aug 27, 2012 at 6:54 PM, Matijn Woudt tijn...@gmail.com wrote:
 On Mon, Aug 27, 2012 at 10:56 PM, Haluk Karamete
 halukkaram...@gmail.com wrote:

 Now, the question is... should you use a global include that points to
 this library - across the board - so that ALL the pages ( including
 the 90% that do not need the library ) will get it, or should you
 selectively add that include reference only on the pages you need?


 Since searching for files is one of the most expensive (in time)
 operations, you're probably best off with only a single PHP file.

 Maybe I misinterpreted the question, but I don't think I agree.

 If you have a 50K PHP file that's only needed in only 10% of the
 pages, then, when solely considering performance, that file should
 only be included on the 10% of the pages that actually use the file.
 Now, there are reasons where you might want to include the file
 globally (maintenance purposes, etc.) Loading the 50K of PHP code
 requires building up all of the associated infrastructure (zvals,
 etc.) for the user code (even if APC is used, the cached opcode/PHP
 bytecode still has to be parsed and built up for the user-defined
 classes and functions per request, even if they're unused), is
 certainly going to perform more slowly than selectively including the
 library on only the pages that need the library.

 Adam


First of all, I believe PHP is smart enough to not generate bytecode
for functions that are not used in the current file. Think about the
fact that you can write a function with errors, which will run fine
until you call the function. (except for syntax errors).

The speed difference between loading 5K file or 50K file (assuming
continuous blocks) is extremely small. If you split this library, you
would have PHP files that require you to load maybe 3 or 4 different
files to have all their functions. This would require 3 or 4 more file
searches, first the file needs to be located in the file table, then
on the disk. If you compare the required time for those operations,
they are enormous compared to time needed for a bigger file.
Just for the facts, if you're on a high end server drive (15000RPM
with 120MB/s throughput), you would have an average access time of
7ms. (rotational and seek time). Loading 5k with 120MB/s thereafter
only takes 0.04ms. 50k would take 0.4ms. That would save you 0.36ms if
a file only needs 1 include, if you need 2, that would cost you 6.68
ms. 3 would cost 13.72 ms, etc. With an 3.8GHz CPU, there are approx
4.000.000 clock cycles in 1ms, so in this case you would lose for only
loading 2 files instead of one, approx 27.250.000 clock cycles.. Think
about what PHP could do with all those clock cycles..

- Matijn

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



Re: [PHP] What's the best way to make a dynamic plugin architecture?

2012-08-28 Thread Matijn Woudt
On Tue, Aug 28, 2012 at 1:16 AM, Larry Garfield la...@garfieldtech.com wrote:
 On 8/27/12 6:11 PM, Matijn Woudt wrote:

 You should never be calling require() yourself.  Just follow the PSR-0
 naming standard and use an autoloader, then you don't have to even think
 about it.  There are many existing autoloaders you can use, including
 Composer's, Symfony2's, and probably Zend has one as well.


 I believe there's one in PHP by default now called SPLClassLoader or
 something like that..

 - Matijn


 There was a proposal for one, but it was never added.  You still need a
 user-space class loader for PSR-0, but they're readily available.


 --Larry Garfield


Ah thanks for the info. I heard about it way back and assumed it was
implemented by now ;)

- Matijn

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



[PHP] Re: [modauthkerb] Cannot retrieve KRB5CCNAME if logged in with kerberos ticket

2012-08-28 Thread Mauricio Tavares
On Mon, Aug 27, 2012 at 7:14 PM, Benjamin Kahn xk...@zoned.net wrote:
 Maybe you are hitting this bug?

 https://bugzilla.redhat.com/show_bug.cgi?id=687975
 mod_auth_kerb using krb5passwd and keepalive and credential delegation
 loses delegation after first request on connection

  Good question, because it sure looks rather similar.

 On Mon, 2012-08-27 at 17:29 -0400, Mauricio Tavares wrote:
 Quick-n-easy question: I have my apache virtual host configured to use
 kerberos authentication:

 Location /
 AuthType KerberosV5
 KrbAuthRealms DOMAIN.COM
 KrbServiceName HTTP
 Krb5Keytab /etc/apache2/krb5.keytab
 KrbMethodNegotiate on
 KrbMethodK5Passwd on
 KrbAuthoritative off
 KrbSaveCredentials on
 Require valid-user
 /Location

 And then I created the following test page:

 html
 head
 titlePHP Test/title
 /head
 body
 h1PHP Kerberos Test/h1
 ?php
 echo user = {$_SERVER['PHP_AUTH_USER']}br/;
 echo REMOTE_USER={$_SERVER['REMOTE_USER']}br/;
 putenv(KRB5CCNAME={$_SERVER['KRB5CCNAME']});
 echo KRB5CCNAME={$_SERVER['KRB5CCNAME']}br/;

 exit();
 ?
   /body
 /html

 And I have mod_auth_kerb php5 modules enabled in apache. When I try to
 connect to the above test page using a kerberos ticket, I do see the
 PHP_AUTH_USER and REMOTE_USER (which are the same). But I get nothing
 in KRB5CCNAME. Now, if I destory my kerberos ticket and login using
 kerberos user/pw, At first I do get the filename associated with
 KRB5CCNAME. But, if I wait less than 15s to refresh the page, I get
 nothing for KRB5CCNAME; if I wait more than 15s, I will get the
 filename for KRB5CCNAME.

 Does anyone know what I may be doing wrong?

 --
 Live Security Virtual Conference
 Exclusive live event will cover all the ways today's security and
 threat landscape has changed and how IT managers can respond. Discussions
 will include endpoint security, mobile security and the latest in malware
 threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
 ___
 modauthkerb-help mailing list
 modauthkerb-h...@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/modauthkerb-help



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



[PHP] FoxPro Table Structure

2012-08-28 Thread Floyd Resler
Is there a way in PHP to get the structure of a FoxPro table (using ODBC) 
without having to query the table?  I know I can get it by getting a row from 
the table and using odbc_field_type but I'd rather not have to query an entire 
table since there is no LIMIT command in FoxPro.  I've looked and looked and 
haven't found a solution.

Thanks!
Floyd


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



Re: [PHP] FoxPro Table Structure

2012-08-28 Thread Paul M Foster
On Tue, Aug 28, 2012 at 10:46:24AM -0400, Floyd Resler wrote:

 Is there a way in PHP to get the structure of a FoxPro table (using
 ODBC) without having to query the table?  I know I can get it by
 getting a row from the table and using odbc_field_type but I'd rather
 not have to query an entire table since there is no LIMIT command in
 FoxPro.  I've looked and looked and haven't found a solution.
 
 Thanks!  Floyd

FoxPro tables have a header which details the structure of the rows
which follow it. I've never written PHP code to do what you're asking,
but I did write a C program which will detail the header, dump the
records, output the table as SQL and a variety of other things,
depending on the command line switches. I generally use it *with* PHP,
using a system() call, capture the results, and then display them on
screen as needed. The code is on SourceForge. See:

http://noferblatz.com/dbfsak.php

If you download the code and need help, just let me know. I believe the
command line switch you're looking for is -i, as in:

dbfsak -i mytable.dbf

Paul

-- 
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com

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



Re: [PHP] FoxPro Table Structure

2012-08-28 Thread Floyd Resler
On Aug 28, 2012, at 11:32 AM, Paul M Foster pa...@quillandmouse.com wrote:

 On Tue, Aug 28, 2012 at 10:46:24AM -0400, Floyd Resler wrote:
 
 Is there a way in PHP to get the structure of a FoxPro table (using
 ODBC) without having to query the table?  I know I can get it by
 getting a row from the table and using odbc_field_type but I'd rather
 not have to query an entire table since there is no LIMIT command in
 FoxPro.  I've looked and looked and haven't found a solution.
 
 Thanks!  Floyd
 
 FoxPro tables have a header which details the structure of the rows
 which follow it. I've never written PHP code to do what you're asking,
 but I did write a C program which will detail the header, dump the
 records, output the table as SQL and a variety of other things,
 depending on the command line switches. I generally use it *with* PHP,
 using a system() call, capture the results, and then display them on
 screen as needed. The code is on SourceForge. See:
 
 http://noferblatz.com/dbfsak.php
 
 If you download the code and need help, just let me know. I believe the
 command line switch you're looking for is -i, as in:
 
 dbfsak -i mytable.dbf
 
 Paul
 
 -- 
 Paul M. Foster
 http://noferblatz.com
 http://quillandmouse.com

Paul,
Thanks for the info.  Unfortunately dbfsak won't work for me since I 
don't have direct access to the ForPro dbf files.  I access them through an 
odbc-odbc bridge server.

Thanks!
Floyd



[PHP] PHP to XLS Security Alert issue

2012-08-28 Thread admin
I am exporting to a XLS file and the file does export, but when I open the
file Microsoft is giving a Excel Security Notice.

I am sure there is something in the header that is missing or causing this
problem.

 

header(Pragma: public);

header(Expires: 0);

header(Cache-Control: must-revalidate, post-check=0, pre-check=0);

header(Content-Type: application/force-download);

header(Content-Type: application/octet-stream);

header(Content-Type: application/download);

header(Content-Disposition: attachment;filename=list.xls);

header(Content-Transfer-Encoding: binary );

 

I use pack() to write the labels, Numbers, data. If that could be the
culprit.

  echo pack(s, 0x203, 14, $Row, $Col, 0x0);

  echo pack(d, $Value);

 

I am running 5.2 on PHP and opening the document with 2010 Office on
Windows.

 

 

 



Re: [PHP] include selectively or globally?

2012-08-28 Thread David Harkness
On Tue, Aug 28, 2012 at 4:39 AM, Matijn Woudt tijn...@gmail.com wrote:

 First of all, I believe [A] PHP is smart enough to not generate bytecode
 for functions that are not used in the current file. Think about the
 fact that you can write a function with errors, which will run fine
 until you call the function. [B] (except for syntax errors).


 [B] negates [A]. PHP must either parse the file into opcodes or load them
from APC and further execute the top-level opcodes. That means defining
functions (not calling them unless called directly), constants, global
variables, classes, etc. No amount of measuring is required to tell me that
doing X vs. not doing X in this case clearly takes longer.

Now, is that time significant enough to warrant the extra logic required?
In my case, absolutely. We organize our library into many classes in
multiple files. By using an autoloader, we simply don't need to think about
it. Include bootstrap.php which sets up the autoloader and include paths.
Done.

In the case with a single 50k library file that is used on 10% of the
pages, I'd absolutely require_once it only in the pages that need it
without measuring the performance. It's so trivial to maintain that single
include in individual pages that the gain on 90% of the pages is not worth
delving deeper.

Peace,
David


[PHP] MSSQL Stored Proc

2012-08-28 Thread Phillip Baker
Greetings all,

I am having some trouble with running a stored proc on an MSSQL DB.
I am new to using MSSQL.



$link = mssql_connect($server, $db, $password);



if(!$link){

die('Error connecting to MSSQL database at '.$server);

} else {
$storedproc = SP_DialerValidLead;

$param = ValidLeadText;



$stmt = mssql_init($storedproc, $link)

or die(Unable to initialize);



mssql_bind($stmt, @.$param, $xmlstring, SQLTEXT, FALSE)

or die(Unable to bind
$param:$storedprocbr.mssql_get_last_message());



$result = mssql_execute($stmt);



var_dump($result);
mssql_close($link);

}


Apparently there is no data getting passed to the stored proc.

The $xmlstring is a valid xml string and the variable is properly set in
the code above.

Is there something obvious in how I am trying to call the stored proc with
the PHP code?
Any ideas or further questions?

Blessed Be

Phillip

In the Jim Crow South, for example, government failed and indeed refused
to protect blacks from extra-legal violence. Given our history, it's
stunning we fail to question those who would force upon us a total reliance
on the state for defense.
-- Robert J. Cottrol


Re: [PHP] MSSQL Stored Proc

2012-08-28 Thread Andrew Ballard
On Tue, Aug 28, 2012 at 1:03 PM, Phillip Baker phil...@freewolf.net wrote:
 Greetings all,

 I am having some trouble with running a stored proc on an MSSQL DB.
 I am new to using MSSQL.



 $link = mssql_connect($server, $db, $password);



 if(!$link){

 die('Error connecting to MSSQL database at '.$server);

 } else {
 $storedproc = SP_DialerValidLead;

 $param = ValidLeadText;



 $stmt = mssql_init($storedproc, $link)

 or die(Unable to initialize);



 mssql_bind($stmt, @.$param, $xmlstring, SQLTEXT, FALSE)

 or die(Unable to bind
 $param:$storedprocbr.mssql_get_last_message());



 $result = mssql_execute($stmt);



 var_dump($result);
 mssql_close($link);

 }


 Apparently there is no data getting passed to the stored proc.

 The $xmlstring is a valid xml string and the variable is properly set in
 the code above.

 Is there something obvious in how I am trying to call the stored proc with
 the PHP code?
 Any ideas or further questions?


I just skimmed your code, but the only thing that sticks out is your
call to mssql_connect(). The second parameter should be the username,
not the database. To select a specific database, you use
mssql_select_db() after mssql_connect() returns a valid resource.

However, if you have the choice, you really should switch to the SQL
Server driver for PHP developed by Microsoft. The mssql library has
been phased out.

Andrew

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



Re: [PHP] include selectively or globally?

2012-08-28 Thread Adam Richardson
On Tue, Aug 28, 2012 at 7:39 AM, Matijn Woudt tijn...@gmail.com wrote:
 On Tue, Aug 28, 2012 at 3:49 AM, Adam Richardson simples...@gmail.com wrote:
 On Mon, Aug 27, 2012 at 6:54 PM, Matijn Woudt tijn...@gmail.com wrote:
 On Mon, Aug 27, 2012 at 10:56 PM, Haluk Karamete
 halukkaram...@gmail.com wrote:

 First of all, I believe PHP is smart enough to not generate bytecode
 for functions that are not used in the current file. Think about the
 fact that you can write a function with errors, which will run fine
 until you call the function. (except for syntax errors).

I believe this is untrue. PHP generates the bytecode and then parses
the bytecode per request to generate the userland infrastructure,
including classes and functions, for the entire include file. During
the generation of bytecode, PHP doesn't know apriori which functions
will be called at runtime. I suspect if you asked for confirmation of
this on the internals list, they'd confirm this. In terms of errors,
there are certainly different stages that errors can occur, and what
you're referring to are runtime errors. Runtime errors don't
necessarily show up in every possible execution branch. That doesn't
mean that PHP didn't generate the code for the userland functionality.

 The speed difference between loading 5K file or 50K file (assuming
 continuous blocks) is extremely small. If you split this library, you
 would have PHP files that require you to load maybe 3 or 4 different
 files to have all their functions.

Here's where I believe we have a communication issue. I never spoke of
splitting up the library into 3 or 4, or any number of different
files. The opening post states that only 10% of the pages need the
library. I suggested that he only include the library in the 10% of
the pages that need the library. That said, it's possible I
misinterpreted him.

I will say that I do disagree with your analysis that difference
between loading a 5K or 50K php file is extremely small. So I just put
this to the test.

I created a 5K file and a 50K file, both of which have the form:

function hello1(){
echo hello again;
}

function hello2(){
echo hello again;
}

etc.

I have XDegub installed, have APC running, warmed the caches, and then
test a few times. There results all hover around the following:

Including the 5K requires around 50 microseconds. Including the 50K
requires around 180 microseconds. The point is that there is a
significant difference due to the work PHP has to do behind the
scenes, even when functions (or classes, etc. are unused.) And,
relevant to the dialog for this current thread, avoiding including an
unused 50K PHP on 90% of the pages (the pages that don't need the
library) will lead to a real difference.

Adam

-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com

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



[PHP] Re: [modauthkerb] Cannot retrieve KRB5CCNAME if logged in with kerberos ticket

2012-08-28 Thread Benjamin Kahn
On Tue, 2012-08-28 at 09:07 -0400, Mauricio Tavares wrote:
  https://bugzilla.redhat.com/show_bug.cgi?id=687975
  mod_auth_kerb using krb5passwd and keepalive and credential delegation
  loses delegation after first request on connection
 
   Good question, because it sure looks rather similar. 

Try the patch and see if it helps:
https://bugzilla.redhat.com/attachment.cgi?id=522350

Or try Fedora 17 or RHEL 6.3.


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



Re: [PHP] OT (maybe not): Drupal vs WordPress

2012-08-28 Thread Larry Garfield

Only semi-joking line that's been making the rounds lately:

If you want to build a blog, use Wordpress.
If you want to build Wordpress, use Drupal.
If you want to build Drupal, use Symfony2.

There is much wisdom in those lines.

--Larry Garfield, an openly biased Drupal core developer

On 8/19/12 2:52 PM, l...@afan.net wrote:

Hi to everyone,
I was trying to figure this out for the last week or two. I have read tons
of articles that compare Drupal and WordPress, but I still wasn't swayed
to either side.
I know that they are both good, both do the job well, and both have
advantages and disadvantages. For example, Drupal has a steeper learning
curve, but you get more control over the website.
Most of Drupal vs WordPress articles are emotionally driven and it
reminds me of the PC vs Apple flame war. I was trying to exclude these as
much as I could but it's hard.

Is there any website/article/benchmark/test/experiment/whatever I can
trust to be unbiased? I need a website that measures the CMS' through
facts, not heated, emotional arguments. In which cases is it better to use
Drupal over WordPress (and vice-versa)? I know the first two words are
going to be it depends, but let's talk about it in general (for small
basic websites, more complex websites, easy customization, etc).

I found this on one page: ... Drupal was built as a fine-grained
multi-role system where you can assign different permissions to different
roles to do different things (e.g. content editor, content reviewer,
member, etc.) and assign users to these roles... Does that mean that
WordPress can't do that? Maybe it can, and the quotation is true, but it
is kind of misleading to say that one of the programs does something, and
then not mention the other product at all.

Special points for me are (not a must, though)
- multiple websites with single core (both CMSs have the capability but I
got impression Drupal does it better?) because of maintenance
- compatibility with CiviCRM

Once I decide what to use, I have to stick with it for a while.

Thanks for any help.

LAMP




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



Re: [PHP] include selectively or globally?

2012-08-28 Thread Matijn Woudt
On Tue, Aug 28, 2012 at 6:55 PM, David Harkness
davi...@highgearmedia.com wrote:
 On Tue, Aug 28, 2012 at 4:39 AM, Matijn Woudt tijn...@gmail.com wrote:

 First of all, I believe [A] PHP is smart enough to not generate bytecode
 for functions that are not used in the current file. Think about the
 fact that you can write a function with errors, which will run fine
 until you call the function. [B] (except for syntax errors).


  [B] negates [A]. PHP must either parse the file into opcodes or load them
 from APC and further execute the top-level opcodes. That means defining
 functions (not calling them unless called directly), constants, global
 variables, classes, etc. No amount of measuring is required to tell me that
 doing X vs. not doing X in this case clearly takes longer.

[B] does not negate [A]. There's a difference between parsing the
syntax and defining functions, classes constants and globals, and
generating bytecode. In a 'normal' file I guess syntax definitions are
only about 5% of the total contents, the rest can be ignored until
being called.


 Now, is that time significant enough to warrant the extra logic required? In
 my case, absolutely. We organize our library into many classes in multiple
 files. By using an autoloader, we simply don't need to think about it.
 Include bootstrap.php which sets up the autoloader and include paths. Done.

 In the case with a single 50k library file that is used on 10% of the pages,
 I'd absolutely require_once it only in the pages that need it without
 measuring the performance. It's so trivial to maintain that single include
 in individual pages that the gain on 90% of the pages is not worth delving
 deeper.

 Peace,
 David


Let me quote the OP, I think that suffices:
When answering this question, please approach the matter strictly from
a caching/performance point of view, not from a convenience point of
view just to avoid that the discussion shifts to a programming style
and the do's and don'ts.

- Matijn

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



Re: [PHP] include selectively or globally?

2012-08-28 Thread Matijn Woudt
On Tue, Aug 28, 2012 at 7:18 PM, Adam Richardson simples...@gmail.com wrote:
 On Tue, Aug 28, 2012 at 7:39 AM, Matijn Woudt tijn...@gmail.com wrote:
 On Tue, Aug 28, 2012 at 3:49 AM, Adam Richardson simples...@gmail.com 
 wrote:
 On Mon, Aug 27, 2012 at 6:54 PM, Matijn Woudt tijn...@gmail.com wrote:
 On Mon, Aug 27, 2012 at 10:56 PM, Haluk Karamete
 halukkaram...@gmail.com wrote:

 First of all, I believe PHP is smart enough to not generate bytecode
 for functions that are not used in the current file. Think about the
 fact that you can write a function with errors, which will run fine
 until you call the function. (except for syntax errors).

 I believe this is untrue. PHP generates the bytecode and then parses
 the bytecode per request to generate the userland infrastructure,
 including classes and functions, for the entire include file. During
 the generation of bytecode, PHP doesn't know apriori which functions
 will be called at runtime. I suspect if you asked for confirmation of
 this on the internals list, they'd confirm this. In terms of errors,
 there are certainly different stages that errors can occur, and what
 you're referring to are runtime errors. Runtime errors don't
 necessarily show up in every possible execution branch. That doesn't
 mean that PHP didn't generate the code for the userland functionality.

 The speed difference between loading 5K file or 50K file (assuming
 continuous blocks) is extremely small. If you split this library, you
 would have PHP files that require you to load maybe 3 or 4 different
 files to have all their functions.

 Here's where I believe we have a communication issue. I never spoke of
 splitting up the library into 3 or 4, or any number of different
 files. The opening post states that only 10% of the pages need the
 library. I suggested that he only include the library in the 10% of
 the pages that need the library. That said, it's possible I
 misinterpreted him.

I interpreted it as: I have a 50K library, and some files only use
10%, some use 20% and some 30%. To be able to include it separately,
you would need to split and some would need to include maybe 3 or 4
files.


 I will say that I do disagree with your analysis that difference
 between loading a 5K or 50K php file is extremely small. So I just put
 this to the test.

 I created a 5K file and a 50K file, both of which have the form:

 function hello1(){
 echo hello again;
 }

 function hello2(){
 echo hello again;
 }

 etc.

 I have XDegub installed, have APC running, warmed the caches, and then
 test a few times. There results all hover around the following:

 Including the 5K requires around 50 microseconds. Including the 50K
 requires around 180 microseconds. The point is that there is a
 significant difference due to the work PHP has to do behind the
 scenes, even when functions (or classes, etc. are unused.) And,
 relevant to the dialog for this current thread, avoiding including an
 unused 50K PHP on 90% of the pages (the pages that don't need the
 library) will lead to a real difference.

 Adam

Finally, you're the first one that actually has measured something.
You should redo your test with real world files, because in real world
functions aren't that small.
In functions with more lines (say ~100 lines per function), you'll see
a different ratio between 5k and 50k. In my tests it is:
- 5K: 22ms
- 50K: 34 ms

When I create files that only contain 1 function, with just a number
of echo Hello world; lines until 5k or 50k, the results are:
- 5K: 15 ms
- 50K: 17 ms


Cheers,

Matijn

Ps. Code used:
?php

$time_start = microtime(true);

include '5k.php'; // 5k.php or 50k.php

$time_end = microtime(true);
echo ($time_end - $time_start).s;

?

System specs:
Ubuntu 12.04 LTS with Apache 2.2.22 and PHP 5.3.10 default config with
no cache etc.
AMD Phenom X4 9550 (2.2GHz)
4 GB DDR2-800
Disk where PHP files at: WD 500GB  with average read speed of 79.23
MB/s (as Measured with hdparm)

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



Re: [PHP] FoxPro Table Structure

2012-08-28 Thread Bastien


Bastien Koert

On 2012-08-28, at 11:52 AM, Floyd Resler fres...@adex-intl.com wrote:

 On Aug 28, 2012, at 11:32 AM, Paul M Foster pa...@quillandmouse.com wrote:
 
 On Tue, Aug 28, 2012 at 10:46:24AM -0400, Floyd Resler wrote:
 
 Is there a way in PHP to get the structure of a FoxPro table (using
 ODBC) without having to query the table?  I know I can get it by
 getting a row from the table and using odbc_field_type but I'd rather
 not have to query an entire table since there is no LIMIT command in
 FoxPro.  I've looked and looked and haven't found a solution.
 
 Thanks!  Floyd
 
 FoxPro tables have a header which details the structure of the rows
 which follow it. I've never written PHP code to do what you're asking,
 but I did write a C program which will detail the header, dump the
 records, output the table as SQL and a variety of other things,
 depending on the command line switches. I generally use it *with* PHP,
 using a system() call, capture the results, and then display them on
 screen as needed. The code is on SourceForge. See:
 
 http://noferblatz.com/dbfsak.php
 
 If you download the code and need help, just let me know. I believe the
 command line switch you're looking for is -i, as in:
 
 dbfsak -i mytable.dbf
 
 Paul
 
 -- 
 Paul M. Foster
 http://noferblatz.com
 http://quillandmouse.com
 
 Paul,
Thanks for the info.  Unfortunately dbfsak won't work for me since I don't 
 have direct access to the ForPro dbf files.  I access them through an 
 odbc-odbc bridge server.
 
 Thanks!
 Floyd


Could you do a query like
 

Select * from table where 1=2

That should only return the header row 

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



Re: [PHP] PHP to XLS Security Alert issue

2012-08-28 Thread Matijn Woudt
On Tue, Aug 28, 2012 at 5:56 PM, admin ad...@buskirkgraphics.com wrote:
 I am exporting to a XLS file and the file does export, but when I open the
 file Microsoft is giving a Excel Security Notice.

 I am sure there is something in the header that is missing or causing this
 problem.



 header(Pragma: public);

 header(Expires: 0);

 header(Cache-Control: must-revalidate, post-check=0, pre-check=0);

 header(Content-Type: application/force-download);

 header(Content-Type: application/octet-stream);

 header(Content-Type: application/download);

 header(Content-Disposition: attachment;filename=list.xls);

 header(Content-Transfer-Encoding: binary );



 I use pack() to write the labels, Numbers, data. If that could be the
 culprit.

   echo pack(s, 0x203, 14, $Row, $Col, 0x0);

   echo pack(d, $Value);

 I am running 5.2 on PHP and opening the document with 2010 Office on
 Windows.

I believe that's normal, and that it does that with any document
downloaded from the web.
I'm not sure if there's a workaround, but you should not ask that here
but on a Microsoft Office forum/list, or just ask the question to
Microsoft themselves.

- Matijn

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



Re: [PHP] include selectively or globally?

2012-08-28 Thread Adam Richardson
On Tue, Aug 28, 2012 at 3:28 PM, Matijn Woudt tijn...@gmail.com wrote:
 On Tue, Aug 28, 2012 at 7:18 PM, Adam Richardson simples...@gmail.com wrote:

 Finally, you're the first one that actually has measured something.
 You should redo your test with real world files, because in real world
 functions aren't that small.

In terms of redoing the test with real world files, that's an
entirely different debate (and one I won't enter into at this time,
though this list has discussed this topic before, most recently in a
post Ted made talking about screen height.)

The point is, there is a real difference. The question remains if the
difference is enough to act on in future code bases (and I would say
yes if my tests showed this difference, you may say no.)

 In functions with more lines (say ~100 lines per function), you'll see
 a different ratio between 5k and 50k. In my tests it is:
 - 5K: 22ms
 - 50K: 34 ms

Those trends/results depend significantly on the contents of the
functions, too. The overly simplistic example we've used both helps
and hurts the analysis (I'll admit my example likely has more
functions than other 5K/50K files, and I suspect most functions
require more complicated work behind the scenes to build up than echo
statements.)

The point I'd make here is that it's very difficult to have apriori
knowledge of how something will perform without testing it.

 When I create files that only contain 1 function, with just a number
 of echo Hello world; lines until 5k or 50k, the results are:
 - 5K: 15 ms
 - 50K: 17 ms

Ummm... sure. What did you say about real world before :)

Have a nice day!

Adam

-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com

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



Re: [PHP] OT (maybe not): Drupal vs WordPress

2012-08-28 Thread Larry Garfield

On 8/20/12 3:36 AM, Simon Schick wrote:


One thing I also really like at the TYPO3-philolsophy: If someone
finds a security-issue he should immediately get in contact with the
developers (of the extension and the TYPO3 security team) and discuss
the issue with them. They decide how critical the bug is and will do a
hard work to get the fix as soon as possible. If it is a very critical
issue (someone could gain admin-access by something) they will send
out an email that there will be a bugfix coming out at next-coming day
at 9 o'clock GMT and everyone is advised to update his TYPO3-core or
the extension. This is something I really like! To be prepared for
some critical fix and knowing that (in a perfect case) no-one should
have heard about that issue before who wants to hack my website :)

Don't know if there's some similar security-policy in other
communities than this :)


Drupal's security process is substantially similar, and also follows 
security best practices:


http://drupal.org/security-team

--Larry Garfield

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



Re: [PHP] OT (maybe not): Drupal vs WordPress

2012-08-28 Thread Adam Richardson
On Tue, Aug 28, 2012 at 3:07 PM, Larry Garfield la...@garfieldtech.com wrote:
 Only semi-joking line that's been making the rounds lately:

 If you want to build a blog, use Wordpress.
 If you want to build Wordpress, use Drupal.
 If you want to build Drupal, use Symfony2.

Here's another semi-joking line :)

If build a blog using Wordpress, build Wordpress using Drupal, build a
Drupal using Symfony2, I'd feel the same way I feel after drinking
several beers, eating a pizza, snacking on some hot wings, and
polishing it all off with a banana split: bloated :)

Adam

-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com

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



Re: [PHP] include selectively or globally?

2012-08-28 Thread David Harkness
On Tue, Aug 28, 2012 at 12:11 PM, Matijn Woudt tijn...@gmail.com wrote:

 On Tue, Aug 28, 2012 at 6:55 PM, David Harkness
 davi...@highgearmedia.com wrote:
  On Tue, Aug 28, 2012 at 4:39 AM, Matijn Woudt tijn...@gmail.com wrote:
 
  First of all, I believe [A] PHP is smart enough to not generate bytecode
  for functions that are not used in the current file. Think about the
  fact that you can write a function with errors, which will run fine
  until you call the function. [B] (except for syntax errors).
 
   [B] negates [A]. PHP must either parse the file into opcodes or load
 them
  from APC and further execute the top-level opcodes. That means defining
  functions (not calling them unless called directly), constants, global
  variables, classes, etc.

 [B] does not negate [A]. There's a difference between parsing the
 syntax and defining functions, classes constants and globals, and
 generating bytecode. In a 'normal' file I guess syntax definitions are
 only about 5% of the total contents, the rest can be ignored until
 being called.


I won't claim a deep understanding of the PHP internals, but I have enough
experience with varied compiled and interpreted languages and using PHP and
APC that I'm confident that the process to include a file involves:

1. Load the opcodes
A. Either read the file from disk and parse the PHP into opcodes, or
B. Load the cached opcodes from APC.
2. Execute the top-level opcodes

Any syntax errors--even those in unreachable code blocks--will cause the
script to fail parsing. For example,

if (false) {
function foo() {
SYNTAX ERROR!
}
}

will cause the parse to fail even though the function cannot logically be
defined. PHP doesn't even get that far.

PHP Parse error:  syntax error, unexpected T_STRING in php shell code
on line 3


 When answering this question, please approach the matter strictly from
 a caching/performance point of view, not from a convenience point of
 view just to avoid that the discussion shifts to a programming style
 and the do's and don'ts.


While out of convenience you might be tempted to include the file in every
script, when considering performance alone you should include the file only
in those scripts that will make use of its contents.

Peace,
David