Re: [PHP] Class and interface location

2011-01-18 Thread Adam Richardson
On Wed, Jan 19, 2011 at 2:07 AM, Larry Garfield wrote:

> 3) Static analysis.  Instead of reflection, either tokenize or string parse
> all files to determine what classes implement what interfaces and then
> cache
> that information.  We are actually using this method now to locate classes,
> and it works surprisingly well.  Because we never parse code into memory it
> does not ever spike the memory usage.  However, it is impossible to
> determine
> if a class implements a given interface by static analysis unless it
> declare
> so itself with the implements keyword.  If it does so indirectly via
> inheritance, either via the class or via the interface, it would not find
> it.
> That necessitates that any "detectable" classes must explicitly themselves
> declare their interfaces, even if it is redundant to do so.  I don't like
> that
> approach, but it's the first one that strikes me as even viable.
>

4) Explicit declaration.  In this approach we detect nothing and rely on the
> plugin developer to do everything.  That is, they must provide somewhere
> (either in code or a configuration file) an index of all classes they
> offer,
> the interfaces they implement, and the file in which they live.  While this
> makes the implementation easy, it is a huge burden on the plugin developer
> and
> I'm quite sure they'll forget to do so or get it wrong on a regular basis.
>

I'd suggest combining 3 and 4.  Build a tool that performs a static analysis
of a group of files and make it easy for developers to use.  This tool would
generate the explicit declarations your codebase would utilize when
answering such questions as "which classes implement interface foo".  The
file the static analysis tool generates could be easily hand editable, so
developers could tweak it if they see issues (just in case the static
analysis tool has bugs early on), or for small plugins, just quick crank out
a couple lines by hand.

As long as the static analysis tool builds a composite of class hierarchy
established in all the files (project wide, at least in terms of the
plugin), you wouldn't have to double declare interfaces so they could be
detected.

Adam

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


[PHP] Class and interface location

2011-01-18 Thread Larry Garfield
Hi all.  I'm trying to come up with a solution to an architectural problem I 
could use some extra eyes on.

I have (or will have) a large code base with lots of classes, spread out over 
many optional plugin components.  These classes, of course, will have 
interfaces on them.  These classes will, of course, lazy-load using PHP's 
autoload capability.

What I need to know is which classes implement which interfaces, so that I can 
load and use "all classes that implement interface Foo".  

There are a couple of approaches that I've considered, all of which I dislike 
for one reason or another.

1) Magic file naming.  That is, any class that implements interface Foo lives 
in a $something.Foo.inc file, or some similar pattern.  This has a number of 
problems.  First, it means a huge number of file_exists() calls to determine 
if a given potential class exists, and then disk hits to load those files.  
While that information is possible to cache, it also means that we cannot have 
a class that implements two of the interfaces I'm interested in (a feature I 
will need) because then it would have to live in two files, which is clearly 
impossible.

2) Reflection.  PHP makes it quite easy to get a list of all loaded classes, 
and to get a list of all interfaces that a loaded class implements.  The catch 
there is "loaded".  Reflection only works once you've loaded the code file 
into memory.  Once you've done so, you cannot unload it.  That means the code 
is sitting there in memory wasting space.  Given the size of the code base in 
question, that could easily blow out the process memory limit.  Even if we 
cache that information we derive from reflection we still have to load it the 
first time (or periodically when rebuilding the cache), which will blow the 
memory limit.  The only alternative would be to have some sort of incremental 
rebuild across a multi-request batch process, the complexity of which makes my 
skin crawl.

3) Static analysis.  Instead of reflection, either tokenize or string parse 
all files to determine what classes implement what interfaces and then cache 
that information.  We are actually using this method now to locate classes, 
and it works surprisingly well.  Because we never parse code into memory it 
does not ever spike the memory usage.  However, it is impossible to determine 
if a class implements a given interface by static analysis unless it declare 
so itself with the implements keyword.  If it does so indirectly via 
inheritance, either via the class or via the interface, it would not find it.  
That necessitates that any "detectable" classes must explicitly themselves 
declare their interfaces, even if it is redundant to do so.  I don't like that 
approach, but it's the first one that strikes me as even viable.

4) Explicit declaration.  In this approach we detect nothing and rely on the 
plugin developer to do everything.  That is, they must provide somewhere 
(either in code or a configuration file) an index of all classes they offer, 
the interfaces they implement, and the file in which they live.  While this 
makes the implementation easy, it is a huge burden on the plugin developer and 
I'm quite sure they'll forget to do so or get it wrong on a regular basis.

