php-general Digest 1 Jun 2013 20:25:12 -0000 Issue 8255

2013-06-01 Thread php-general-digest-help

php-general Digest 1 Jun 2013 20:25:12 - Issue 8255

Topics (messages 321302 through 321309):

Re: Looking for a good working PDO and/or mysqli database class to get started 
with OOP
321302 by: dealTek

Binding object instances to static closures
321303 by: Nathaniel Higgins
321305 by: David Harkness
321306 by: Nathaniel Higgins
321307 by: Nick Whiting
321308 by: David Harkness

Re: mcrypt_create_iv - why so slow?
321304 by: Matt Graham

How to enable cURL php extension on Debian Wheezy?
321309 by: Csanyi Pal

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 May 30, 2013, at 7:30 PM, tamouse mailing lists tamouse.li...@gmail.com 
wrote:

 Sounds like the OP is asking for a pre-built CRUD interface that
 adapts to his tables and their relationships. It's a fair question,
 just one I don't have an answer to. There must be some kind of ORM for
 PHP?




Thanks tamouse - that is what I was trying to ask about...

Thanks Bastien for the suggestions...
Propel? Eloquent? Doctrine?

Do any of the ones  listed below the email seem like a good start?

Q: DOES ANYONE HAVE ANY OPINIONS ON THE ONES BELOW?

- - - - - MySQLi

https://github.com/ajillion/PHP-MySQLi-Database-Class

http://www.phpclasses.org/package/2359-PHP-MySQL-database-wrapper-using-MySQLi-extension.html

http://snipplr.com/view/22992/

Jeffrey Way...
http://forrst.com/posts/Mysqli_Database_Class-hxb

http://www.dotred.be/blog/database-classes-for-mysql-mysqli-and-mssql/

- - - - - PDO

Jeffrey Way - some issues here in comments
http://net.tutsplus.com/tutorials/php/php-database-access-are-you-doing-it-correctly/

http://www.phpclasses.org/package/7533-PHP-Access-SQL-databases-using-PDO.html

http://www.doctrine-project.org/projects/dbal.html

http://pear.php.net/package/MDB2


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]

---End Message---
---BeginMessage---
Is it possible to bind an instance to a static closure, or to create a
non-static closure inside of a static class method?

This is what I mean...


?php
class TestClass {
public static function testMethod() {
$testInstance = new TestClass();
$testClosure = function() use ($testInstance) {
return $this === $testInstance;
};

$bindedTestClosure = $testClosure-bindTo($testInstance);

call_user_func($bindedTestClosure);
// should be true
}
}

TestClass::testMethod();
---End Message---
---BeginMessage---
On Fri, May 31, 2013 at 10:54 AM, Nathaniel Higgins n...@nath.is wrote:

 Is it possible to bind an instance to a static closure, or to create a
 non-static closure inside of a static class method?


PHP doesn't have a method to do this. In JavaScript you can use jQuery's

var func = $.proxy(function () { ... }, object);

