Re: [PHP] safe mode

2005-07-28 Thread Bostjan Skufca @ domenca.com
  -Original Message-
  From: Kim Madsen [mailto:[EMAIL PROTECTED]
  Sent: Thursday, July 28, 2005 12:01 PM
 
  I would *never* host anything on a server with safe_mode on!

What are your reasons for this decision?


regards,
Bostjan

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



Re: [PHP] php + cvs

2005-05-31 Thread Bostjan Skufca @ domenca.com
Hello,

is it possible to mount CVS/SVN repository as filesystem?


regards,
Bostjan

On Tuesday 31 May 2005 15:46, M. Sokolewicz wrote:
 Marcus Bointon wrote:
  On 31 May 2005, at 09:58, Jochem Maas wrote:
  Also I hear lots of good things about subversion (SVN), which is a
  newer alternative for version control - some even say its better.
 
  I can definitely vouch for Subversion. I'm using it for all my PHP
  stuff. I'd not used cvs a great deal, but I'd always found it awkward
  and svn is certainly easier.
 
  The home page is here: http://subversion.tigris.org/ The  documentation
  (an online O'Reilly book) is excellent. It's pretty  easy to learn
  (shares most basic commands with cvs), and there are  many helper apps
  to work with it, not least TortoiseSVN which looks  and works just like
  TortoiseCVS. I'm on OSX with OpenBSD and Linux  servers and it's been
  easy to get it working over HTTPS. There are  some OSX clients (notably
  svnx), but I find that once you figure out  the commands, the command
  line interface is very easy to work with.
 
  Consensus seems to be that if you're just starting out in version
  control, go straight to svn so you can skip all the reasons that made
  them want an upgrade from cvs!
 
  Marcus

 another CVS/SVN helper-application is smartSVN (or smartCVS for CVS):
 http://www.smartsvn.com/ (http://www.smartcvs.com/ for CVS). Those
 applications are really nice, personally I find that they are far easier
 to handle than tortoiseCVS(/SVN)

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



Re: [PHP] mysql + addslashes + stripslashes

2005-05-16 Thread Bostjan Skufca @ domenca.com
I do the following way to achieve portability:

For GET/POST/COOKIE variables:
1. check magic_quotes_gpc PHP setting - if enabled strip slashes from input 
variables using stripslashes()
2. check input/anything
3. prior building SQL query escape stuff (mysql - mysql_real_escape_string(), 
others use different escaping methods)
4. run query

For data that comes from SQL sources:
1. check magic_quotes_runtime PHP setting...


On Monday 16 May 2005 10:32, Petzo wrote:
 Hi,

 My question is about the norlmal behaviour of PHP and MYSQL but I cant
 explain it without a simple example. Thank you for reading:

 I have the following code:
 
 ?php
 print $t = $_POST['txt'];
 print $t = addslashes($t);

@ $db = mysql_pconnect(xxx,xxx,xxx);
mysql_select_db('test');

$q = update ttable set ffield='$t';
mysql_query($q);

$q = select * from ttable;
$result = mysql_query($q);
$bo = mysql_fetch_array($result);

 print $t = $bo['ffield'];
 print $t = stripslashes($t);
 ?
 


 from a HTML form I send variable:
 
 ' \ \' \\ \\\
 

 after addshashes it becomes:
 
 \' \\ \\\'  \\
 

 after that it gets in the database

 but after I get it out it becomes:
 
 ' \ \' \\ \\\
 
 (without the backslashes!)

 and ofcourse after stripslashes it gets messed-up:
 
 ' ' \ \
 

 So my question is if this is a normal behaviour for PHP+MYSQL or it may
 vary indifferent conficurations or versions of both php or mysql.
 It's not a bad thing to be like that but I wonder if my code will behave
 the same at most systems.

 Thank you very much

-- 
Best regards,

Bostjan Skufca
system administrator

Domenca d.o.o. 
Phone: +386 4 5835444
Fax: +386 4 5831999
http://www.domenca.com

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



Re: [PHP] MySql injections....

2005-05-11 Thread Bostjan Skufca @ domenca.com
Probably you mean about prevening mysql injections - or not? :)

Bostjan



On Wednesday 11 May 2005 11:38, [EMAIL PROTECTED] wrote:
 Hi,
 This is not the proper list to put this question but i hope you can help
 me. Does anyone know a good tutorial about mysql injections?

 Thanks a lot for your help

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



Re: [PHP] MySql injections....

2005-05-11 Thread Bostjan Skufca @ domenca.com
it depends

by having register_globals set to on (server config) it is usually easier to 
create 
sql-injection exploit, but it is not required. What is true is that well 
written script 
will defend/sustain such attacks regardles how server is configured 
(unless configuration is really f*cked up).

Prevention is simply trying to follow few simple rules:

1. SQL statemens that have no PHP variables are NOT vulnerable:
$sql = 'SELECT value FROM values WHERE key = 123';
$db-query($sql);
(nothing vulnerable here)



2. If you do not check what you are putting into SQL statements via 
PHP variables - add slashes and put it in quotes:
($key = 123;) - you get this from some kind of form or URI

$key_as = addslashes($key); // you should check if slashes were already added 
by php (magic_quotes)
$sql = SELECT value FROM values WHERE key = '$key';
$db-query($sql);



3. If you do not put your variable into quotes - check it!
if (!preg_match('/^[0-9]+/', $key)) {
echo Hack attempt!; exit;
}
$sql = SELECT value FROM values WHERE key = $key;
$db-query($sql);

(if you will not check it anything can get into your sql statement)


4. All the above assumes you have already assessed potential remote file 
inclusion vulnerabilities.


Regards,
Bostjan



On Wednesday 11 May 2005 14:15, [EMAIL PROTECTED] wrote:
 I have a site and the other days i received a message from a guy that told
 me my site is vulnerable to mysql injections. I do not know how can i
 prevent this. The server is not configured or it's all about the script?


 - Original Message -
 From: Bostjan Skufca @ domenca.com [EMAIL PROTECTED]
 To: php-general@lists.php.net
 Sent: Wednesday, May 11, 2005 1:50 PM
 Subject: Re: [PHP] MySql injections

  Probably you mean about prevening mysql injections - or not? :)
 
  Bostjan
 
  On Wednesday 11 May 2005 11:38, [EMAIL PROTECTED] wrote:
  Hi,
  This is not the proper list to put this question but i hope you can help
  me. Does anyone know a good tutorial about mysql injections?
 
  Thanks a lot for your help
 
  --
  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] Skipping function arguments!