5) Wave a wand and let the magic ponies figure it out.  I wish. :-)

Can anyone suggest a better alternative?  At the moment option 3 seems like 
the most viable approach, but I'm not wild about the implied performance 
impact nor the potentially redundant interface definitions it would require.

--Larry Garfield

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



Re: [PHP] switch case madness

2011-01-18 Thread Paul M Foster
On Tue, Jan 18, 2011 at 10:53:19PM -0600, Donovan Brooke wrote:

> >Why not use one of the countless, not to mention secure and stable cookie
> management systems available? If it's an exercise cool, I misunderstood.
> >
> >I'm not one to normally shun people rolling their own code, lord knows
> I've done it more then once or twice, but there are some things I wouldn't
> touch with a ten foot pool, and cookie management is one of them. The
> other would be things like CSV parsers or text manipulations.
> >
> >Regards,
> >
> >-Josh
> 
> 
> The idea of using existing resources for efficiency is very valid
> indeed.. especially with a job at hand. But, there are good reasons to
> roll-your-own... education and knowing your own code are 2 that are
> important to me right now. Besides, a cookie based log-in system is
> really not that complex. ;-)

I have to agree here. Login systems aren't that hard to do. And finding
a "library" or "toolkit" which does exactly what you want exactly the
way you want may not be so easy. For example, I don't use MySQL unless I
absolutely have to. But there aren't that many such systems based on
PostgreSQL. I could take their MySQl code and hack it. But while
analyzing their code, you find you could have done this yourself in half
a day, less if you've done it before.

I'm just thick enough to believe that most programming problems are
relatively easily solved from scratch. And it's an interesting challenge
to do so. Particularly when the result is something which can be reused
in later projects.

Yes, of course, I wouldn't touch payment gateways and the like.

Paul

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


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



Re: [PHP] switch case madness

2011-01-18 Thread Donovan Brooke

Why not use one of the countless, not to mention secure and stable cookie 
management systems available? If it's an exercise cool, I misunderstood.

I'm not one to normally shun people rolling their own code, lord knows I've 
done it more then once or twice, but there are some things I wouldn't touch 
with a ten foot pool, and cookie management is one of them. The other would be 
things like CSV parsers or text manipulations.

Regards,

-Josh



The idea of using existing resources for efficiency is very valid 
indeed.. especially with a job at hand. But, there are good reasons to 
roll-your-own... education and knowing your own code are 2 that are 
important to me right now. Besides, a cookie based log-in system is 
really not that complex. ;-)


Now.. payment gateway API? AJAX requests? I'll take the snippets please.

Cheers,
Donovan (moving on to database administration)



--
D Brooke

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



Re: [PHP] switch case madness

2011-01-18 Thread Joshua Kehn
On Jan 18, 2011, at 11:33 PM, Donovan Brooke wrote:

>>> --
>>> D Brooke
>> 
>> I just died a bit on the inside.
>> 
>> Why would you build that from scratch?
>> 
>> Regards,
>> 
>> -Josh
> 
> 
> Alright, I'll bite (since I affected you that much) ;-),
> 
> do tell...
> 
> Why not? Would you rather I use PHP's session_start()?
> 
> 
> Donovan
> 

Why not use one of the countless, not to mention secure and stable cookie 
management systems available? If it's an exercise cool, I misunderstood. 

I'm not one to normally shun people rolling their own code, lord knows I've 
done it more then once or twice, but there are some things I wouldn't touch 
with a ten foot pool, and cookie management is one of them. The other would be 
things like CSV parsers or text manipulations. 

Regards,

-Josh

Joshua Kehn | josh.k...@gmail.com
http://joshuakehn.com



Re: [PHP] switch case madness

2011-01-18 Thread Donovan Brooke

--
D Brooke


I just died a bit on the inside.

Why would you build that from scratch?

Regards,

-Josh



Alright, I'll bite (since I affected you that much) ;-),

do tell...

Why not? Would you rather I use PHP's session_start()?


Donovan




--
D Brooke

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



Re: [PHP] switch case madness

2011-01-18 Thread Joshua Kehn
On Jan 18, 2011, at 11:01 PM, Donovan Brooke wrote:

> Thanks.
> 
> I had initialized $t_mssg as an empty string further up the chain out of old 
> habit.. removed that, and now it works... just built my first
> basic cookie-based PHP/MySQL log-in script from scratch! ;-)
> 
> Fun stuff,
> Donovan
> 
> 
> 
> -- 
> D Brooke