In fact, you cannot use $this inside a closure at all (unless 5.4 has added
a way that I haven't seen yet). You can get around that by declaring a
local variable to hold a reference to the instance to use with use. It
looks strange here because you're also passing in $testInstance for the
comparison.

?php
class TestClass {
public static function testMethod() {
$testInstance = new TestClass();
$closure = $testInstance-createClosure($testInstance);

call_user_func($closure);
// should be true
}

private function createClosure($testInstance) {
$self = $this;
return function() use ($self, $testInstance) {
return $self === $testInstance;
}
}
}

TestClass::testMethod();

Peace,
David
---End Message---
---BeginMessage---
I'm talking about PHP 5.4. `bindTo` is a Closure method in PHP 5.4, and
allows you to set the `$this` variable inside of a Closure. However,
apparently you can't use it on Closures created inside static methods.

I knew that you could create another function which would return the
Closure, however, that isn't what I asked. I wanted to either use the
`bindTo` method on a static Closure, or create a non-static Closure in a
static method.


On 31 May 2013 19:25, David Harkness davi...@highgearmedia.com wrote:

 On Fri, May 31, 2013 at 10:54 AM, Nathaniel Higgins n...@nath.is wrote:

 Is it possible to bind an instance to a static closure, or to create a
 non-static closure inside of a static class method?


 PHP doesn't have a method to do this. In JavaScript you can use jQuery's

 var func = $.proxy(function () { ... }, object);

 In fact, you cannot use $this inside a closure at all (unless 5.4 has
 added a way that I haven't 

[PHP] How to enable cURL php extension on Debian Wheezy?

2013-06-01 Thread Csanyi Pal
Hi,

I just upgraded Squeeze to Wheezy, and have difficulties with cURL PHP
extension: I can't enable it.

I have installed following packages related to this issue:
curl, libcurl3, libcurl3-gnutls, php5-curl.

I have in
/etc/php5/mods-available/curl.ini
; configuration for php CURL module
; priority=20
extension=curl.so

I know that cURL extension is not enabled because I want to install
Moodle and it complains about cURL extension.

How can I solve this problem?

-- 
Regards from Pal


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



Re: [PHP] REQUEST

2013-06-01 Thread Last Hacker Always onpoint
very funny how big a novice i can be.


On Wed, May 29, 2013 at 1:48 PM, Stuart Dallas stu...@3ft9.com wrote:

 On 29 May 2013, at 17:26, Last Hacker Always onpoint 
 lasthack...@gmail.com wrote:

  HEY GUYZ I KNOW, I KNOW THIS IS NOT A PLACE FOR SOMETHING LIKE THIS SO
 BUT
  HEY I HAVE A LITTLE TINY QUESTION FOR MY COOL GUYZ.
 
  DOES ANYONE HERE USE A SIMPLY MACHINE FUNCTION SCRIPT? BECAUSE THE
  SCRIPTINGS ARE A LITTLE HARD FOR ME TO UNDERSTAND PLEASE LET ME KNOW
 GUYS I
  WANT SOMEONE TO TEACH ME.

 SIMPLE MACHINES FORUM, not SIMPLY MACHINE FUNCTION. Funny how a couple of
 incorrect words can turn a simple question in to gobbledygook!

 As for your problems with the product, which I'm guessing are legion, try:
 http://support.simplemachines.org/

 -Stuart

 --
 Stuart Dallas
 3ft9 Ltd
 http://3ft9.com/



[PHP] php links doest work when im using mod rewrite

2013-06-01 Thread Farzan Dalaee
i starting to use mod rewrite but all my images or js links doest work
my current query string is:
index.php?r=blogpage=2
i want to change it with this:
/blog/2
this is my .htaccess file
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)$ /framework/?r=$1page=$2 [L]

but none of my js or css cant find

i need a way with php to make urls
thanks


Re: [PHP] How to enable cURL php extension on Debian Wheezy?

2013-06-01 Thread Adam Szewczyk
On Sat, Jun 01, 2013 at 09:41:33PM +0200, Csanyi Pal wrote:
 Hi,
 
 I just upgraded Squeeze to Wheezy, and have difficulties with cURL PHP
 extension: I can't enable it.
 
 I have installed following packages related to this issue:
 curl, libcurl3, libcurl3-gnutls, php5-curl.
 
 I have in
 /etc/php5/mods-available/curl.ini
 ; configuration for php CURL module
 ; priority=20
 extension=curl.so
 
 I know that cURL extension is not enabled because I want to install
 Moodle and it complains about cURL extension.
 
 How can I solve this problem?

Hi,

what error message do you get?

Also, have you restarted apache after installing the extension?

Regards,
A.

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



Re: [PHP] php links doest work when im using mod rewrite

2013-06-01 Thread Julian Wanke

Try to add

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

that should exclude existing files and directories from rewriting...
Am 01.06.2013, 22:39 Uhr, schrieb Farzan Dalaee farzan.dal...@gmail.com:


i starting to use mod rewrite but all my images or js links doest work
my current query string is:
index.php?r=blogpage=2
i want to change it with this:
/blog/2
this is my .htaccess file
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)$ /framework/?r=$1page=$2 [L]

but none of my js or css cant find

i need a way with php to make urls
thanks


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



Re: [PHP] php links doest work when im using mod rewrite

2013-06-01 Thread Farzan Dalaee
thanks for answer but it doesnt work
404 Not Found - http://localhost/framework/blog/files/upload/images/
but my images folder in:

http://localhost/framework/files/upload/images/


On Sun, Jun 2, 2013 at 1:11 AM, Julian Wanke jswp...@gmx.at wrote:

 Try to add

 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d

 that should exclude existing files and directories from rewriting...
 Am 01.06.2013, 22:39 Uhr, schrieb Farzan Dalaee farzan.dal...@gmail.com:


  i starting to use mod rewrite but all my images or js links doest work
 my current query string is:
 index.php?r=blogpage=2
 i want to change it with this:
 /blog/2
 this is my .htaccess file
 RewriteEngine On
 RewriteRule ^([^/]*)/([^/]*)$ /framework/?r=$1page=$2 [L]

 but none of my js or css cant find

 i need a way with php to make urls
 thanks