2005-04-28 Thread Bostjan Skufca @ domenca.com
function add ($a=1, $b=2, $c=3) {
 return $a + $b + $c;
}
add(1, null, 1);

will do just fine

r.,
Bostjan



On Thursday 28 April 2005 14:16, Marek Kilimajer wrote:
 Vedanta Barooah wrote:
  Hello All,
  Cosider this :
 
  function add($a=1,$b=2,$c=3){
  return $a + $b + $c;
  }
 
  how do i skip the second argument while calling the function, is there
  a process like this:
 
  echo add(1,,1); # where i expect 2 to be printed,

 php does not support this. you can workaround this using:

 function add($a = null,$b = null, $c = null){
   if(is_null($a)) $a = 1;
   if(is_null($b)) $b = 2;
   if(is_null($c)) $c = 3;
  return $a + $b + $c;
 }

 add(1, null, 1);

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



Re: [PHP] slow session_start()

2005-04-07 Thread Bostjan Skufca @ domenca.com
If you trace (strace on linux) the process which serves your request you 
should get some idea.



On Thursday 07 April 2005 20:23, Arshavir Grigorian wrote:
 Hi,

 I am getting 4-5 minute delays when I call the session_start() function
 in one of my scripts, I reduced it to a small script that just echoes
 some html, but still calling session_start() causes a major delay. My
 /tmp directory is almost empty and there is a lot of disk space. It's an
 AMD Athlon(TM) XP 3000+ with a Gig of RAM. Anyone knows what could cause
 this?

 ?php

 session_start();

 echo html\n;
 echo body\n;
 echo h3we are here/h3\n;
 echo /body\n;
 echo /html\n;

 ?

 I am using the PHP (4.3.2) shipped with RHEL. Does RH backport fixes
 from the newer versions of PHP to their packages? Can this be the cause
 of the slowdowns I am experiencing when calling session_start()?
 Yesterday, when I was setting this site up, everything was working
 great, today it's dog slow.

 Thanks for any pointers.



 Arshavir

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



Re: [PHP] php 4 php 5

2005-03-17 Thread Bostjan Skufca @ domenca.com
Abandon all your hopes, this will not work (unless you do some heavy 
programming/patching) because modules interfere with each other. I've been 
trying this for a week without success.

Still the best/easiest approach is to set up ordinary apache/PHP4 server 
combination with proxy support compiled in, then configure it to forward 
all .php5 requests to another apache/PHP5 server (listening i.e. internally 
on 127.0.0.1:81)

PHP3/PHP4 was a diffferent situation, do not compare it to this one.


Bostjan




On Wednesday 16 March 2005 13:45, Kim Madsen wrote:
 -Original Message-
 From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, March 15, 2005 4:05 AM

   That's why I'd like to stick with apache2 + php5 default and
   apache2+php4 just for a single site hosted (the one that uses imp).
 
  See my previous message describing the ProxyPass approach.  It is by far
  the easiest way to solve this cleanly.

 I´ve only been on the list for a couple of weeks, so sorry if it´s already
 been answered but couldn´t one use 2 AddTypes?

 LoadModule php4_module libexec/libphp4.so
 AddType application/x-httpd-php .php4

 LoadModule php5_module libexec/libphp5.so
 AddType application/x-httpd-php5 .php .php5

 AddModule mod_php4.c
 AddModule mod_php5.c

 I believe that´s how we did it while testing 3 vs 4 at one of my previous
 jobs (the ISP World Online/Tiscali), worked for hosted customers aswell.

 --
 Med venlig hilsen / best regards
 ComX Networks A/S
 Kim Madsen
 Systemudvikler
 Naverland 31

 DK-2600 Glostrup
 www.comx.dk
 Telefon: +45 70 25 74 74
 Telefax: +45 70 25 73 74
 E-mail: [EMAIL PROTECTED]

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