I just died a bit on the inside.

Why would you build that from scratch? 

Regards,

-Josh

Joshua Kehn | josh.k...@gmail.com
http://joshuakehn.com



Re: [PHP] switch case madness

2011-01-18 Thread Donovan Brooke

Thanks.

I had initialized $t_mssg as an empty string further up the chain out of 
old habit.. removed that, and now it works... just built my first

basic cookie-based PHP/MySQL log-in script from scratch! ;-)

Fun stuff,
Donovan



--
D Brooke

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



Re: [PHP] switch case madness

2011-01-18 Thread Mujtaba Arshad
$t_mssg = 0 is different from $t_mssg = "0" (in all languages, as far as I
know, maybe not in python, but I don't know python)

On Tue, Jan 18, 2011 at 10:30 PM, Donovan Brooke  wrote:

> Hello,
>
> I must not understand PHP's switch/case..
> The case '0' below fires when $t_mssg = "" apparently.
> Is this how it's suppose to work? I would think
> it would only fire if it equaled "0".
>
> --
> print "-$t_mssg- ";
>
> if (isset($t_mssg)) {
>  switch ($t_mssg) {
>case 0:
>  echo 'Log In Successful';
>  break;
>  }
> }
> --
>
> TIA,
> Donovan
>
> --
> D Brooke
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Mujtaba


Re: [PHP] switch case madness

2011-01-18 Thread Joshua Kehn
On Jan 18, 2011, at 10:30 PM, Donovan Brooke wrote:

> Hello,
> 
> I must not understand PHP's switch/case..
> The case '0' below fires when $t_mssg = "" apparently.
> Is this how it's suppose to work? I would think
> it would only fire if it equaled "0".
> 
> --
> print "-$t_mssg- ";
>   
> if (isset($t_mssg)) {
>  switch ($t_mssg) {
>case 0:
>  echo 'Log In Successful';
>  break;
>  }
> }
> --
> 
> TIA,
> Donovan
> 
> -- 
> D Brooke

I use switch cases so rarely I would have to refer you to the documentation.

Regards,

-Josh

Joshua Kehn | josh.k...@gmail.com
http://joshuakehn.com



Re: [PHP] switch case madness

2011-01-18 Thread Chen Dong
Hi,

If it is a string "0", you should use: case "0".
Because in PHP, 0 == false == null. You need to know the difference between
== and ===.

Regards,
Dong Chen

On Wed, Jan 19, 2011 at 2:30 PM, Donovan Brooke  wrote:

> Hello,
>
> I must not understand PHP's switch/case..
> The case '0' below fires when $t_mssg = "" apparently.
> Is this how it's suppose to work? I would think
> it would only fire if it equaled "0".
>
> --
> print "-$t_mssg- ";
>
> if (isset($t_mssg)) {
>  switch ($t_mssg) {
>case 0:
>  echo 'Log In Successful';
>  break;
>  }
> }
> --
>
> TIA,
> Donovan
>
> --
> D Brooke
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Regards,
CHEN Dong


[PHP] switch case madness

2011-01-18 Thread Donovan Brooke

Hello,

I must not understand PHP's switch/case..
The case '0' below fires when $t_mssg = "" apparently.
Is this how it's suppose to work? I would think
it would only fire if it equaled "0".

--
print "-$t_mssg- ";

if (isset($t_mssg)) {
  switch ($t_mssg) {
case 0:
  echo 'Log In Successful';
  break;
  }
}
--

TIA,
Donovan

--
D Brooke

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



Re: [PHP]: permission problem www-data

2011-01-18 Thread Al



On 1/18/2011 4:44 AM, Moses wrote:

Hi Everyone,

I am creating a file in PHP script which takes a value from a form and
writes it
to a file. However, i don't have the mode permission for the file instead it
is owned
by www-data.What can i do to ensure that the file is owned by me.


drwxr-xr-x 2 www-data www-data 4096 2011-01-17 22:01 18757170111.0
-rw-r--r-- 1 www-data www-data   40 2011-01-17 23:39 32238.hydro

Thanks.



Either have a PHP script create the directory, OR

Using FTP access, set the dir perms to 757, or 777. The xx7 makes the dir world 
writable.


For protection, put a .htaccess file in the dir like:

# Prevent Direct Access to Files from outside world

Order Deny,Allow
Deny from all


Or put your dir above the webspace, [DOCUMENT_ROOT}

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



[PHP] Re: PHP Error logging

2011-01-18 Thread Carlos Medina

Am 18.01.2011 01:33, schrieb Jimmy Stewpot:

Hello,

I currently have a strange issue where we are seeing 'random errors' being 
displayed to end users. What I find most interesting is that in the php.ini 
file we have the following error settings.

error_reporting  =  E_ALL&  ~E_NOTICE
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
track_errors = Off

I thought that if we had dislay_errors = Off then end users should never see 
errors displayed on the web page. However at apparently random times we do 
still see errors being reported, its not consistent at all. To give a better 
idea of the problem we have 8 web servers, they all run an identical copy of 
the site which is stored on a common netapp nfs filer. At apparently random 
times we see that 1 out of 8 servers will reported strange errors like 'use of 
undefined constant' or 'Undefined variable'. What's most strange about these 
errors is that if the code was faulty wouldn't we expect to see the errors on 
all web servers? and secondly wouldn't we expect to see the errors constantly 
rather than at apparently random intervals?

The php.ini files have a modify time of mid 2010 and yet this problem has only 
started in the last few weeks. Has anyone else experienced similar problems in 
the past and if so what was the root cause?

Regards,

Jimmy

Hi,
i think some developer has setting the display_errors with 
ini_set('display_errors', true);

this is why your become the problems now. Maybe this is a idea?

regards

Carlos

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



Re: [PHP] 2nd Pair of eyes

2011-01-18 Thread Donovan Brooke

Daniel Brown wrote:

On Tue, Jan 18, 2011 at 12:49, Donovan Brooke  wrote:

Hello,

I warned the list that I may have questions! ;-)

