php-general Digest 7 May 2011 02:42:52 -0000 Issue 7301

Topics (messages 312705 through 312708):

Re: mysql error
        312705 by: Curtis Maurand

Re: Parsing a simple sql string in php
        312706 by: Ashley Sheridan

semaphores are broken
        312707 by: Jeremy Greene

Re: Upload size limit stays at 8MB
        312708 by: Ross Hansen

Administrivia:

To subscribe to the digest, e-mail:
        [email protected]

To unsubscribe from the digest, e-mail:
        [email protected]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---


engine=

--C

Grega Leskov¹ek wrote:
> Can smbd please look  at this sentence - I got an error and do
not
> know how to fix it - I am still very unfamiliar with
MYSQL:
> 
> CREATE TABLE log (  idlog int auto_increment
not null,  imepriimek
> varchar(50),  clock timestamp,  action
varchar(30),  onfile
> varchar(100), filesize float(6,2),
uniqueid(idlog) );
> 
> ERROR 1064 (42000): You have an
error in your SQL syntax; check the
> manual that corresponds to
your MySQL server version for the right
> syntax to use near
'(idlog) )' at line 1
> 
> -- When the sun rises I receive
and when it sets I forgive ->
>
http://moj.skavt.net/gleskovs/
> Always in Heart, Grega
Leskovšek
> 
> --
> PHP General
Mailing List (http://www.php.net/)
> To unsubscribe, visit:
http://www.php.net/unsub.php
> 
>

--- End Message ---
--- Begin Message ---
"Ken Guest" <[email protected]> wrote:

>On Fri, May 6, 2011 at 10:05 AM, Ashley Sheridan
><[email protected]> wrote:
>> Hiya, has anyone had any experience with parsing a string of sql to
>break it down into its component parts? At the moment I'm using several
>regex's to parse a string, which works, but I'm sure there's a more
>elegant solution.
>>
>> The general idea is to produce a nice looking page giving details of
>updated fields and values.
>>
>> I'm only concerned with update statements really, and the queries are
>very simple, operating on one table at a time, with no sub queries or
>selects.
>>
>> Thanks in advance if anyone is able to suggest anything!
>
>I'd suggest at least taking a look at pear's sql parser package -
>using it might save you some headaches ;)
>
>http://pear.php.net/package/SQL_Parser
>
>
>> Thanks
>> Ash
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
>
>--
>http://blogs.linux.ie/kenguest/
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

I had seen this but didn't see much in the way of documentation (i only spent 5 
mins looking though) and I've tended to steer away from pear after warnings 
from this very list!

I solved the issue in the end with regex's. As the queries were generally 
fairly basic, it wasn't too hard to write the expressions for them, and so far 
its working well for my needs. I was just asking here to see if anyone had any 
experience with something, not to see if they could phrase the Google search in 
a different way. Thanks though to all who replied.

Thanks
Ash
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

--- End Message ---
--- Begin Message ---
Ok, I tried to use semaphores between php and C++. Where the php script
was the client and the C++ app was a server.  Client only acquired sems,
server only released.

 

This cannot be done with php semaphores. Got around the first two
problems:

1)      Php  semaphore is actually 3 sysV sems. 

a.       Need to have the C++ program create one with 3 

2)      Php will reset sem 0 - the real sem whenever sem_get() is done.

a.       Sem 1 is a "reference count" - number of procs using it, and
sem 2 is used to lock access to sem 1. 

b.      Ok, so made C++ set sem 1 to 1. Actually since I know it starts
1st I just blindly do that. For some odd reason, it seems that sem 2
also needs to be set to 0... not sure why. The right way would be to
wait till sem 2 is 0, then check if sem 1 > 0. If so, increment it and
do not init sem0. Else, set sem 0 to init value, set sem 1 to 1 and set
sem 2 back to 0.

However, could not get past the problem that php always sets the UNDO
flag. So, when the script exits, the semaphore is reset. That completely
messes up the client/server approach.

 

Another amusing note is that the C code that php uses to implement the
semaphores uses the "wait-for-zero" feature of sysv semaphores. Kind of
funny that it was seen as needed for even that little effort, but not
exposed in php itself J Not to mention all of the other features...

 

So... then. Switch to signals. But to do that correctly, I use a
semaphore. In the signal handler, it releases the semaphore. When
waiting for a signal in the main loop, I do an acquire.

 

Then.... I find out that sem_acquire() actually returns **OK** when the
underlying semop call gets an EINTR!!! Holy cow. How can a "php system"
call loose an error?! That's just crazy.

 

I do find it interesting that it's not discussed more on the list... but
semaphores are kind of silly in php.

 

Jeremy


--- End Message ---
--- Begin Message ---
Apart from the possible security issues with posting content or information i 
don't believe that there is any others for posting large amounts of 
information. Just as long as you are aware that it is all being posted over 
plain text so if you have any sensitive data you may want to look at setting up 
a HTTPS.

otherwise, glad to know that your issues is solved. :)

> Date: Fri, 6 May 2011 10:10:31 -0700
> From: [email protected]
> To: [email protected]
> Subject: Re: [PHP] Upload size limit stays at 8MB
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 05/05/2011 11:52 PM, Ross Hansen wrote:
> > 
> > There is also an option for post_max_size = xM
> > x being the number specified.
> > This should be located in your php.ini file somewhere. check to make sure 
> > that this is set high enough else it could also be causing the issue.
> > 
>   Okay, that was it. Thanks!
>   Are the any security issues with allowing a large POST size?
> 
> - -- 
> James Moe
> moe dot james at sohnen-moe dot com
> 520.743.3936
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.15 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAk3EK4cACgkQzTcr8Prq0ZMB7ACdEhMzHq40Gp8GzFjf+9SAeshc
> NMsAnAhOxVtDDXj7yPSrmh7LjR3UcYlY
> =ariZ
> -----END PGP SIGNATURE-----
                                          

--- End Message ---

Reply via email to