php-general Digest 22 Oct 2012 14:06:35 -0000 Issue 8018

2012-10-22 Thread php-general-digest-help

php-general Digest 22 Oct 2012 14:06:35 - Issue 8018

Topics (messages 319544 through 319554):

Re: User Timezone
319544 by: tamouse mailing lists
319545 by: Matijn Woudt
319546 by: Karl DeSaulniers
319548 by: tamouse mailing lists

Free LAPP stack
319547 by: Robert Stone
319549 by: tamouse mailing lists

RAM Disk
319550 by: Alan Hoffmeister
319552 by: Camilo Sperberg
319553 by: СÓãϺ

Table help needed - followup
319551 by: Chris Payne

Recommendation request: Use Magento or build my own eCommerce?
319554 by: Mark

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 Sun, Oct 21, 2012 at 7:30 AM, Matijn Woudt tijn...@gmail.com wrote:
 On Sun, Oct 21, 2012 at 12:01 PM, Maciek Sokolewicz
 maciek.sokolew...@gmail.com wrote:
 On 21-10-2012 01:11, Karl DeSaulniers wrote:

 Thanks for the response. Yes, for the US I plan on calculating by
 state, but
 this website is not geared to just the US.
 So I am looking for a solution that lets me also calculate by
 country/region.
 Was looking on google and found geoip, but not sure if this will do
 the job
 I am looking for.
 Anyone with experience on geoip that can send pointers?

 Thanks,


 Best,
 Karl DeSaulniers
 Design Drumm
 http://designdrumm.com



 Geo IP is based on IP, and I must warn you that IP data is not always
 accurate. Especially here in Europe, companies that are based in
 multiple countries sometimes only register their IPs in a single
 country, and share them between all the countries they are active in.
 This will give you wrong data from GeoIP. The time difference will
 only be 1 hour at max, but still.



 That was what my own suspicions were leading to.
 I am familiar with the fact that ips can be spoofed.
 Thanks for the corroboration.

 Best,

 Karl DeSaulniers
 Design Drumm
 http://designdrumm.com


 As Bart said, IP is not ideal for this situation.

 Since you do have information about the location of that person (as in
 country and possible state), you can find out the timezone via a static
 database.

 The HTML5 geolocation tool is nice, and would certainly help a lot! However,
 be aware of the fact that it only works if there is the device on which the
 browser runs actually has the ability to find out its location. Many
 smartphones have GPS chips, but most PCs don't. Asking a PC where are you
 located? the PC will answer How should I know?.

 Luckily for you, the way of country and state is pretty easy. I've handed
 you a list to find it in the USA. For most countries in the world, there's a
 simple 1:1 mapping of timezone and country
 (http://en.wikipedia.org/wiki/List_of_time_zones_by_country), there are
 however 21 countries which have multiple timezones. In these cases, you'll
 need extra information to be able to distinguish between them.

 For the USA, you already have a way.
 For (ex-)colonical islands and such (such as for France), you could always
 add them to the country list:
 - France
 - France (Marquesas Islands)
 - France (Gambier)
 etc.
 Thus treating them as separate countries for your timezone db.

 In Russia, Canada, Australia, New Zealand, Brasil, Indonesia, Kiribati,
 Mexico,Congo, Ecuador, Micronesia, Kazakhstan and Mongolia you'll need to
 know their province / state to more accurately assess the ideal timezone.

 So for most countries, it's a simple 1:1 translation. For the above
 countries, you'll need some extra info, and translate further based on that.
 You should be able to find the info required yourself, it just takes a while
 to collect it.

 Alternatively, and this is the most simple way; since you're asking people
 for their country and such, simply also ask them about their timezone. Don't
 bother automating and putting a heck of a lot of time into hard to realize
 solutions, when you can ask a very simple and easy-to-answer question to the
 browser instead. :)

 - Tul


 Don't forget that some countries have DST, and some don't. And those
 that have DST, all use different dates.. So in to keep a static
 database you would also need to have DST info from all countries.

 - Matijn

Using the standard labels in /usr/share/zoneinfo should be able to
avoid having to keep track of who is and isn't in DST, *provided* you
find a way to map the user's address to one of those files.
---End Message---
---BeginMessage---
On Sun, Oct 21, 2012 at 1:12 PM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:
 Don't most browsers include this information in the HTTP headers?

Nope, you're probably confused with servers that return their time and date.

- Matijn
---End Message---
---BeginMessage---


On Oct 21, 2012, at 5:11 PM, 

Re: [PHP] RAM Disk

2012-10-22 Thread Camilo Sperberg