...building a simple cookie-based log-in system, and have
narrowed an error to this below: (sorry for email line breaks, if any)

---Start---
if ($_post['f_action']=='login') {


 $_POST is cAsE-SeNsItIvE, like all variables.


  // connect to database (custom function)
  $r = dbconnect();


 Did you define this function?



Hi Daniel, good point (that I'm sure I would have caught ;-) ) about
the $_POST... and yes, dbconnect(); is defined.

Looks like it was the array indices syntax that was the culprit.

Also for others, yes, I'll be adding the var cleaning and checkers.

Thanks again.

Donovan




--
D Brooke

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



Re: [PHP] 2nd Pair of eyes

2011-01-18 Thread Donovan Brooke

Simon J Welsh wrote:
[snip]

---Start---
$query = "SELECT u_id FROM cms_users WHERE u_name = $_post['f_user'] AND u_pass 
= $_post['f_pass']";


Array indices either need to be accessed without quotes for the key, or by 
enclosing the variable in curly braces.
---
Simon Welsh
Admin of http://simon.geek.nz/



Excellent Simon, that did it.  Thanks!

Donovan



--
D Brooke

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



Re: [PHP] 2nd Pair of eyes

2011-01-18 Thread Simon J Welsh
On 19/01/2011, at 6:49 AM, Donovan Brooke wrote:

> Hello,
> 
> I warned the list that I may have questions! ;-)
> 
> ...building a simple cookie-based log-in system, and have
> narrowed an error to this below: (sorry for email line breaks, if any)
> 
> ---Start---
>$query = "SELECT u_id FROM cms_users WHERE u_name = $_post['f_user'] AND 
> u_pass = $_post['f_pass']";

Array indices either need to be accessed without quotes for the key, or by 
enclosing the variable in curly braces.
---
Simon Welsh
Admin of http://simon.geek.nz/

Who said Microsoft never created a bug-free program? The blue screen never, 
ever crashes!

http://www.thinkgeek.com/brain/gimme.cgi?wid=81d520e5e


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



Re: [PHP] 2nd Pair of eyes

2011-01-18 Thread Richard Quadling
On 18 January 2011 17:49, Donovan Brooke  wrote:
>    $query = "SELECT u_id FROM cms_users WHERE u_name = $_post['f_user'] AND
> u_pass = $_post['f_pass']";

Make sure you clean the inputs before using them.

If the username entered was ...

'' OR 1 --

you may have problems with security.


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [PHP] 2nd Pair of eyes

2011-01-18 Thread Daniel Brown
On Tue, Jan 18, 2011 at 12:49, Donovan Brooke  wrote:
> Hello,
>
> I warned the list that I may have questions! ;-)
>
> ...building a simple cookie-based log-in system, and have
> narrowed an error to this below: (sorry for email line breaks, if any)
>
> ---Start---
> if ($_post['f_action']=='login') {

$_POST is cAsE-SeNsItIvE, like all variables.

>  // connect to database (custom function)
>  $r = dbconnect();

Did you define this function?

-- 

Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/

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



[PHP] 2nd Pair of eyes

2011-01-18 Thread Donovan Brooke

Hello,

I warned the list that I may have questions! ;-)