Re: [PHP] php 4 php 5

2005-03-17 Thread Bostjan Skufca @ domenca.com
Versioned libraries do not work either.

Bostjan


On Wednesday 16 March 2005 23:11, Rasmus Lerdorf wrote:
 Kim Madsen wrote:
  -Original Message-
  From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, March 15, 2005 4:05 AM
 
 That's why I'd like to stick with apache2 + php5 default and
 apache2+php4 just for a single site hosted (the one that uses imp).
 
 See my previous message describing the ProxyPass approach.  It is by far
 the easiest way to solve this cleanly.
 
  I´ve only been on the list for a couple of weeks, so sorry if it´s
  already been answered but couldn´t one use 2 AddTypes?
 
  LoadModule php4_module libexec/libphp4.so
  AddType application/x-httpd-php .php4
 
  LoadModule php5_module libexec/libphp5.so
  AddType application/x-httpd-php5 .php .php5
 
  AddModule mod_php4.c
  AddModule mod_php5.c
 
  I believe that´s how we did it while testing 3 vs 4 at one of my previous
  jobs (the ISP World Online/Tiscali), worked for hosted customers aswell.

 Nope, this won't work.  libphp4.so and libphp5.so will have a lot of
 symbol clashes.  You could attempt compiling versioned libraries here,
 but we really haven't tested that.

 -Rasmus

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



Re: [PHP] IMAP with ssl support

2005-03-14 Thread Bostjan Skufca @ domenca.com
For Imapd:

make slx 
cp imapd/imapd /usr/local/sbin/ 

cd c-client 
cp c-client.a /usr/local/lib/libc-client.a 
cp rfc822.h /usr/local/include/ 
cp mail.h /usr/local/include/ 
cp linkage.h /usr/local/include/



For PHP:
add just '--with-imap' '--with-imap-ssl'


regards,
Bostjan



On Friday 11 March 2005 21:11, Bronislav Klucka wrote:
 Hi,
 I'm trying to compile php with imap ssl support, I've downloaded imap
 source and run

 make lnp SSLTYPE=unix

 then i run php configure file with

 as

 ./configure --with-imap=/usr/src/php5/imap/ --with-openssl
 --with-imap-ssl=/usr/src/php5/imap/

 configuration, make and make install worked but I there is still no
 imaps support...

 what am I doing wrong?


 Brona

-- 
Best regards,

Bostjan Skufca
system administrator

Domenca d.o.o. 
Phone: +386 4 5835444
Fax: +386 4 5831999
http://www.domenca.com

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



Re: [PHP] patch to php 4.3.10 to disabling URL wrappers in include like statements

2005-03-02 Thread Bostjan Skufca @ domenca.com
From system security's standpoint:

?php
$content = file_get_contents('http://www.domain.net/file.inc');
echo $content;
?

is OK, but

?php
include('http://www.domain.net/file.inc');
?

is NOT!

Nice patch, Tom, will probably use it myself too...

regards, 
Bostjan

On Wednesday 02 March 2005 11:54, Markus Mayer wrote:
 Correct me if I'm wrong, but isn't this already available in the standard
 PHP? In the php.ini file, you can refuse the inclusion of url's :
   allow_url_fopen = Off

 I think also Hardened PHP offers additional similar protections.

 Markus

 On Wednesday 02 March 2005 08:57, Tom Z. Meinlschmidt wrote:
  Hi,
 
  I've experienced a lot of attacks in my hosting server due to silly users
  and their scripts with holes. So I prepared this little patch to 4.3.10,
  which disables using url wrappers in
  include/include_once/require/require_once statemens (switchable in
  php.ini). See readme.security from patch
 
  patch is there:
 
  http://orin.meinlschmidt.org/~znouza/php_patch.txt
 
  comments are welcome
 
  /tom
 
  --
  =
 ==  Tomas Meinlschmidt, SBN3, MCT, MCP, MCP+I, MCSE, NetApp Filer 
  NetCache gPG fp: CB78 76D9 210F 256A ADF4 0B02 BECA D462 66AB 6F56 / $ID:
  66AB6F56 GCS d-(?) s: a- C++ ULHISC*$ P+++ L+++$ E--- W+++$
  N++(+) !o !K w(---) !O !M V PS+ PE Y+ PGP++ t+@ !5 X? R tv b+ !DI D+ G
  e+++ h r+++ z+++@
  =
 == 

-- 
Best regards,

Bostjan Skufca
system administrator

Domenca d.o.o. 
Phone: +386 4 5835444
Fax: +386 4 5831999
http://www.domenca.com

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



Re: [PHP] PHP slowness

2005-02-26 Thread Bostjan Skufca @ domenca.com
Create profiling information for your application with pear's Timer class or 
something similar.

regards,
Bostjan