On 22 okt. 2012, at 04:45, Alan Hoffmeister alanhoffmeis...@gmail.com wrote:

 Hello fellows.
 Have anyone already tested PHP inside RAM disk with some Apache/nginx
 accessing those files or even session files?
 It's just for curiosity and performance analysis.
 
 Thanks.
 
 
 -- 
 --
 Att,
 Alan Hoffmeister

I have not tested it but I think it wouldn't be much difference respecting APC 
for example, maybe a tiny little bit faster reading sessions and other file 
stuff because RAM have really small access times, but database connections and 
stuff would still be your main bottleneck (I'm assuming you do).

I would install APC and set /tmp up into a RAM disc, mainly because not only do 
MySQL write temporary files into /tmp (example: if MySQL decides to create a 
temporary table which would be with almost any grouping you do), also apache 
does and, if you haven't setted up the session routes, sessions will also write 
itself to /tmp. Plus, if your machine happens to suddenly reboot, you won't 
lose any important stuff.

Getting /var/log/ into an SSD or RAM disk should help too, but again: if 
reliability is important to you, I wouldn't do that. 

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



Re: [PHP] RAM Disk

2012-10-22 Thread ??????
I have use RAM DISK in IIS7.5 and MYSQL. 


PHP and MYSQL working in RAM DISK.  faster... 


-- Original --
From:  Camilo Sperbergunrea...@gmail.com;
Date:  Mon, Oct 22, 2012 04:47 PM
To:  Alan Hoffmeisteralanhoffmeis...@gmail.com; 
Cc:  php-generalphp-general@lists.php.net; 
Subject:  Re: [PHP] RAM Disk




On 22 okt. 2012, at 04:45, Alan Hoffmeister alanhoffmeis...@gmail.com wrote:

 Hello fellows.
 Have anyone already tested PHP inside RAM disk with some Apache/nginx
 accessing those files or even session files?
 It's just for curiosity and performance analysis.
 
 Thanks.
 
 
 -- 
 --
 Att,
 Alan Hoffmeister

I have not tested it but I think it wouldn't be much difference respecting APC 
for example, maybe a tiny little bit faster reading sessions and other file 
stuff because RAM have really small access times, but database connections and 
stuff would still be your main bottleneck (I'm assuming you do).

I would install APC and set /tmp up into a RAM disc, mainly because not only do 
MySQL write temporary files into /tmp (example: if MySQL decides to create a 
temporary table which would be with almost any grouping you do), also apache 
does and, if you haven't setted up the session routes, sessions will also write 
itself to /tmp. Plus, if your machine happens to suddenly reboot, you won't 
lose any important stuff.

Getting /var/log/ into an SSD or RAM disk should help too, but again: if 
reliability is important to you, I wouldn't do that. 

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

[PHP] Recommendation request: Use Magento or build my own eCommerce?

2012-10-22 Thread Mark
Hi,

I'm in a difficult situation here. I have a list of requirements for an
eCommerce system (Magento) where i'm getting mixed opinions about what to
do. Note: i do consider myself to be a quite experienced PHP programmer and
certainly have the skills to either make the extensions or make everything
from scratch. Both do require month of work! First - for the complete
picture - the list of requirements for the eCommerce system:
- (buld into magento) Multishop has to be possible
- Different payment modules have to be possible (buckaroo, afterpay, ...)
- Online chat (with for example zopim) has to be possible
- Advanced product permissions (magento only has manage not more specific
as in edit)
- Setting pruduct margins
- Abandoned cart alerts
- One page checkout
- Some javascript/ajax things like instant cart
- A very specific order page (the Booking and Reservations plugin can do
that)

Thus far it's all oke. However, if i go to the magento irc channel i'm
getting really mixed opinions about what to use and what to create myself.
They basically say that i should prevent installing as much extensions as
possible and try to make most of the things myself. This is where i'm
getting really confused.

There are two possible routes to take here.
1. I can go for the magento route and just take the very steep learning
curve it has. It will be a slow process to make the modules required
(mainly the advanced permissions, setting product margins and a abandoned
cart extension). Two of those three are very difficult to make. Certainly
if you consider that i'm just starting developing in any eCommerce system.

2. Considering the steep learning curve of making extensions for Magento it
might be easier - in the long run - to build it all myself. In the
beginning that will be an even slower process then using Magento, but once
the structure is build it will be a much faster development process for any
extension.

I know it's usually a bad thing to reinvent the wheel and i am certainly
not intending that. However, right now i really get the impression that i'm
better of making it all myself. Both approaches take many months of
development where the self made version is going to pay off in development
time in the long run when compared to magento. I am just not sure what the
best solution might be.

So here is a list of pros and cons that i can think of for both approaches.

Pros/Cons for using magento
- [pro] a lot of existing extensions
- [pro] i don't need to worry about security updates since the come from
magento
- [pro] living community around it to help out if there are any issues
- [con] very steep learning curve
- [con] not straightforward to start developing in
- [con] takes a lot of time till you can even use the basics

Pros/Cons for self made
- [pro] Development will go a lot faster
- [pro] i can make it more specific for one goal
- [pro] a much easier extension model
- [con] security all depends on me
- [con] i have to make complicated extensions like buckaroo and afterpay
myself
- [con] no existing library of extensions to use

Again, i'm puzzled by this. If i follow the #magento (on freenode) list
then i should pick magento, but make every extension myself or only use the
really good ones. Thus that will require a lot of time to develop them. I
'm guessing about half a year. Then again, if i make it all from the ground
up it's probably also going to take half a year to develop (or slightly
more) but it will obviously be much easier to maintain since i know every
single line of it.

What is your recommendation? Build it myself? Use Magento? or another
option that i didn't even consider yet?

Kind regards,
Mark


Re: [PHP] Recommendation request: Use Magento or build my own eCommerce?

2012-10-22 Thread Marc Guay
Use Magento.  It will take you more than 6 months to build what you're
talking about all by yourself.  Magento is a pain to learn at first
but once you get into it things start to make sense and development
speeds up.

Marc

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



[PHP] Re: Recommendation request: Use Magento or build my own eCommerce?

2012-10-22 Thread Mark
On Mon, Oct 22, 2012 at 4:06 PM, Mark mark...@gmail.com wrote:

 Hi,

 I'm in a difficult situation here. I have a list of requirements for an 
 eCommerce system (Magento) where i'm getting mixed opinions about what to do. 
 Note: i do consider myself to be a quite experienced PHP programmer and 
 certainly have the skills to either make the extensions or make everything 
 from scratch. Both do require month of work! First - for the complete picture 
 - the list of requirements for the eCommerce system:
 - (buld into magento) Multishop has to be possible
 - Different payment modules have to be possible (buckaroo, afterpay, ...)
 - Online chat (with for example zopim) has to be possible
 - Advanced product permissions (magento only has manage not more specific 
 as in edit)
 - Setting pruduct margins
 - Abandoned cart alerts
 - One page checkout
 - Some javascript/ajax things like instant cart
 - A very specific order page (the Booking and Reservations plugin can do 
 that)

 Thus far it's all oke. However, if i go to the magento irc channel i'm 
 getting really mixed opinions about what to use and what to create myself. 
 They basically say that i should prevent installing as much extensions as 
 possible and try to make most of the things myself. This is where i'm getting 
 really confused.

 There are two possible routes to take here.
 1. I can go for the magento route and just take the very steep learning curve 
 it has. It will be a slow process to make the modules required (mainly the 
 advanced permissions, setting product margins and a abandoned cart 
 extension). Two of those three are very difficult to make. Certainly if you 
 consider that i'm just starting developing in any eCommerce system.

 2. Considering the steep learning curve of making extensions for Magento it 
 might be easier - in the long run - to build it all myself. In the beginning 
 that will be an even slower process then using Magento, but once the 
 structure is build it will be a much faster development process for any 
 extension.

 I know it's usually a bad thing to reinvent the wheel and i am certainly not 
 intending that. However, right now i really get the impression that i'm 
 better of making it all myself. Both approaches take many months of 
 development where the self made version is going to pay off in development 
 time in the long run when compared to magento. I am just not sure what the 
 best solution might be.

 So here is a list of pros and cons that i can think of for both approaches.

 Pros/Cons for using magento
 - [pro] a lot of existing extensions
 - [pro] i don't need to worry about security updates since the come from 
 magento
 - [pro] living community around it to help out if there are any issues
 - [con] very steep learning curve
 - [con] not straightforward to start developing in
 - [con] takes a lot of time till you can even use the basics

 Pros/Cons for self made
 - [pro] Development will go a lot faster
 - [pro] i can make it more specific for one goal
 - [pro] a much easier extension model
 - [con] security all depends on me
 - [con] i have to make complicated extensions like buckaroo and afterpay 
 myself
 - [con] no existing library of extensions to use

 Again, i'm puzzled by this. If i follow the #magento (on freenode) list then 
 i should pick magento, but make every extension myself or only use the really 
 good ones. Thus that will require a lot of time to develop them. I 'm 
 guessing about half a year. Then again, if i make it all from the ground up 
 it's probably also going to take half a year to develop (or slightly more) 
 but it will obviously be much easier to maintain since i know every single 
 line of it.

 What is your recommendation? Build it myself? Use Magento? or another option 
 that i didn't even consider yet?

 Kind regards,
 Mark

Something i made up just now. Would it work if i make the ecommerce
system myself and build OpenCart support in it so that OpenCart
extensions can be installed in my oscommerce as well? Since then i
wouldn't have to bother about payment modules.

Though it does add a very complex translation layer from my to be
build oscommerce to the OpenCart system...

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



Re: [PHP] Re: Recommendation request: Use Magento or build my own eCommerce?

2012-10-22 Thread Mark
On Mon, Oct 22, 2012 at 4:51 PM, Marc Guay marc.g...@gmail.com wrote:
 Why not just use the entire OpenCart package?

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


Well, i was basing my choice of Magento on the internet opinion and
magento seems the most popular system out there to use with most of
the required extensions already there. OpenCart doesn't seem to be as
recommended as Magento..

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



Re: [PHP] Missing email

2012-10-22 Thread Gerardo Benitez
Hi Daniel,

I think that the robot that manage the list is not sending you your own
emails.

Gerardo.

On Sat, Oct 20, 2012 at 10:38 AM, Daniel Brown danbr...@php.net wrote:

 On Sat, Oct 20, 2012 at 5:00 AM, Karl DeSaulniers k...@designdrumm.com
 wrote:
  @Moderator
  Any reason why my emails do not post or at least dont post for hours
 later?

 There is no moderator on this list.  I'm probably about as close
 as it comes.  Can you explain more about the problems you're
 experiencing so that I can look into it further?

 --
 /Daniel P. Brown
 Network Infrastructure Manager
 http://www.php.net/

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




-- 
Gerardo Benitez
-
Programador Web Freelance


Re: [PHP] Wrong time being displayed by PHP!

2012-10-22 Thread Richard S. Crawford
On Thu, Oct 18, 2012 at 2:12 AM, Ford, Mike m.f...@leedsmet.ac.uk wrote:

  From: underp...@gmail.com [mailto:underp...@gmail.com] On Behalf Of
  Richard S. Crawford
  Sent: 17 October 2012 19:29
  To: PHP-General
 
  You can see the current output of the above code here:
 
  http://projectbench.extensiondlc.net

 Can I ask what the fix for this was? Because that URL is currently
 showing the following for me:

 02:09:27 am America/Los_Angeles
 America/Los_Angeles
 Thu, 18 Oct 2012 02:09:27 -0700
 Thu, 18 Oct 2012 09:09:27 +
 1350551367 (-25200)
 Thu Oct 18 02:09:27 PDT 2012


 Cheers!

 Mike


Hi Mike,

Sorry I took so long to answer. I've been out sick, and didn't have access
to the resolution information until this morning.

The server administrators wound up reinstalling the tzdata package and
enabled time synchronization.



-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)