Re: [PHP] How to enable cURL php extension on Debian Wheezy?

2013-06-01 Thread Adam Szewczyk
On Sat, Jun 01, 2013 at 09:41:33PM +0200, Csanyi Pal wrote:
 Hi,
 
 I just upgraded Squeeze to Wheezy, and have difficulties with cURL PHP
 extension: I can't enable it.
 
 I have installed following packages related to this issue:
 curl, libcurl3, libcurl3-gnutls, php5-curl.
 
 I have in
 /etc/php5/mods-available/curl.ini
 ; configuration for php CURL module
 ; priority=20
 extension=curl.so
 
 I know that cURL extension is not enabled because I want to install
 Moodle and it complains about cURL extension.
 
 How can I solve this problem?

Hi,

what error message do you get?

Also, have you restarted apache after installing the extension?

Regards,
A.

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



[PHP] Re: How to enable cURL php extension on Debian Wheezy?

2013-06-01 Thread Csanyi Pal
Adam Szewczyk adam...@gmail.com writes:

 On Sat, Jun 01, 2013 at 09:41:33PM +0200, Csanyi Pal wrote:
 Hi,
 
 I just upgraded Squeeze to Wheezy, and have difficulties with cURL PHP
 extension: I can't enable it.
 
 I have installed following packages related to this issue:
 curl, libcurl3, libcurl3-gnutls, php5-curl.
 
 I have in
 /etc/php5/mods-available/curl.ini
 ; configuration for php CURL module
 ; priority=20
 extension=curl.so
 
 I know that cURL extension is not enabled because I want to install
 Moodle and it complains about cURL extension.
 
 How can I solve this problem?

 Hi,

 what error message do you get?

 Also, have you restarted apache after installing the extension?

Yes, I have restarted apache after installing the extension.

It is interesting.. that when I switch to English language for
Moodle installation ( on the web interface ), then I get not this error,
but if I switch back to Hungarian language for installation, I get it
again. 

The info.php file with the content of:
?
 phpinfo();
?

should show the enabled cURL extension?

-- 
Regards from Pal


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



Re: [PHP] php links doest work when im using mod rewrite

2013-06-01 Thread Adam Szewczyk
This is more of an apache question.

You can try below url.

http://lmgtfy.com/?q=mod_rewrite+exclude+css

On 1 June 2013 21:39, Farzan Dalaee farzan.dal...@gmail.com wrote:

 i starting to use mod rewrite but all my images or js links doest work
 my current query string is:
 index.php?r=blogpage=2
 i want to change it with this:
 /blog/2
 this is my .htaccess file
 RewriteEngine On
 RewriteRule ^([^/]*)/([^/]*)$ /framework/?r=$1page=$2 [L]

 but none of my js or css cant find

 i need a way with php to make urls
 thanks




-- 
A.


Re: [PHP] php links doest work when im using mod rewrite

2013-06-01 Thread Julian Wanke

localhost means the files are stored on your computer so I can't access them ;)Wait, you are trying to change the image directories? I'm a bit confused.Am 01.06.2013, 22:44 Uhr, schrieb Farzan Dalaee farzan.dal...@gmail.com:thanks for answer but it doesnt work404 Not Found - http://localhost/framework/blog/files/upload/images/
but my images folder in:http://localhost/framework/files/upload/images/
On Sun, Jun 2, 2013 at 1:11 AM, Julian Wanke jswp...@gmx.at wrote:
Try to add

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

that should exclude existing files and directories from rewriting...
Am 01.06.2013, 22:39 Uhr, schrieb Farzan Dalaee farzan.dal...@gmail.com:


i starting to use mod rewrite but all my images or js links doest work
my current query string is:
index.php?r=blogpage=2
i want to change it with this:
/blog/2
this is my .htaccess file
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)$ /framework/?r=$1page=$2 [L]

but none of my js or css cant find

i need a way with php to make urls
thanks


-- Erstellt mit Operas E-Mail-Modul: http://www.opera.com/mail/

Re: [PHP] How to enable cURL php extension on Debian Wheezy?

2013-06-01 Thread Tamara Temple
Csanyi Pal csanyi...@gmail.com wrote:
 I have installed following packages related to this issue:
 curl, libcurl3, libcurl3-gnutls, php5-curl.

All good.

 I have in
 /etc/php5/mods-available/curl.ini
 ; configuration for php CURL module
 ; priority=20
 extension=curl.so