On Saturday 26 February 2005 11:50, Gerard wrote:
  Hi there, just for testings sake, you should get a script that figures
  out the page generation time for a php script... As luck would have it,
  I made a class for this not too long ago.  give this a whirl.
 
  First, create a php script with this in it...

 --snip--

  It will color code it for you and everything, give it a whirl and let us
  know what it tells you.

 Good one. A simple index gives me this:
 0.001297 seconds

 Which is normal. All it does is request a counter from the DB and add 1 to
 it. However, the page STILL takes 5 seconds to load. Or rather; for 5
 seconds it does NOTHING and then it suddenly loads.
 This is not the case with .htm and .html files, they load at once...
 Somewhere there must be something which slows the execution of .php files
 for (exactly) 5 seconds.

 I just don't know what to think of this anymore :S

 - Gerard

  Gerard wrote:
  Hello people,
  
  Recently, one of my webservers became rather slow. At first we thought
   it was the MySQL backend, but when logged in on MySQL using the command
   line tool over SSH, it runs as smooth as ever.
  Static content (normal html pages) also load without delay. It seems
   that the bottleneck is PHP itself.
  For the sake of comparison, I created 2 test pages:
  
  http://www.debuginc.com/test.html
  http://www.debuginc.com/test.php
  
  Everyone I asked says that the PHP page takes over 5 seconds to
 
  load while
 
  the HTML one instantly displays. The only code in the PHP page is ?
   echo 'hello world'; ?. No MySQL stuff, so that eliminates the initial
   idea of MySQL causing the slowness.
  
  Nevertheless, it IS slow and I have no idea why or where to
 
  start looking.
 
  The phpinfo() can be found on www.debuginc.com/info.php. Any
 
  help or hints
 
  are highly appreciated.
  
  Another interesting note; this problem started a couple of days
 
  ago without
 
  any changes in the config or anything. At first I upped the amount of
  connections Apache would accept, but it soon turned out that was not the
  problem.
  
  Thanks,
  - Gerard

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



Re: [PHP] String validation

2005-02-23 Thread Bostjan Skufca @ domenca.com
 or if you aren't into regex (which I find confusing and still am trying
 to learn):

Read the book Mastering Regular Expressions or first 300 pages of it - trust 
me, it is worth the labour (personal experience)!



On Wednesday 23 February 2005 07:44, Ligaya Turmelle wrote:

 if ((strlen(trim($string)) =6)  ctype_alpha(trim($string)))
 { echo 'good'; }
 else
 { echo 'bad'; }

 John Holmes wrote:
  Ashley M. Kirchner wrote:
 How can I check that a string is no more than 6 characters long and
  only contains alpha characters (no numbers, spaces, periods, hyphens,
  or anything else, just letters.)
 
  if(preg_match('/^[a-zA-Z]{0,6}$/',$string))
  { echo 'good'; }
  else
  { echo 'bad'; }
 
  Change to {1,6} if you want to ensure the string isn't empty.

-- 
Best regards,

Bostjan Skufca
system administrator

Domenca d.o.o. 
Phone: +386 4 5835444
Fax: +386 4 5831999
http://www.domenca.com

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



Re: [PHP] Maximum number of emails in mail() command

2005-02-21 Thread Bostjan Skufca @ domenca.com
Mailserver is the limit.

regards,
B


On Monday 21 February 2005 10:22, Dave wrote:
 PHP General,

 The Situation:
 I would like to set up a few newsletters that goes out to people
 listed in a MySQL database by sending the message from a web form
 generated by PHP. The mail will be sent out using the mail() command.
 Most of the newsletters that users can subscribe to are unlikely to
 have more than 100 or 200 recipients. But the main one will start out
 with 500, and soon reach 1000. Beyond that it's hard to say. It's
 conceivable it might even get to 2000 or more, but for now I'm assuming
 I should build something that can handle 1500 recipients.

 The Question:
 I know I can specify multiple email addresses in the BCC field by
 comma delineating them. But I'm wondering if there is an upper limit to
 how many email addresses can be attached this way. Is there any upper
 limit? Are there performance considerations? Is the limit within PHP or
 the mail server or a combination of both?

 --
 Dave Gutteridge
 [EMAIL PROTECTED]
 Tokyo Comedy Store
 http://www.tokyocomedy.com/english/

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



Re: [PHP] fsockopen: fetching url

2005-02-13 Thread Bostjan Skufca @ domenca.com
HTTP 1.0 does not support virtual hosts.


B.




On Friday 11 February 2005 18:04, [EMAIL PROTECTED] wrote:
 I'm using code below to fetch content from the url.
 This code was worked properly on two servers I tested but it want worked on
 the
 designated one,  so after getting error message I figure it out it may
 be php.ini settings limitation
 ---
- The server encountered an internal
 error or misconfiguration and was unable to complete your request.
 Additionally, a 404 Not Found error was encountered while trying to use an
 ErrorDocument to handle the request.
 ---
-


 So here's the settings I found as possible reason for limitation on code
 execution.
 ---