Re: [PHP] Missing email

2012-10-22 Thread Karl DeSaulniers

Strange, it did when I signed up and for a number of years after.


On Oct 22, 2012, at 10:09 AM, Gerardo Benitez wrote:


Hi Daniel,

I think that the robot that manage the list is not sending you your  
own emails.


Gerardo.

On Sat, Oct 20, 2012 at 10:38 AM, Daniel Brown danbr...@php.net  
wrote:
On Sat, Oct 20, 2012 at 5:00 AM, Karl DeSaulniers k...@designdrumm.com 
 wrote:

 @Moderator
 Any reason why my emails do not post or at least dont post for  
hours later?


There is no moderator on this list.  I'm probably about as close
as it comes.  Can you explain more about the problems you're
experiencing so that I can look into it further?

--
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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




--
Gerardo Benitez
-
Programador Web Freelance



Karl DeSaulniers
Design Drumm
http://designdrumm.com



[PHP] PDO

2012-10-22 Thread Silvio Siefke
Hello,

i have built php 5.4.7 on Ubuntu with the configure Arguments like on my 
Gentoo System. But on Gentoo run the website without Problems, under Ubuntu
want not work. I become in error.log:

[22-Oct-2012 21:15:00 UTC] PHP Fatal error:  Call to a member function 
prepare() on a non-object in html/index.html on line 23