...building a simple cookie-based log-in system, and have
narrowed an error to this below: (sorry for email line breaks, if any)

---Start---
if ($_post['f_action']=='login') {

  // connect to database (custom function)
  $r = dbconnect();

  // success?
  if ($r['a_success']) {
$query = "SELECT u_id FROM cms_users WHERE u_name = 
$_post['f_user'] AND u_pass = $_post['f_pass']";


if ($r = @mysql_query($query))
{
  // test
  print "";
}

mysql_close();
  } else {

  // Not connected to db
  $t_mssg = mysql_error();
  }

}
---End---

No info is given in PHP error reporting because it
returns no source to the page. Can you see where this n00b went wrong?

Thanks!

Donovan


--
D Brooke

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



Re: [PHP] [PHP]: permission problem www-data

2011-01-18 Thread Daniel Brown
On Tue, Jan 18, 2011 at 10:55, Jim Lucas  wrote:
>
> You could run PHP in FastCGI mode and start it as your user.  Then have your 
> web
> server use that PHP instance for your web site to process all PHP requests.
>
> This is how we have our servers at the office setup.  Works great.

My guess from the copy-and-paste and his understanding of the
situation is that he's on a shared host, not a dedicated box or a
local system.

-- 

Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/

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



Re: [PHP] [PHP]: permission problem www-data

2011-01-18 Thread Jim Lucas
On 1/18/2011 2:19 AM, a...@ashleysheridan.co.uk wrote:
> Because the web server is what runs php as a module, and the web server has 
> its own user for security reasons. You could try chmod but that is generally 
> a last resort.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> - Reply message -
> From: "Moses" 
> Date: Tue, Jan 18, 2011 10:17
> Subject: [PHP] [PHP]: permission problem www-data
> To: "a...@ashleysheridan.co.uk" 
> Cc: 
> 
> 

You could run PHP in FastCGI mode and start it as your user.  Then have your web
server use that PHP instance for your web site to process all PHP requests.

This is how we have our servers at the office setup.  Works great.

Jim Lucas

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



Re: [PHP] [PHP]: permission problem www-data

2011-01-18 Thread Jim Lucas
On 1/18/2011 1:44 AM, Moses wrote:
> Hi Everyone,
> 
> I am creating a file in PHP script which takes a value from a form and
> writes it
> to a file. However, i don't have the mode permission for the file instead it
> is owned
> by www-data.What can i do to ensure that the file is owned by me.
> 
> 
> drwxr-xr-x 2 www-data www-data 4096 2011-01-17 22:01 18757170111.0
> -rw-r--r-- 1 www-data www-data   40 2011-01-17 23:39 32238.hydro
> 
> Thanks.
> 

Have the PHP process run as your user.

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



Re: [PHP] [PHP]: permission problem www-data

2011-01-18 Thread Donovan Brooke

Moses wrote:

Hi Everyone,

I am creating a file in PHP script which takes a value from a form and
writes it
to a file. However, i don't have the mode permission for the file instead it
is owned
by www-data.What can i do to ensure that the file is owned by me.


drwxr-xr-x 2 www-data www-data 4096 2011-01-17 22:01 18757170111.0
-rw-r--r-- 1 www-data www-data   40 2011-01-17 23:39 32238.hydro

Thanks.



Hi Moses, I think the answer to your question lies in more info from 
you. I assume that you want your user account to have permission? Why?

What are you doing with the file?

Donovan



--
D Brooke

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



RE: [PHP] A bad design decision or pure genius?

2011-01-18 Thread Jay Blanchard
[snip]
>> I have a application that I'm working on that uses google maps to
>> display interactive maps (using javascript) on the website.
[/snip]

Have a look here;

http://speckyboy.com/2010/02/03/10-jquery-plugins-for-easier-google-map-
installation/

jQuery can take some of the pain out of working with Google maps.
 

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



Re: [PHP] [PHP]: permission problem www-data

2011-01-18 Thread a...@ashleysheridan.co.uk
Because the web server is what runs php as a module, and the web server has its 
own user for security reasons. You could try chmod but that is generally a last 
resort.

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