- disable_functions: readfile, system,
 passthru, shell_exec, shell_exec, system, execreadfile, system, passthru,
 shell_exec, shell_exec, system, exec
 ---
- Does anybody hava any tip how to
 workarround on this?


 CODE
 ---
- function fetchURL( $url ) {
$url_parsed = parse_url($url);
$host = isset($url_parsed[host]) ? $url_parsed[host]: ;
$port = isset($url_parsed[port]) ? $url_parsed[port]: 0;
if ($port==0)
$port = 80;
$path = $url_parsed[path];

$query = isset($url_parsed[query]) ? $url_parsed[query]: ;

if ($query != )
$path .= ? . $query;

$out = GET $path HTTP/1.0\r\nHost: $host\r\n\r\n;

$fp = fsockopen($host, $port, $errno, $errstr, 30);

fwrite($fp, $out);
$body = false;
$in = ;
while (!feof($fp)) {
$s = fgets($fp, 1024);
if ( $body )
$in .= $s;
if ( $s == \r\n )
$body = true;
}

fclose($fp);

return $in;
 }
 ---
-

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



Re: [PHP] updated php $_GET

2005-02-13 Thread Bostjan Skufca @ domenca.com
$_GET[section] is slower than $_GET['section'], and quite significantly!


B.




On Saturday 12 February 2005 14:16, Jacco Ermers wrote:
 Marek Kilimajer [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]

  Jacco Ermers wrote:
  Hello everyone,
 
  I recently installed php5 onto my windows IIS. Previous I had php
  running on Apache. I coded a page (testing purposes) but now I get
  errors. the page can be viewed on a remote server (without the errors)
  http://seabird.jmtech.ca
 
  Locally I receive these errors:
 
  Undefined index:  section in
  C:\Inetpub\wwwroot\Seabird-local\includes\submenu.php on line 3
 
  if($_GET['section']=='') etc.
  It used to be that I could use a section == ''
  is it new to php5 that I cannot? and I also used to be able to use
  $_GET[section] and now I have to use $_GET['section']
 
  did I overlook anything configuring my php.ini or is this due to my new
  enviroment?
 
  Thank you for helping
 
  This is due to different setting in error reporting, now you have also
  E_NOTICE turned on.
 
  if($_GET['section']=='')
 
  should be coded as:
 
  if(empty($_GET['section']))
 
  If GET variable 'section' is not sent, it is not equal to '', it does not
  even exists, is undefined. Using it triggers error of level E_NOTICE.
 
  If you write
 
  $_GET[section]
 
  php is looking for constant named 'section'. However, it does not exists,
  so an error of level E_NOTICE is triggered. Undefined constant is then
  converted to string with its name. So you get $_GET['section'] in the
  end.
 
  It's a good practice have full error reporting turned on, since this will
  help you spot errors and write safer code.

 Thank you, that did the trick. Now it works without problems.

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



Re: AW: [PHP] Determine SERVER_NAME

2005-02-13 Thread Bostjan Skufca @ domenca.com
php_uname()

B.



On Sunday 13 February 2005 20:37, Gerard Samuel wrote:
 Mirco Blitz wrote:
 Probably the Global Variable $SERVER_NAME helps you out.

 The global variable $SERVER_NAME is not available via cli
 (at least for me)

 -Ursprüngliche Nachricht-
 Von: Gerard Samuel [mailto:[EMAIL PROTECTED]
 Gesendet: Sonntag, 13. Februar 2005 19:33
 An: php-general
 Betreff: [PHP] Determine SERVER_NAME
 
 Via cli that is.
 Is there anyway besides making an actual system call (i.e.
 exec()/system()/etc...) to determine the server's name via php's cli???
 
 Thanks
 
 --
 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] Shared variable

2005-02-09 Thread Bostjan Skufca @ domenca.com
SHM



On Wednesday 09 February 2005 14:51, Mario Stiffel wrote:
 Hello.

 Is there any oppertunity to create varaibles that can accessed by more
 than one instances? I need a way to communicate between many
 php-instances. It can be, that they are not active to the same time. Is
 there any way without using a file or a database?

 Mario

-- 
Best regards,

Bostjan Skufca
system administrator

Domenca d.o.o. 
Phone: +386 4 5835444
Fax: +386 4 5831999
http://www.domenca.com

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



Re: [PHP] fsockopen

2005-02-02 Thread Bostjan Skufca @ domenca.com
Last two examples are fine as connection is obviously established, it is the  
communication with server that is causig an error. Read http protocol 
documentation.

You do not want such a degree of control over communication you can just use
file_get_contents($url);
where $url is 
http(s)://your.domain.net/dir/file... - standard url


regards,
Bostjan