U use PHP FPM with Nginx. 

The configure Arguments:
http://pastebin.geany.org/qz8TP/

The Script which work:
?php
require_once (db.php);

$query = $db-prepare(SELECT id, title, date FROM bloggen ORDER BY date DESC 
LIMIT 0,5);
if (!$query) {die(Execute query error, because:  . $db-errorInfo());}

$query-execute();

while ($row = $query-fetch(PDO::FETCH_ASSOC)) {
echo pa href=\/blog/post.html?id=.$row['id'].\ 
title=\.(htmlentities($row['title'], ENT_QUOTES, 
UTF-8)).\.(htmlentities($row['title'], ENT_QUOTES, UTF-8))./a/p\n;
}

$row = null;
$query = null;
$db = null;
?


Has someone a idea what is there wrong?


Thanks for help and nice Day.

Silvio

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



Re: [PHP] PDO

2012-10-22 Thread Nathan Nobbe
On Mon, Oct 22, 2012 at 3:27 PM, Silvio Siefke siefke_lis...@web.de wrote:

 Hello,

 i have built php 5.4.7 on Ubuntu with the configure Arguments like on my
 Gentoo System. But on Gentoo run the website without Problems, under Ubuntu
 want not work. I become in error.log:

 [22-Oct-2012 21:15:00 UTC] PHP Fatal error:  Call to a member function
 prepare() on a non-object in html/index.html on line 23

 U use PHP FPM with Nginx.

 The configure Arguments:
 http://pastebin.geany.org/qz8TP/

 The Script which work:
 ?php
 require_once (db.php);

 $query = $db-prepare(SELECT id, title, date FROM bloggen ORDER BY date
 DESC LIMIT 0,5);
 if (!$query) {die(Execute query error, because:  . $db-errorInfo());}


