php-general Digest 27 Aug 2010 03:44:24 -0000 Issue 6912
Topics (messages 307701 through 307714):
Re: Web application architecture (subdomain vs. sub directory)
307701 by: tedd
307709 by: Tim Martens
Upload using FTP commands
307702 by: Matthew Croud
307704 by: Dan McCullough
307705 by: João Cândido de Souza Neto
307706 by: Ashley Sheridan
307710 by: Adam Richardson
pecl/oauth - possible to send HTTP request myself?
307703 by: Marc Abramowitz
Re: tutorial failure
307707 by: e-letter
307708 by: Ashley Sheridan
Making multiple RSS feeds for the blog website
307711 by: Andre Polykanine
307712 by: Michelle Konzack
307713 by: Daevid Vincent
Re: Does array_splice() fit for case ?
307714 by: viraj
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 ---
At 9:58 AM -0400 8/26/10, Bob McConnell wrote:
From: tedd
>
4. Host? Roll the dice like the rest of us.
Before you can select a hosting provider, define what you want. Are you
looking for a cage with power and network connections, a VM that you can
load up and manage, or a fully managed server environment? UPS or
generator? What about backup and failover? Do you need redundant network
connections? There is a wide range of options here that are not easy to
evaluate. We have used a variety of different hosts through the years as
our needs and requirements changed. Our current one is fully managed,
guarantees PCI compliance and is very expensive. But it is still less
than the FTE we would have to hire to do it all ourselves. We have more
than 100 client sites on that cluster of servers.
Depending on your size, it may be worth considering hiring a consultant
to walk you through this process the first time. It could save you a lot
of mistakes, time and money.
Bob McConnell
Which I am sure is good advice.
Cheers,
tedd
--
-------
http://sperling.com/
--- End Message ---
--- Begin Message ---
Thank you everyone for your generous feedback. It's given me a lot to think
about. I now realize that my question has as much to do with DNS and Apache
as with PHP. As we clarify the functionality and essence of the app, I'll
post again with more focussed questions.
Based on advice here and elsewhere, I think we're tending toward a an "no
framework" MVC approach and sub-directory model to get started. As Per so
elegantly stated "The subdirectory approach is easily rewritten to an
internal subdomain
structure." So if we need to pivot to a subdomain model we can do so.
Tim
--- End Message ---
--- Begin Message ---
Hi,
I want to give my client the ability to upload large files ( around
20MB ) to a webspace.
I reckon that using the FTP commands of PHP would be the best bet, but
is it possible to allow them to do this through an online form.
This is my vision: the client logs in to a form that has an upload
button, and the upload button uses the FTP commands to upload the file.
Is that do-able in PHP ?
Cheers!
--- End Message ---
--- Begin Message ---
Take a look here:
http://us.php.net/manual/en/ref.ftp.php
You might have some issues with the memory limit in PHP so that might have
to be boosted for 20MB files.
On Thu, Aug 26, 2010 at 12:24 PM, Matthew Croud <[email protected]>wrote:
>
> Hi,
>
> I want to give my client the ability to upload large files ( around 20MB )
> to a webspace.
> I reckon that using the FTP commands of PHP would be the best bet, but is
> it possible to allow them to do this through an online form.
>
> This is my vision: the client logs in to a form that has an upload button,
> and the upload button uses the FTP commands to upload the file.
>
> Is that do-able in PHP ?
>
> Cheers!
>
>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
A form sendind a file has nothing to do with FTP functions of PHP.
You´ll still need to change de upload_max_filesize and so on in order to
send such files to the server.
--
João Cândido de Souza Neto
"Matthew Croud" <[email protected]> escreveu na mensagem
news:[email protected]...
>
> Hi,
>
> I want to give my client the ability to upload large files ( around
> 20MB ) to a webspace.
> I reckon that using the FTP commands of PHP would be the best bet, but is
> it possible to allow them to do this through an online form.
>
> This is my vision: the client logs in to a form that has an upload
> button, and the upload button uses the FTP commands to upload the file.
>
> Is that do-able in PHP ?
>
> Cheers!
>
>
>
>
>
>
--- End Message ---
--- Begin Message ---
On Thu, 2010-08-26 at 17:24 +0100, Matthew Croud wrote:
> Hi,
>
> I want to give my client the ability to upload large files ( around
> 20MB ) to a webspace.
> I reckon that using the FTP commands of PHP would be the best bet, but
> is it possible to allow them to do this through an online form.
>
> This is my vision: the client logs in to a form that has an upload
> button, and the upload button uses the FTP commands to upload the file.
>
> Is that do-able in PHP ?
>
> Cheers!
>
>
>
>
>
>
>
What would be the point?
You would have to set up your server to allow large files to be uploaded
in order for them to be used by PHP, and by that time, unless you're
putting them onto a remote server, there's no point in using the FTP
functions of PHP. What I've found quite reliable is to use PHP to create
FTP user accounts, which they can then log in to and upload files as
they need.
HTTP was not really intended for uploading large files, but FTP is, and
every OS has some form of FTP software built in that can be used very
easily.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
On Thu, Aug 26, 2010 at 12:37 PM, Ashley Sheridan
<[email protected]>wrote:
> On Thu, 2010-08-26 at 17:24 +0100, Matthew Croud wrote:
>
> > Hi,
> >
> > I want to give my client the ability to upload large files ( around
> > 20MB ) to a webspace.
> > I reckon that using the FTP commands of PHP would be the best bet, but
> > is it possible to allow them to do this through an online form.
> >
> > This is my vision: the client logs in to a form that has an upload
> > button, and the upload button uses the FTP commands to upload the file.
> >
> > Is that do-able in PHP ?
> >
> > Cheers!
> >
> >
> >
> >
> >
> >
> >
>
> What would be the point?
>
> You would have to set up your server to allow large files to be uploaded
> in order for them to be used by PHP, and by that time, unless you're
> putting them onto a remote server, there's no point in using the FTP
> functions of PHP.
>
Ashley makes a nice point. When I have control over the server, I don't use
PHP's FTP capabilities at all. However, on some shared severs you're only
HTTP upload options are to set a directory to 777 (Yikes!), or do some work
with PHP's FTP functions.
What I've done in the past on shared hosts is setup an upload FTP account
that has access to one directory. Then, I develop a form to upload the
file. Once a file is uploaded, I use PHP's FTP functions to place the file
in the directory. This way I avoid the security issues of 777, maintain an
easy-to-use interface (some clients don't want to use FTP), and continue to
use the hosting the client prefers. There is a cost to this method, but
sometimes it's worth the cost.
Just another way of doing things.
Adam
--
Nephtali: PHP web framework that functions beautifully
http://nephtaliproject.com
--- End Message ---
--- Begin Message ---
The typical way to use pecl/oauth seems to use OAuth::fetch which does
everything including sending the HTTP request using curl or php streams.
I'd like to be able to use pecl/oauth to do everything up to and including
calculating the signature but then send the request using different code. The
reason for this is that I am using a web framework (internal) that can
aggregate requests using curl_multi and do them asynchronously (Rasmus surely
knows what I'm referring to :-)). I imagine this could be useful also for
others who need to make their requests go through proxies.
I know that I can call oauth_get_sbs to get the sbs which is probably the most
error-prone part of doing OAuth so that's good. But is it possible to take it a
step further and get pecl/oauth to return the curl handle it would've used
(with OAuth stuff already stuffed in the url or request headers) without
executing it?
Basically I want to decouple OAuth signature calculation from network
communication. Possible?
-Marc
http://marc-abramowitz.com
Sent from my iPhone 3G
--- End Message ---
--- Begin Message ---
On 20/08/2010, Ashley Sheridan <[email protected]> wrote:
> You don't have to reinstall the entire OS, that's a very Windows
> approach to the problem. I played around a bit last night with urpmi and
> you should be able to just list the packages you need with urpmq --fuzzy
> package_name, and then install the ones listed you think you need. I did
> notice that urpmi doesn't install the DB when you install the Apache mod
> for that DB, so you might need to install that separately, but other
> than that, you should be good to go if you install the Apache php mod.
>
>
True with respect to the windoze mentality but I had other reasons to
reformat the pc so this was a good opportunity.
The resultant web page is:
Hi, I am a PHP script
this is a test
However, the manual page implies to me that the web page should have
shown the html code, i.e.
<html>
<head>
<title>php test
</title
</head>
<body>
<p>Hi, I am a PHP script</p>
<p>this is a test</p>
</body>
</html>
The source code of the web page:
<html>
<head>
<title>php test
</title
</head>
<body>
<p>Hi, I am a PHP script</p><p>
this is a test
</p>
</body>
</html>
Is this an error with the explanation of the manual or is the
apache-php configuration still at fault?
--- End Message ---
--- Begin Message ---
On Thu, 2010-08-26 at 17:45 +0100, e-letter wrote:
> On 20/08/2010, Ashley Sheridan <[email protected]> wrote:
> > You don't have to reinstall the entire OS, that's a very Windows
> > approach to the problem. I played around a bit last night with urpmi and
> > you should be able to just list the packages you need with urpmq --fuzzy
> > package_name, and then install the ones listed you think you need. I did
> > notice that urpmi doesn't install the DB when you install the Apache mod
> > for that DB, so you might need to install that separately, but other
> > than that, you should be good to go if you install the Apache php mod.
> >
> >
> True with respect to the windoze mentality but I had other reasons to
> reformat the pc so this was a good opportunity.
>
> The resultant web page is:
>
> Hi, I am a PHP script
>
> this is a test
>
> However, the manual page implies to me that the web page should have
> shown the html code, i.e.
>
> <html>
> <head>
> <title>php test
> </title
> </head>
> <body>
> <p>Hi, I am a PHP script</p>
> <p>this is a test</p>
> </body>
> </html>
>
> The source code of the web page:
>
> <html>
> <head>
> <title>php test
> </title
> </head>
> <body>
> <p>Hi, I am a PHP script</p><p>
> this is a test
> </p>
> </body>
> </html>
>
> Is this an error with the explanation of the manual or is the
> apache-php configuration still at fault?
>
The manual page says that the output is the HTML code, which is exactly
what you're getting. Your browser is responsible for interpreting those
tags, based on the mime header that it receives from PHP (which is
text/html by default) You should only ever need to change this header
when you are outputting some other type of content, like XML, an image,
etc.
If you change your PHP script and add this line before you output any
content you will see the tags as your browser will interpret them as
plain text (Internet Explorer may screw this up, as it tends to ignore
header mime types more often than not):
header("Content-type: text/plain");
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
Hi everyone,
We are developing a blog service website.
What we need now is the ability to make multiple RSS feeds from
several pages (an RSS of each user's blog, a feed from each timeline -
timelines are our representation of users' favorites; a feed filled
with comments to a separate entry, etc.). What would be great is the
following: a user enters, say, in my blog and sees the mark that there
are RSS feeds. Then he/she clicks the mark or presses a keystroke
(Alt+J in IE8, for instance), finds the feed and double-clicks on it.
Then he/she can either read the feed or subscribe to it. The feeds
have usually file extensions of .rss or .xml.
Question: how do we do that with PHP?
Thanks!
--
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion
--- End Message ---
--- Begin Message ---
Hello Andre Polykanine,
Am 2010-08-27 02:52:48, hacktest Du folgendes herunter:
> Hi everyone,
> We are developing a blog service website.
Very interesting ;-)
> Question: how do we do that with PHP?
By reading the Documentation... :-D
<html>
<head>
<title>Blubber Blog</title>
<link rel="alternate" type="application/rss+xml" title="RSS" href="index.rss"
/>
<link rel="alternate" type="application/rss+xml" title="Foo" href="foo.rss" />
<link rel="alternate" type="application/rss+xml" title="Bar" href="bar.rss" />
</head>
<body>
Thanks, Greetings and nice Day/Evening
Michelle Konzack
--
##################### Debian GNU/Linux Consultant ######################
Development of Intranet and Embedded Systems with Debian GNU/Linux
itsyst...@tdnet France EURL itsyst...@tdnet UG (limited liability)
Owner Michelle Konzack Owner Michelle Konzack
Apt. 917 (homeoffice)
50, rue de Soultz Kinzigstraße 17
67100 Strasbourg/France 77694 Kehl/Germany
Tel: +33-6-61925193 mobil Tel: +49-177-9351947 mobil
Tel: +33-9-52705884 fix
<http://www.itsystems.tamay-dogan.net/> <http://www.flexray4linux.org/>
<http://www.debian.tamay-dogan.net/> <http://www.can4linux.org/>
Jabber [email protected]
ICQ #328449886
Linux-User #280138 with the Linux Counter, http://counter.li.org/
signature.pgp
Description: Digital signature
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Andre Polykanine [mailto:[email protected]]
> Sent: Thursday, August 26, 2010 4:53 PM
> To: php-general
> Subject: [PHP] Making multiple RSS feeds for the blog website
>
> Hi everyone,
> We are developing a blog service website.
> What we need now is the ability to make multiple RSS feeds from
> several pages (an RSS of each user's blog, a feed from each timeline -
> timelines are our representation of users' favorites; a feed filled
> with comments to a separate entry, etc.). What would be great is the
> following: a user enters, say, in my blog and sees the mark that there
> are RSS feeds. Then he/she clicks the mark or presses a keystroke
> (Alt+J in IE8, for instance), finds the feed and double-clicks on it.
> Then he/she can either read the feed or subscribe to it. The feeds
> have usually file extensions of .rss or .xml.
> Question: how do we do that with PHP?
> Thanks!
>
>
>
> --
> With best regards from Ukraine,
> Andre
> Skype: Francophile
> Twitter: http://twitter.com/m_elensule
> Facebook: http://facebook.com/menelion
In otherwords, to paraphrase:
<DBAG_MODE>
"We have this super cool new idea that's going to revolutionize the web and
blogs and cloud computing and we might even create our own new buzzword. We
heard you can do this with PHP. We just don't have any code written, so
could you guys write it for us. That'd be swell. kthxbye."
;-)
Dude. Andre. Let me break it down like a fraction, as to how this list
works.
YOU post some code that you are struggling with, or you post some SPECIFIC
question, and the generous subscribers to this list decide if your question
is worthy of their time to reply.
Your "question" (for lack of a better term) was devoid of either of those
things.
Now, had you said, "How can I formulate an RSS feed?", I might point you to
this:
http://www.phpclasses.org/package/560-PHP-XML-RSS-feed-generator-for-conten
t-syndication-.html
Or if you had said, "How does one double click?" (since that is NOT a
web-friendly navigation method by default), I might point you in this
direction:
<script>
onload = function () {
document.getElementById("textarea").ondblclick = function () {
alert('Double Clicked!') }
}
</script>
then this in the body
<textarea id="textarea"></textarea>
Or even if you said, "How do I steal, er um, read an XML file from another
site?" Then someone might show you these functions (since you clearly
missed them when you RTFPM)
http://us2.php.net/manual/en/function.file-get-contents.php
http://us2.php.net/manual/en/ref.simplexml.php
http://us2.php.net/manual/en/book.dom.php
But again, your question was so vague that I (and everyone else) probably
has nowhere to begin to help you and therefore most likely won't. Given the
above advice, you might consider breaking your questions down into PHP
related specific examples.
</DBAG_MODE>
--- End Message ---
--- Begin Message ---
hi alfredo.. i really love to help.. but could you please explain a
bit clear. may be with sample input arrays and the expected out put
array.
~viraj
On Thu, Aug 26, 2010 at 7:45 PM, Alfredo Palhares <[email protected]> wrote:
> Hello,
>
> This is kinda a noob question, but that's what i am :)
>
> I have a 2 dimensions array (the first dimension are "normal" keys ) and in
> the second dimension haves custom arrays but they all have a comon key that
> is *id.
> *The array comes ascending ordered by the numbers of *id* .
>
> When i receive this array i need to look for and array that haves the
> *id*== 0, so i do a for loop looking for it and i unset this values
> after
> that.
> But need i need that the unset array looks like this sub-array never existed
> ( eg. if the key that with id = 0 was "5", the "5" will the number "6" and
> "6" the "7" and so on).
> Here is the code:
>
> <?php
>
> // $data the name of the array
>
> //Look for the main email
> for ($i = 0; $i < count($data); $i++) {
> if ($data[$i]['id'] === 0) {
> // It can't be empty
> if (!empty($data[$i])) {
> $this->email = $data[$i]['contact'];
> $main_email_found = true;
> }
> unset($data[$i]);
> }
> }
> ?>
>
> I have tree ways of doing this:
>
> - Use a method that i that looks from duplicate entru based on the *id *key
> as index and after and return the array ordered by this index.
> - Adding a new entry to another array in this loop that not haves the
> *id*== 0. and after that reverse the order
> - Use the array_splice native function.
>
> What do you recommend me ?
> Sorry by the bad English.
>
>
> --
> Regards,
> Alfredo Palhares
>
--- End Message ---