On Tuesday 01 February 2005 18:17, pete M wrote:
 am not having a lot of success with opening a socket to a secure domain
 (php 4.3.8 - apache - openSSL)

 $fp = fsockopen($url , 443 ,$errno, $errstr, 30);

 have tried the following $urls

 ---
 $url = 'domain.net';

 Bad Request
 Your browser sent a request that this server could not understand.

 Reason: You're speaking plain HTTP to an SSL-enabled server port.
 Instead use the HTTPS scheme to access this URL, please.

 --
 $url = 'https://domain.net';

 Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name
 or service not known

 --
 $url = 'ssl://domain.net';

 Bad Request
 Your browser sent a request that this server could not understand.

 Client sent malformed Host header

 ---
 $url = 'tls://domain.net';

 Bad Request
 Your browser sent a request that this server could not understand.

 Client sent malformed Host header


 Am I missing the obvious as I cannot thing of any other options ;-((

 tia
 pete

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



Re: [PHP] php editor

2005-01-14 Thread Bostjan Skufca @ domenca.com
1. Does anybody know an editor that supports Smarty tags natively or via some 
sort of custom extension/configuration?

2. Does anybody use Scite (for Un*x) or SciteFlash (for Windows)? I prefer 
it's clean and lightweight interface (once properly configured)...


Regards,
Bostjan


On Thursday 13 January 2005 17:02, William Stokes wrote:
 Hello,

 I'm quite new with writing php code. I was considering of using some kind
 of php editor program to help with the syntax. Know any goog ones?

 Thanks
 -Will

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



[PHP] $_GET $_POST simultaneously

2005-01-11 Thread Bostjan Skufca @ domenca.com
Hello,

If I create form like this
form name=form action=##_URI_ROOT##/entity/edit.php?a=b method=post
input type=hidden name=action value=modify /
...
both arrays contain appropriate variables when submitted:
::: $_GET :::
Array
 (
 [a] = b
 )
 
::: $_POST :::
Array
 (
 [action] = modify
...
)

Now what I am interested in is if this is valid behaviour regarding HTTP 
specification and if other platforms support this interference of GET and 
POST variables in request?

Thank your for your answers,
Bostjan

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



Re: [PHP] $_GET $_POST simultaneously

2005-01-11 Thread Bostjan Skufca @ domenca.com
Browser history: I do not want it to contain any URIs to files which require 
some sort of id variable passed.

Example:
1. http://www.entity.org/edit.php 
(should produce an error or redirect to entity list)

2. http://www.entity.org/edit.php?id=1 
(should display editing interface)

Now I really do not like to use redirects in case of errors. So I could 
constantly use (2) second form of URI, even in POST requests.

But then, if I already have id in $_GET, why the redundancy of sending 
another id to $_POST?


B.

On Tuesday 11 January 2005 09:48, you wrote:
 Is it just me or ... why on earth would you want to populate both GET and
 POST arrays through this obscure way of coding ?

 If you really have a form where you dont have a clue wether your data comes
 from GET or POST, it should be way less effort to copy one array to another
 or have a lookup function to return the given value.

 / Lars

 - Original Message -
 From: Bostjan Skufca @ domenca.com [EMAIL PROTECTED]
 To: php-general@lists.php.net
 Sent: Tuesday, January 11, 2005 5:42 PM
 Subject: [PHP] $_GET  $_POST simultaneously

  Hello,
 
  If I create form like this
  form name=form action=##_URI_ROOT##/entity/edit.php?a=b
  method=post
  input type=hidden name=action value=modify /
  ...
 
  both arrays contain appropriate variables when submitted:
  ::: $_GET :::
 
  Array
  (
  [a] = b
  )
 
  ::: $_POST :::
 
  Array
  (
  [action] = modify
  ...
  )
 
  Now what I am interested in is if this is valid behaviour regarding HTTP
  specification and if other platforms support this interference of GET and
  POST variables in request?
 
  Thank your for your answers,
  Bostjan
 
  --
  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] register_user_func and register_shutdown_func

2004-12-15 Thread Bostjan Skufca @ domenca.com
It's ok,

I discovered that object (if not passed by reference explicitly) is first 
duplicated (internally) and only then the method is called.


Proof code:

?php
class myCls
{
var $myVar;
function myCls() { $this-myVar = 1; }
function myInc() { $this-myVar++; }
function myEcho() { echo $this-myVar ; }
}

$myObj = new myCls();
$myObj-myEcho();
$myObj-myInc();
$myObj-myEcho();
call_user_func(array($myObj, 'myInc'));
$myObj-myEcho();
unset($myObj);

echo \n;

$myObj = new myCls();
$myObj-myEcho();
$myObj-myInc();
$myObj-myEcho();
call_user_func(array($myObj, 'myInc'));
$myObj-myEcho();
?

produces output:
1 2 2 
1 2 3 


On Wednesday 15 December 2004 08:28, Bostjan Skufca @ domenca.com wrote:
 Hi all,

 is there any internal difference between following calls (they occur inside
 some class)?

 #1 register_shutdown_function(array($this, 'myfunc'));
 #2 register_shutdown_function(array($this, 'myfunc'));
 (note the reference operator in #2)

 Or is parameter $this in example #1 forced to be taken as reference
 internally, which makes both calls basically identical?


 Thank you for your kind response.


 Best regards,
 Bostjan Skufca

-- 
Best regards,

Bostjan Skufca
system administrator

Domenca d.o.o. 
Phone: +386 4 5835444
Fax: +386 4 5831999
http://www.domenca.com

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



[PHP] register_user_func and register_shutdown_func

2004-12-14 Thread Bostjan Skufca @ domenca.com
Hi all,

is there any internal difference between following calls (they occur inside 
some class)?

#1 register_shutdown_function(array($this, 'myfunc'));
#2 register_shutdown_function(array($this, 'myfunc'));
(note the reference operator in #2)

Or is parameter $this in example #1 forced to be taken as reference 
internally, which makes both calls basically identical?


Thank you for your kind response.


Best regards,
Bostjan Skufca

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


Re: [PHP] Apache segmentation faults

2004-10-18 Thread Bostjan Skufca @ domenca.com
Is there any special apache/php compile option needed to generate core files 
on linux? 

I have seen few segfaults and i have set CoreDumpDirectory to /tmp/httpd.core 
which has correct permissions but no core file gets generated. Are core files 
generated only when apache parent process segfaults?


On Monday 18 of October 2004 08:03, Curt Zirzow wrote:
 * Thus wrote Bostjan Skufca @ domenca.com:
  Hello,
 
  every now and then I notice in apache logs there were few segmentation
  faults (on a daily basis) and all I am stuck with is PID of that process
  (which is of course dead by then) and nothing about what it was doing. Is
  there any way to figure out what request that apache process was serving
  when SIGSEGV occured? Is there any reading about this?
 
  I believe the request is not logged at all because (I think) every child
  writes to log files himself and not through parent. (+ log files usually
  provide outgoing bytes value, which is not available in such a situation
  - if it was logging through parent)
 
  Again, does anybody know how could I trace out what is causing this?

 There should be a core file of the dump (httpd.core) generated from
 the seg fault.  If apache is installed in /usr/local/apache, you
 should find one at:
   /usr/local/apache/httpd.core


 You can use gdb to obtain a backtrace to find out exactly where
 apache died by issuing something like:

  gdb /usr/local/apache/bin/httpd /usr/local/apache/httpd.core


 Then type 'bt'


 Curt
 --
 Quoth the Raven, Nevermore.

-- 
Best regards,

Bostjan Skufca
system administrator

Domenca d.o.o. 
Phone: +386 4 5835444
Fax: +386 4 5831999
http://www.domenca.com

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



[PHP] Apache segmentation faults

2004-10-17 Thread Bostjan Skufca @ domenca.com
Hello,

every now and then I notice in apache logs there were few segmentation faults 
(on a daily basis) and all I am stuck with is PID of that process (which is 
of course dead by then) and nothing about what it was doing. Is there any way 
to figure out what request that apache process was serving when SIGSEGV 
occured? Is there any reading about this?

I believe the request is not logged at all because (I think) every child 
writes to log files himself and not through parent. (+ log files usually 
provide outgoing bytes value, which is not available in such a situation - if 
it was logging through parent)

Again, does anybody know how could I trace out what is causing this?

Thank you,
Bostjan

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



Re: [PHP] Using php4 AND php5

2004-10-04 Thread Bostjan Skufca @ domenca.com
Compile another apache apache with php5 and make it listen on port 81, use 
different pid file and different error_log, recompile your current apache 
with modules mod_rewrite and mod_proxy and mod_proxy_http enabled. Then make 
current apache forward all .php5 requests to second apache via proxy module 
like this:

RewriteEngine   On
RewriteRule (.*)\.php5$ http://%{HTTP_HOST}:81$1.php [P]
(add this to each virtual host definition)

the trick about logs is that everything is logged with your primary apache 
server, so you do not need to open all vhost logs on your secondary apache - 
you need errorlog though :)

regards,
Bostjan


On Monday 04 of October 2004 13:44, Dobermann wrote:
 Hi all,

 I'd like to know how to install both php 4 and 5 on the same server,
 for example with .php4 and .php5 extensions.

 I tried editing some part of the source code to change the way Apache
 calls php (with application/x-httpd types) but I never get apache to
 start :(

 I heard about compiling one version as module and the other as cgi but
 did not try myself...

 If anybody has an idea... :)

 Thanks
 dob

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



Re: [PHP] PHP 4.3.8 and Turck MMCache compatibility

2004-09-24 Thread Bostjan Skufca @ domenca.com
It works on php 4.3.8 and 4.3.9 fine (as server module it does, it does not 
work as cgi though - as page states)

lp,
Bostjan


On Friday 24 of September 2004 08:29, Binay wrote:
 Hi

 I don't need everything i.e encoder, optimizer, accelerator etc. What i
 need is Loader which can decode the encoded files .

 I followed the instruction for installing the Turck loader but its not
 working on 4.3.8 . It was working on 4.3.3.

 I don know where m i doing wrong .

 Please help me out.

 Thanks
 Binay
 - Original Message -
 From: raditha dissanayake [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Friday, September 24, 2004 6:41 AM
 Subject: Re: [PHP] PHP 4.3.8 and Turck MMCache compatibility

  Binay wrote:
  Hi
  
  Does any one have idea about the compatibility of Turck MMcache with PHP

 4.3.8. It was working well with 4.3.3 and ever since i have upgraded to
 4.3.8 it stopped. I recompiled Turck MMcache for new version of PHP also
 but no luck.

  They work together. Make sure the mmcache.so goes to the right location.
  I will bet that make install didn't copy it
 
 
  --
  Raditha Dissanayake.
  
  http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
  Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
  Graphical User Inteface. Just 128 KB | with progress bar.
 
  --
  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] PHP 4.3.8 and Turck MMCache compatibility

2004-09-24 Thread Bostjan Skufca @ domenca.com
Well,

it could hardly mean that it is installed as sapi wouldn't it?


On Friday 24 of September 2004 10:19, Binay wrote:
 correct

 It show Server API CGI.

 So does it mean PHP is installed as CGI and not the apache module?

 Thanks
 Binay
 - Original Message -
 From: Bostjan Skufca @ domenca.si [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, September 24, 2004 1:21 PM
 Subject: Re: [PHP] PHP 4.3.8 and Turck MMCache compatibility

  Look at phpinfo() output.
 
  Search for
  Server API Apache 2.0 Handler
 
  or
  Server API Apache 2.0 Filter
 
  or something about apachehook(s)
  All above means it is installed as module
 
  If you find something refering to CGI then it is installed as CGI (and
  not $_SERVER, Apache environment and loaded modules)
 
  lp,
  B
 
  On Friday 24 of September 2004 09:01, Binay wrote:
   So how to check whether php is installled as Apache module or CGI 
   mode?
  
   Thanks
   - Original Message -
   From: Bostjan Skufca @ domenca.com [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Friday, September 24, 2004 12:30 PM
   Subject: Re: [PHP] PHP 4.3.8 and Turck MMCache compatibility
  
It works on php 4.3.8 and 4.3.9 fine (as server module it does, it

 does

   not
  
work as cgi though - as page states)
   
lp,
Bostjan
   
On Friday 24 of September 2004 08:29, Binay wrote:
 Hi

 I don't need everything i.e encoder, optimizer, accelerator etc.

 What i

 need is Loader which can decode the encoded files .

 I followed the instruction for installing the Turck loader but its

 not

 working on 4.3.8 . It was working on 4.3.3.

 I don know where m i doing wrong .

 Please help me out.

 Thanks
 Binay
 - Original Message -
 From: raditha dissanayake [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Friday, September 24, 2004 6:41 AM
 Subject: Re: [PHP] PHP 4.3.8 and Turck MMCache compatibility

  Binay wrote:
  Hi
  
  Does any one have idea about the compatibility of Turck MMcache

 with

   PHP
  
 4.3.8. It was working well with 4.3.3 and ever since i have
 upgraded

 to

 4.3.8 it stopped. I recompiled Turck MMcache for new version of PHP
 also but no luck.

  They work together. Make sure the mmcache.so goes to the right
  
   location.
  
  I will bet that make install didn't copy it
 
 
  --
  Raditha Dissanayake.
 
  
 
  http://www.radinks.com/sftp/ |
  
   http://www.raditha.com/megaupload
  
  Lean and mean Secure FTP applet with | Mega Upload - PHP file
  uploader Graphical User Inteface. Just 128 KB | with progress
  bar.
 
  --
  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 General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php

-- 
Best regards,

Bostjan Skufca
system administrator

Domenca d.o.o. 
Phone: +386 4 5835444
Fax: +386 4 5831999
http://www.domenca.com

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



Re: [PHP] Apache 2 and php 5 compatibility

2004-09-23 Thread Bostjan Skufca @ domenca.com
We use php4 and php5 with apache2 on production servers without any problem 
(prefork MPM).

worker MPM could be a problem though...


regrds,
Bostjan


On Thursday 23 of September 2004 10:28, Frédéric Hardy wrote:
 Hello -

 I known that using apache 2 with php 4.x is not a good idea, because
 some php library are not compatible with multi-threading.

 But php 5 ?

 Best regards,

 Fred -

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



Re: [PHP] php4 and php5 on the same apache server

2004-09-13 Thread Bostjan Skufca @ domenca.com
Hello Jacob,

i've been trying to achieve the very same result but without success. I tried 
even modifying sources of sapi/apache2(handler|filter)/sapi_apache2.c and 
relatives but without success. Mime type can be modified without any problem 
and it compiles fine but then when I tried to parse PHP5 file there is a 
segfault. 

I think some PHP developer could explain what is going on actually.

lp
B.

On Monday 13 of September 2004 14:30, Jacob Friis Larsen wrote:
 How can I run both php4 and php5 on the same apache server?

 Could I do it like this:
 AddType application/x-httpd-php .php
 AddType application/x-httpd-php5 .php5
 And somehow tell php5 to use application/x-httpd-php5

 --
 Best regards, Jacob Friis Larsen
 www.webcom.dk | www.journster.com

-- 
Best regards,

Bostjan Skufca
system administrator

Domenca d.o.o. 
Phone: +386 4 5835444
Fax: +386 4 5831999
http://www.domenca.com

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