That looks like you've not connected to the database successfully inside of
db.php.

-nathan


Re: [PHP] PDO

2012-10-22 Thread Ashley Sheridan
On Mon, 2012-10-22 at 23:27 +0200, Silvio Siefke wrote:

 Hello,
 
 i have built php 5.4.7 on Ubuntu with the configure Arguments like on my 
 Gentoo System. But on Gentoo run the website without Problems, under Ubuntu
 want not work. I become in error.log:
 
 [22-Oct-2012 21:15:00 UTC] PHP Fatal error:  Call to a member function 
 prepare() on a non-object in html/index.html on line 23
 
 U use PHP FPM with Nginx. 
 
 The configure Arguments:
 http://pastebin.geany.org/qz8TP/
 
 The Script which work:
 ?php
 require_once (db.php);
 
 $query = $db-prepare(SELECT id, title, date FROM bloggen ORDER BY date DESC 
 LIMIT 0,5);
 if (!$query) {die(Execute query error, because:  . $db-errorInfo());}
 
 $query-execute();
 
 while ($row = $query-fetch(PDO::FETCH_ASSOC)) {
 echo pa href=\/blog/post.html?id=.$row['id'].\ 
 title=\.(htmlentities($row['title'], ENT_QUOTES, 
 UTF-8)).\.(htmlentities($row['title'], ENT_QUOTES, 
 UTF-8))./a/p\n;
 }
 
 $row = null;
 $query = null;
 $db = null;
 ?
 
 
 Has someone a idea what is there wrong?
 
 
 Thanks for help and nice Day.
 
 Silvio
 


It's a bit odd that you're parsing all .html files as if they were PHP
(little bit of a waste, and does mean you'll have an extra step when
configuring a server to run the code)

That aside, I don't see 23 lines of code in your example, so I'm
assuming you've snipped a lot of the beginning (you've not mentioned in
particular which line in your excerpt is the 23rd). What's in your
db.php include? Are there any checks on whether a connection has been
established or not there?
-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] PDO

2012-10-22 Thread Adam Richardson
On Mon, Oct 22, 2012 at 5:27 PM, Silvio Siefke siefke_lis...@web.de wrote:
 Hello,

 i have built php 5.4.7 on Ubuntu with the configure Arguments like on my
 Gentoo System. But on Gentoo run the website without Problems, under Ubuntu
 want not work. I become in error.log:

 [22-Oct-2012 21:15:00 UTC] PHP Fatal error:  Call to a member function
 prepare() on a non-object in html/index.html on line 23


Can you show the code in db.php (just remember to remove any login
credentials)? It looks like there's an issue creating the $db object
you're using.

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] PDO

2012-10-22 Thread Silvio Siefke
Hello,


i found the mistake, i have forgetten write the new path for the sqlite 
database.


Thx
Silvio

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



Re: [PHP] PDO

2012-10-22 Thread Lester Caine

Silvio Siefke wrote:

i found the mistake, i have forgetten write the new path for the sqlite
database.


Just been caught with a similar problem. Had moved a working site from windows 
to linux and it stopped serving up the swf files. Turns out the file has a 
hardcoded path with upper and lower case name, while the xml file was all lower 
case. Rename the folder with the right cases and it started working again :)


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

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