Have you enabled the extension as well? That looks like the standard
set-up, which means that curl.ini is available, but you still have to
enable it. Check in /etc/php5/conf.d to see if there's a symlink in
there, otherwise look through the various bits to see if it's included
somewhere in one of the stock php.ini files.

Here's an example from one of my servers:

tamara@gandimouse /etc/php5$ ll mods-available/
total 4.0K
-rw-r--r-- 1 root root 66 Sep 15  2012 pdo.ini

tamara@gandimouse /etc/php5$ ll conf.d/
total 0
lrwxrwxrwx 1 root root 25 Sep 24  2012 10-pdo.ini - ../mods-available/pdo.ini

If you make changes here, ensure you restart your sever.


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



Re: [PHP] php links doest work when im using mod rewrite

2013-06-01 Thread Tamara Temple

Farzan,

I don't have a direct answer to your question, but I work a lot with a
wiki application called PmWiki that does something very similar to what
you are doing.

Their instructions for using clean urls such as
http://example.com/blog/2 (only in their syntax) can be seen here:

http://www.pmwiki.org/wiki/Cookbook/CleanUrls

I don't know if that will help at all, but I've used it successfully.



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




[PHP] Re: How to enable cURL php extension on Debian Wheezy?

2013-06-01 Thread Csanyi Pal
Tamara Temple tamouse.li...@gmail.com writes:

 Csanyi Pal csanyi...@gmail.com wrote:
 I have installed following packages related to this issue:
 curl, libcurl3, libcurl3-gnutls, php5-curl.

 All good.

 I have in
 /etc/php5/mods-available/curl.ini
 ; configuration for php CURL module
 ; priority=20
 extension=curl.so

 Have you enabled the extension as well? That looks like the standard
 set-up, which means that curl.ini is available, but you still have to
 enable it. Check in /etc/php5/conf.d to see if there's a symlink in
 there, otherwise look through the various bits to see if it's included
 somewhere in one of the stock php.ini files.

Yes, it's enabled, because I have in 
/etc/php5/conf.d/ directory the symbolic link
@20-curl.ini

that is pointing to
- ../mods-available/curl.ini

 If you make changes here, ensure you restart your sever.

I already restarted apache2 after I made changes there.

Still get error message when want to proceed with Moodle installation:
must be installed and enabled

The cURL PHP extension is now required by Moodle, in order to
communicate with Moodle repositories.

and it is not OK, the Moodle installation procedure can't find the cURL
extension. Why?

-- 
Regards from Pal


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



Re: [PHP] URL Rewriting

2013-06-01 Thread Tamara Temple
Silvio Siefke li...@silvio-siefke.de wrote:
 On Wed, 22 Jun 2011 17:50:49 -0400 Daniel P. Brown wrote:
   Has someone a Link with Tutorials or other Information?
  
  Not entirely sure what you're asking here, or how you (or the
  nginx folks) expect it to relate to PHP.  Do you mean that you want to
  use PHP to have theme2.php act as if it was called as theme.php?id=2 ?
 
 I have me write a blog, but my blog has link like blogdetail.html?id=1 or =2
 through 16 at moment. And for google and other Search  Engines not good the
 links, better where i can rewrite to a fix link, and when someone use the
 link, php write to correct url. 

Common SEO mythology is that you need pretty human-understandable
links. (In point of fact, the search engines care not in the least.)
However, human-understandable URLs are a benefit to users when they want
to understand what they're linking to or clicking on.

A human-understandable link is more like:

http://www.example.com/blog/2013-05-a-day-in-the-life-of-my-dog

not:

http://www.example.com/blog/2

as that really does not provide any more information than:

http://www.example.com/blog.php?id=2

Otherwise, Daniel's solution below should do the trick.

 Sorry my english not perfect on earth. 
 
  
  If so, it's not redirect or rewrite, and it's extremely hacky, but
  this is the only real way PHP could achieve the desired result:
  
  ?php
  // dynamictheme.php
  
  if (preg_match('/.*([0-9]+)\.php/Ui',$_SERVER['PHP_SELF'],$match)) {
$_GET['id'] = $match[1];
include dirname(__FILE__).'/theme.php';
  }
  
  ?
  
  Then just symlink dynamictheme.php to your various themes like so:
  
  ln -s dynamictheme.php theme2.php
  ln -s dynamictheme.php theme301.php
  ln -s dynamictheme.php theme18447.php
  







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



Re: [PHP] Re: How to enable cURL php extension on Debian Wheezy?

2013-06-01 Thread Tamara Temple
Csanyi Pal csanyi...@gmail.com wrote:
 It is interesting.. that when I switch to English language for
 Moodle installation ( on the web interface ), then I get not this error,
 but if I switch back to Hungarian language for installation, I get it
 again. 