- Reply message -
From: "Moses" 
Date: Tue, Jan 18, 2011 10:17
Subject: [PHP] [PHP]: permission problem www-data
To: "a...@ashleysheridan.co.uk" 
Cc: 




Re: [PHP] [PHP]: permission problem www-data

2011-01-18 Thread Moses
Hi Ash,

I have tried to use chown but i am getting the error
Warning: chown() [function.chown]: Operation not permitted

I would like to know why the apache(www-data)  owns the file rather than
the user (me).

Thanks.

On Tue, Jan 18, 2011 at 11:53 AM, a...@ashleysheridan.co.uk <
a...@ashleysheridan.co.uk> wrote:

> you could use the chown method in php, which should do what you need.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
> - Reply message -
> From: "Moses" 
> Date: Tue, Jan 18, 2011 09:44
> Subject: [PHP] [PHP]: permission problem www-data
> To: 
>
>
> Hi Everyone,
>
> I am creating a file in PHP script which takes a value from a form and
> writes it
> to a file. However, i don't have the mode permission for the file instead
> it
> is owned
> by www-data.What can i do to ensure that the file is owned by me.
>
>
> drwxr-xr-x 2 www-data www-data 4096 2011-01-17 22:01 18757170111.0
> -rw-r--r-- 1 www-data www-data   40 2011-01-17 23:39 32238.hydro
>
> Thanks.
>
>
>


Re: [PHP] [PHP]: permission problem www-data

2011-01-18 Thread a...@ashleysheridan.co.uk
you could use the chown method in php, which should do what you need.

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

- Reply message -
From: "Moses" 
Date: Tue, Jan 18, 2011 09:44
Subject: [PHP] [PHP]: permission problem www-data
To: 

Hi Everyone,

I am creating a file in PHP script which takes a value from a form and
writes it
to a file. However, i don't have the mode permission for the file instead it
is owned
by www-data.What can i do to ensure that the file is owned by me.


drwxr-xr-x 2 www-data www-data 4096 2011-01-17 22:01 18757170111.0
-rw-r--r-- 1 www-data www-data   40 2011-01-17 23:39 32238.hydro

Thanks.


[PHP] [PHP]: permission problem www-data

2011-01-18 Thread Moses
Hi Everyone,

I am creating a file in PHP script which takes a value from a form and
writes it
to a file. However, i don't have the mode permission for the file instead it
is owned
by www-data.What can i do to ensure that the file is owned by me.


drwxr-xr-x 2 www-data www-data 4096 2011-01-17 22:01 18757170111.0
-rw-r--r-- 1 www-data www-data   40 2011-01-17 23:39 32238.hydro

Thanks.


RE: [PHP] how to avoid using temporary?

2011-01-18 Thread Tommy Pham
> -Original Message-
> From: I am on the top of the world! Borlange University
> [mailto:michael3832...@gmail.com]
> Sent: Monday, January 17, 2011 11:33 PM
> To: php-general@lists.php.net
> Subject: [PHP] how to avoid using temporary?
> 
> heres my sql query:
> EXPLAIN SELECT t1.szs_guige,SUM(t1.szs_shuliang) FROM szs_ck_ruku_items
> t1,szs_ck_ruku t2 WHERE t1.szs_rukubianhao = t2.szs_rukubianhao AND
> t2.szs_date>'2010-10-23' GROUP BY t1.szs_guige ORDER BY null
> 



This is PHP list.  Not a SQL list/discussion.  Try asking the forum relating
to the DBMS you're using.

Regards,
Tommy


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



[PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-18 Thread WalkinRaven

On 01/08/2011 04:55 PM, WalkinRaven wrote:

PHP 5.3 PCRE

Regular Express to match domain names format according to RFC 1034 -
DOMAIN NAMES - CONCEPTS AND FACILITIES

/^
(
[a-z] |
[a-z] (?:[a-z]|[0-9]) |
[a-z] (?:[a-z]|[0-9]|\-){1,61} (?:[a-z]|[0-9]) ) # One label

(?:\.(?1))*+ # More labels
\.? # Root domain name
$/iDx

This rule matches only  and . but not 

I don't know what wrong with it.

Thank you.


Thank you all, and I think I've found the problem: If you don't use 
'Recursive Reference' feature, all will work well.


Detail:
http://ndss.walkinraven.name/2011/01/bug-related-to-recursive-reference-in.html

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