I am completely unfamiliar with Moodle, have no idea what it is or how
it works with I18n stuff. But, if it works in one language and not the
other, the problem probably isn't with curl, or necessarily with the php
configuration, either.

When you switch to Hungarian, what are the actual errors you are seeing?
Stick the log in a gist or pastebin so it doesn't get mangled by email.

 The info.php file with the content of:
 ?
  phpinfo();
 ?
 
 should show the enabled cURL extension?

I missed this one, somehow.

Yes, exactly, the cURL module should show up on phpinfo() output.


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



[PHP] sorry for the blast from the past

2013-06-01 Thread Tamara Temple


Sorry for replying to a message from 2011 -- for some reason I had a
whole bunch of PHP messages suddenly show up in my inbox from the
past. I generally don't check the year of an unread message in my inbox,
as I try to keep inbox-zero.

Anyway, carry on!


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



Re: [PHP] sorry for the blast from the past

2013-06-01 Thread Daniel
On Sun, Jun 2, 2013 at 11:02 AM, Tamara Temple tamouse.li...@gmail.com wrote:


 Sorry for replying to a message from 2011 -- for some reason I had a
 whole bunch of PHP messages suddenly show up in my inbox from the
 past. I generally don't check the year of an unread message in my inbox,
 as I try to keep inbox-zero.

 Anyway, carry on!


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


It all good, it happens :)

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



Re: [PHP] REQUEST

2013-06-01 Thread musicdev
On Wed, May 29, 2013 at 12:26 PM, Last Hacker Always onpoint 
lasthack...@gmail.com wrote:

 HEY GUYZ I KNOW, I KNOW THIS IS NOT A PLACE FOR SOMETHING LIKE THIS SO BUT
 HEY I HAVE A LITTLE TINY QUESTION FOR MY COOL GUYZ.

 DOES ANYONE HERE USE A SIMPLY MACHINE FUNCTION SCRIPT? BECAUSE THE
 SCRIPTINGS ARE A LITTLE HARD FOR ME TO UNDERSTAND PLEASE LET ME KNOW GUYS I
 WANT SOMEONE TO TEACH ME.


This type of behavior is quite common among people that do not understand
the difference between HELLO and hello.  That aside, what is a simple
machine function?  Further, I always find it surprising that people want
to learn hard to understand concepts without the least bit of research.
Considering how much information is available to any individual
online...I'm even more surprised that questions like this make it into
these lists.

Five words: Read a book! or google!


[PHP] Re: How to enable cURL php extension on Debian Wheezy?

2013-06-01 Thread Csanyi Pal
Tamara Temple tamouse.li...@gmail.com writes:

 Csanyi Pal csanyi...@gmail.com wrote:
 It is interesting.. that when I switch to English language for
 Moodle installation ( on the web interface ), then I get not this
 error, but if I switch back to Hungarian language for installation, I
 get it again. 

 I am completely unfamiliar with Moodle, have no idea what it is or how
 it works with I18n stuff. But, if it works in one language and not the
 other, the problem probably isn't with curl, or necessarily with the
 php configuration, either.

It doesn't work in Englis language either, just at this step of Moodle
installation on the web interface, it doesn't complain for the missing
cURL extension. But, when I proceed with the installation in English
language, I come to the step where it shows up again the missing cURL
extension. 

 When you switch to Hungarian, what are the actual errors you are
 seeing? 
 Stick the log in a gist or pastebin so it doesn't get mangled by
 email. 

I get no error message at this step of Moodle installation, when I use
Hungarian language.

 The info.php file with the content of:
 ?
  phpinfo();
 ?
 
 should show the enabled cURL extension?

 I missed this one, somehow.

 Yes, exactly, the cURL module should show up on phpinfo() output.

Well, the phpinfo() output doesn't show up the cURL module yet.

I have the following directories and files in the 

/etc/php5/ directory:

 /apache2 directory with the content:
   php.ini file
   /conf.d subdirectory with the content:
 gd.ini
 ..
 xcache.ini

 But here I don't have
 curl.ini
 xmlrpc.ini

 and I think that that it should be here curl.ini, xmlrpc.ini

 Why is not here curl.ini?


 /conf.d directory with the content:
   @10-pdo.ini
   @20-curl.ini
   ..
   @20-xmlrpc.ini
   ldap.ini

 /mods-available subdirectory with the files:
   curl.ini
   ..
   xmlrpc.ini

 /cgi directory
 /cli directory


-- 
Regards from Pal


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