php-general Digest 25 Oct 2006 19:46:23 -0000 Issue 4421

Topics (messages 243602 through 243621):

[php] passing variables doesn't work
        243602 by: WILLEMS Wim \(BMB\)
        243604 by: Chris
        243605 by: Max Belushkin
        243607 by: Jochem Maas
        243611 by: Ivo F.A.C. Fokkema

Re: [PEAR] QUICKFORM JSCALENDAR with "multiple dates feature"
        243603 by: Chris

Problem with EXEC and PASSTHRU
        243606 by: Matt Beechey
        243608 by: Roman Neuhauser
        243610 by: Ivo F.A.C. Fokkema
        243616 by: Myron Turner

Re: IMAP extension causing delays
        243609 by: Edward Kay

Re: foreach on a 3d array
        243612 by: Dotan Cohen
        243613 by: Ivo F.A.C. Fokkema
        243614 by: Dotan Cohen

Re: strtotime
        243615 by: clive
        243617 by: Google Kreme

Re: PHP 5 Hosting
        243618 by: Ed Lazor

How does the Zend engine behave?
        243619 by: jeff.phplist.tanasity.com

exec("mysql -h hhh -u uuu -pppp <test.php",$out,$bin);
        243620 by: Gert Cuykens
        243621 by: David Giragosian

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 ---
Dear all,
 
I am trying to pass variables from one php-file to another but that
doesn't seem to work. Anyone an idea what I am doing wrong?
 
The first file shows a dropdown with all the databases on the server
(only 1 for me). You have to select a database and put an SQL query in
the textarea.
Pushing "Execute query!" then calls the second file test2.php which
should put all the variables on the screen (first there was another
routine but that did not work, so I created this simple output to test
the veriables).
 
<html>
<head>
<title> PHP SQL Code Tester </title>
</head>
<body>
<!--query.php-->
<?php
 $host="localhost";
 $user="some_user";
 $password="some password";
?>
<form action="test2.php" method=post>
Please select the database for the query:<br><br>
<select name=database size=1>
<?php
 $wim = 5; /* this is added to test the passing of the variables -
doesn't work either */
 $link = mysql_connect($host, $user, $password)
       or die(" Cannot connect : " . mysql_error());
 $db_table = mysql_list_dbs();
 
 for ($i = 0; $i < mysql_num_rows($db_table); $i++) {
  echo("<option>" . mysql_tablename($db_table, $i));
 }
?>
</select>
Please input the SQL query to be executed:<br><br>
<textarea name=query cols=50 rows=10></textarea>
<br><br>
<input type=submit value="Execute query!">
</form>
</body>
</html>
 

This routine which is called with the routine above should print all
variables but it doesn't. Well, the routine itself works but the
variables are empty.
<html>
<head>
<title>PHP SQL code tester</title>
</head>
<body>
<!-- test2.php-->
<?php
 echo "Dit is een test<br>";    /* this is printed to the screen */
 echo "$wim";                   /* this is NOT printed to the screen */
 echo "$host<br>";              /* only the <BR> is printed */
 echo "$database<br>";          /* only the <BR> is printed */
 echo "query: $query<br>";      /* only the <BR> is printed */
 echo "Dit is test 2";          /* this is printed to the screen */
?>
</body>
</html>


Thanks for your help,
Wim.

**** DISCLAIMER****
http://www.proximus.be/maildisclaimer

--- End Message ---
--- Begin Message ---
WILLEMS Wim (BMB) wrote:
Dear all,
I am trying to pass variables from one php-file to another but that
doesn't seem to work. Anyone an idea what I am doing wrong?
The first file shows a dropdown with all the databases on the server
(only 1 for me). You have to select a database and put an SQL query in
the textarea.
Pushing "Execute query!" then calls the second file test2.php which
should put all the variables on the screen (first there was another
routine but that did not work, so I created this simple output to test
the veriables).
<html>
<head>
<title> PHP SQL Code Tester </title>
</head>
<body>
<!--query.php-->
<?php
 $host="localhost";
 $user="some_user";
 $password="some password";
?>
<form action="test2.php" method=post>
Please select the database for the query:<br><br>
<select name=database size=1>
<?php
 $wim = 5; /* this is added to test the passing of the variables -
doesn't work either */
 $link = mysql_connect($host, $user, $password)
       or die(" Cannot connect : " . mysql_error());
 $db_table = mysql_list_dbs();
for ($i = 0; $i < mysql_num_rows($db_table); $i++) {
  echo("<option>" . mysql_tablename($db_table, $i));
 }
?>
</select>
Please input the SQL query to be executed:<br><br>
<textarea name=query cols=50 rows=10></textarea>
<br><br>
<input type=submit value="Execute query!">
</form>
</body>
</html>
This routine which is called with the routine above should print all
variables but it doesn't. Well, the routine itself works but the
variables are empty.
<html>
<head>
<title>PHP SQL code tester</title>
</head>
<body>
<!-- test2.php-->
<?php
 echo "Dit is een test<br>";    /* this is printed to the screen */
 echo "$wim";                 /* this is NOT printed to the screen */

You're relying on register_globals being on.

That's not going to work in 99% of the cases, it's a security issue.

Instead everything goes into the $_POST array:

echo $_POST['wim'] . "<br/>";

If the form action was "get" instead of "post" it would go into the $_GET array.

You should also read up on sanitizing user input and sql injection.
http://www.phpsec.org/ has quite a few good links on the subject(s).

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Whatever form information you want to pass has to be part of the form.

WILLEMS Wim (BMB) wrote:
<select name=database size=1>

In the second script, the value of this will be in $_POST["database"].

<?php
 $wim = 5; /* this is added to test the passing of the variables -
doesn't work either */

$wim isn't part of your form - it will /not/ get saved into the next PHP script. You can handle it through input type hidden elements in the form, or through sessions, for example, depending on what you want to do with it.
--- End Message ---
--- Begin Message ---
http://google.com/search?q=phpmyadmin

phpmyadmin has all the functionality you are trying to build - and it
implements it securely - even if you are writing the code/tool mentioned below
as a learning exercise (as opposed to writing it because you need to
be able to execute arbitrary queries easily) then the source of the
phpmyadmin project is a good resource.

WILLEMS Wim (BMB) wrote:
> Dear all,
>  
> I am trying to pass variables from one php-file to another but that
> doesn't seem to work. Anyone an idea what I am doing wrong?
>  
> The first file shows a dropdown with all the databases on the server
> (only 1 for me). You have to select a database and put an SQL query in
> the textarea.
> Pushing "Execute query!" then calls the second file test2.php which
> should put all the variables on the screen (first there was another
> routine but that did not work, so I created this simple output to test
> the veriables).
>  
> <html>
> <head>
> <title> PHP SQL Code Tester </title>
> </head>
> <body>
> <!--query.php-->
> <?php
>  $host="localhost";
>  $user="some_user";
>  $password="some password";
> ?>
> <form action="test2.php" method=post>
> Please select the database for the query:<br><br>
> <select name=database size=1>
> <?php
>  $wim = 5; /* this is added to test the passing of the variables -
> doesn't work either */
>  $link = mysql_connect($host, $user, $password)
>        or die(" Cannot connect : " . mysql_error());
>  $db_table = mysql_list_dbs();
>  
>  for ($i = 0; $i < mysql_num_rows($db_table); $i++) {
>   echo("<option>" . mysql_tablename($db_table, $i));
>  }
> ?>
> </select>
> Please input the SQL query to be executed:<br><br>
> <textarea name=query cols=50 rows=10></textarea>
> <br><br>
> <input type=submit value="Execute query!">
> </form>
> </body>
> </html>
>  
> 
> This routine which is called with the routine above should print all
> variables but it doesn't. Well, the routine itself works but the
> variables are empty.
> <html>
> <head>
> <title>PHP SQL code tester</title>
> </head>
> <body>
> <!-- test2.php-->
> <?php
>  echo "Dit is een test<br>";  /* this is printed to the screen */
>  echo "$wim";                 /* this is NOT printed to the screen */
>  echo "$host<br>";            /* only the <BR> is printed */
>  echo "$database<br>";                /* only the <BR> is printed */
>  echo "query: $query<br>";    /* only the <BR> is printed */
>  echo "Dit is test 2";                /* this is printed to the screen */
> ?>
> </body>
> </html>
> 
> 
> Thanks for your help,
> Wim.
> 
> **** DISCLAIMER****
> http://www.proximus.be/maildisclaimer
> 

--- End Message ---
--- Begin Message ---
On Wed, 25 Oct 2006 10:19:24 +0200, Max Belushkin wrote:

> Whatever form information you want to pass has to be part of the form.
> 
>> WILLEMS Wim (BMB) wrote:
>> <select name=database size=1>
> 
> In the second script, the value of this will be in $_POST["database"].

... which will contain absolutely nothing, since you haven't provided any
value: <option>blabla</option> does not contain a value that can be sent
to the next page.

And, don't build the link to the database (and possibly spawn an error)
when you're right into your HTML and just printed <select> to the screen.
If the connection fails, the error will most likely not show up, you'll
have an empty select box, we'll get a new question from you etc.

Ivo

--- End Message ---
--- Begin Message ---
Marco Sottana wrote:
i find jscalendar element for HTML_QuickForm
http://www.netsols.de/pear/jscalendar/

Ask on the pear-general list, you'll get more responses.

http://pear.php.net/support/lists.php

and please don't cross-post.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
I am writing a php website for users to edit a global whitelist for Spam
Assassin - all is going fairly well considering I hadn't ever used php until
a couple of days ago. My problem is I need to restart AMAVISD-NEW after the
user saves the changes. I've acheived this using SUDO and giving the
www-data users the rights to SUDO amavisd-new. My problem is simply a user
friendlyness issue - below is the code I'm running -

if(isset($_POST["SAVE"]))
{
file_put_contents("/etc/spamassassin/whitelist.cf", $_SESSION[whitelist]);
$_SESSION[count]=0;
echo "Restarting the service.........</A></P>";
exec('sudo /usr/sbin/amavisd-new reload');
echo "Service was restarted...... Returning to the main page.";
sleep(4)
echo '<meta http-equiv="refresh" content="0;URL=index.php">';
}

The problem is that the Restarting the Service dialogue doesn't get
displayed until AFTER the Service Restarts even though it appears before the
shell_exec command. I've tried exec and passthru and its always the same - I
want it to display the "Service was restarted" - wait for 4 seconds and then
redirect to the main page. Instead nothing happens on screen for the browser
user until the service has restarted at which point they are returned to
index.php - its as if the exec and the sleep and the refresh to index.php
are all kind of running concurently.

Can someone PLEASE tell me what I'm doing wrong - or shed light on how I
should do this.

Thanks,

Matt

--- End Message ---
--- Begin Message ---
# [EMAIL PROTECTED] / 2006-10-25 20:35:29 +1300:
> I am writing a php website for users to edit a global whitelist for Spam
> Assassin - all is going fairly well considering I hadn't ever used php until
> a couple of days ago. My problem is I need to restart AMAVISD-NEW after the
> user saves the changes. I've acheived this using SUDO and giving the
> www-data users the rights to SUDO amavisd-new. My problem is simply a user
> friendlyness issue - below is the code I'm running -
> 
> if(isset($_POST["SAVE"]))
> {
> file_put_contents("/etc/spamassassin/whitelist.cf", $_SESSION[whitelist]);
> $_SESSION[count]=0;
> echo "Restarting the service.........</A></P>";
> exec('sudo /usr/sbin/amavisd-new reload');
> echo "Service was restarted...... Returning to the main page.";
> sleep(4)
> echo '<meta http-equiv="refresh" content="0;URL=index.php">';
> }
> 
> The problem is that the Restarting the Service dialogue doesn't get
> displayed until AFTER the Service Restarts even though it appears before the
> shell_exec command. I've tried exec and passthru and its always the same - I
> want it to display the "Service was restarted" - wait for 4 seconds and then
> redirect to the main page. Instead nothing happens on screen for the browser
> user until the service has restarted at which point they are returned to
> index.php - its as if the exec and the sleep and the refresh to index.php
> are all kind of running concurently.
> 
> Can someone PLEASE tell me what I'm doing wrong - or shed light on how I
> should do this.

    You're forgetting that the server, the browser, and anything between
    may cache the data into chunks of any size.

    Even if the browser /did/ receive the data "in real time" your code
    would be wrong: you're ignoring the basic structure of a HTML
    document, and any browser worth that label should ignore the meta
    tag.

    Do this instead:

    // ...
    file_put_contents("/etc/spamassassin/whitelist.cf", $_SESSION[whitelist]);
    $_SESSION[count]=0;
    exec('sudo /usr/sbin/amavisd-new reload');
    ?>
    <html>
    <head>
    <meta http-equiv="refresh" content="4;URL=index.php">
    </head>
    <body>
    Service was restarted...... Returning to the main page.
    </body>
-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

--- End Message ---
--- Begin Message ---
On Wed, 25 Oct 2006 20:35:29 +1300, Matt Beechey wrote:

> I am writing a php website for users to edit a global whitelist for Spam
> Assassin - all is going fairly well considering I hadn't ever used php until
> a couple of days ago. My problem is I need to restart AMAVISD-NEW after the
> user saves the changes. I've acheived this using SUDO and giving the
> www-data users the rights to SUDO amavisd-new. My problem is simply a user
> friendlyness issue - below is the code I'm running -
> 
> if(isset($_POST["SAVE"]))
> {
> file_put_contents("/etc/spamassassin/whitelist.cf", $_SESSION[whitelist]);
> $_SESSION[count]=0;
> echo "Restarting the service.........</A></P>";
> exec('sudo /usr/sbin/amavisd-new reload');
> echo "Service was restarted...... Returning to the main page.";
> sleep(4)
> echo '<meta http-equiv="refresh" content="0;URL=index.php">';
> }
> 
> The problem is that the Restarting the Service dialogue doesn't get
> displayed until AFTER the Service Restarts even though it appears before the
> shell_exec command. I've tried exec and passthru and its always the same - I
> want it to display the "Service was restarted" - wait for 4 seconds and then
> redirect to the main page. Instead nothing happens on screen for the browser
> user until the service has restarted at which point they are returned to
> index.php - its as if the exec and the sleep and the refresh to index.php
> are all kind of running concurently.
> 
> Can someone PLEASE tell me what I'm doing wrong - or shed light on how I
> should do this.

www.php.net/flush may help you out, but there are many reasons for
even that not to work... such as IE needing at least 256 (out the top of
my head) bytes before showing anything, IE needing all data in a
<TABLE> before showing it and commonly to make sure you send at least some
20 characters or so before being able to flush() again.

--- End Message ---
--- Begin Message ---
Matt Beechey wrote:
I am writing a php website for users to edit a global whitelist for Spam
Assassin - all is going fairly well considering I hadn't ever used php until
a couple of days ago. My problem is I need to restart AMAVISD-NEW after the
user saves the changes. I've acheived this using SUDO and giving the
www-data users the rights to SUDO amavisd-new. My problem is simply a user
friendlyness issue - below is the code I'm running -

if(isset($_POST["SAVE"]))
{
file_put_contents("/etc/spamassassin/whitelist.cf", $_SESSION[whitelist]);
$_SESSION[count]=0;
echo "Restarting the service.........</A></P>";
exec('sudo /usr/sbin/amavisd-new reload');
echo "Service was restarted...... Returning to the main page.";
sleep(4)
echo '<meta http-equiv="refresh" content="0;URL=index.php">';
}

The problem is that the Restarting the Service dialogue doesn't get
displayed until AFTER the Service Restarts even though it appears before the
shell_exec command. I've tried exec and passthru and its always the same - I
want it to display the "Service was restarted" - wait for 4 seconds and then
redirect to the main page. Instead nothing happens on screen for the browser
user until the service has restarted at which point they are returned to
index.php - its as if the exec and the sleep and the refresh to index.php
are all kind of running concurently.

Can someone PLEASE tell me what I'm doing wrong - or shed light on how I
should do this.

Thanks,

Matt


--
You have to keep in mind that you are dealing with the difference in speed between something that is taking place on the sever and something that is being transmitted over a network. You don't make it clear whether this is an in-house site or whether it is used by people at a distance. If the latter, what you describe is not surprising at all.

I've never had a reason to look into how PHP sequences events when it pumps out a web page, but it's not unusual for scripts in Perl, for instance, to show delays in browser output when doing something on the server. One consideration would be how long amavisd-new takes to reload.

I'm not very well-informed about hacking and security, but it would seem to me that you are taking a risk by giving users root privileges to restart amavisd-new.


_____________________
Myron Turner
http://www.mturner.org/XML_PullParser/

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Edward Kay [mailto:[EMAIL PROTECTED]
> Sent: 19 October 2006 14:53
> To: [email protected]
> Subject: [PHP] IMAP extension causing delays
>
> Hello,
>
> I need PHP's IMAP extension for my web app but it is really slowing my
> server up.
>
> My setup: Fedora Core 5, Apache 2.2.2, PHP 5.1.4 (run as CGI with suPHP),
> PHP IMAP extension - all standard FC5 RPMs. The test page is
> simple - just a
> call to phpinfo().
>
> Without the IMAP extension, the response time is almost
> immediate. With the
> IMAP extension it takes 2-3 seconds to respond - sometimes as much as 4
> secs.
>
> Watching with 'top', I can see php-cgi is called immediately when the
> request is received. With the IMAP extension installed, after php-cgi
> starts, it then drops to the end of the 'top' list, consuming 0% CPU and
> 2.0% memory. It remains there for the 2-3 second delay before coming into
> play again an running the script quickly. Without the IMAP extension, it
> just ends quickly having finished the request.
>
> From this, it is clear to me there is some major delay being
> introduced by
> the loading of the IMAP extension. Any ideas on how to resolve this?
>
> Thanks,
> Edward
>

Thanks to all the suggestions I received on this issue.

I have tried running PHP as an Apache module. As Jochem mentioned, this
restricts the startup delay to just when Apache starts, not with each
request - which is a great improvement.

I have also set the various configuration options in the VirtualHost
directives so my requirement for separate php.ini files has been removed.

There is one remaining issue though - how to get my PHP scripts to run under
different usernames for each virtual host. I need my PHP scripts to run as
specfic users as they need to interact with the filesystem. I am using
suExec and have set the SuexecUserGroup directive for each virtual host, but
this isn't used as PHP is not called by CGI.

Any suggestions?

Thanks,
Edward

--- End Message ---
--- Begin Message ---
On 25/10/06, Ivo F.A.C. Fokkema <[EMAIL PROTECTED]> wrote:

Because that wouldn't work :)

This variable may contain stuff like "nl,en-us;q=0.7,en;q=0.3". You'll
need to do something with this variable first to use
array_key_exists (or as you do, isset). That said, I agree that
strstr() might not be the best solution.

An other note, Dotan: shouldn't $_HTTP_ACCEPT_LANGUAGE actually be
$_SERVER['HTTP_ACCEPT_LANGUAGE']?


I am using $HTTP_ACCEPT_LANGUAGE. I copied-pested
$_HTTP_ACCEPT_LANGUAGE from the first version of the code, which of
course didn't work :) $_SERVER['HTTP_ACCEPT_LANGUAGE'] works too.

Dotan Cohen

http://what-is-what.com/what_is/spam.html
http://song-lirics.com/

--- End Message ---
--- Begin Message ---
On Wed, 25 Oct 2006 13:53:47 +0200, Dotan Cohen wrote:

> On 25/10/06, Ivo F.A.C. Fokkema <[EMAIL PROTECTED]> wrote:
>>
>> Because that wouldn't work :)
>>
>> This variable may contain stuff like "nl,en-us;q=0.7,en;q=0.3". You'll
>> need to do something with this variable first to use
>> array_key_exists (or as you do, isset). That said, I agree that
>> strstr() might not be the best solution.
>>
>> An other note, Dotan: shouldn't $_HTTP_ACCEPT_LANGUAGE actually be
>> $_SERVER['HTTP_ACCEPT_LANGUAGE']?
>>
> 
> I am using $HTTP_ACCEPT_LANGUAGE. I copied-pested
> $_HTTP_ACCEPT_LANGUAGE from the first version of the code, which of
> course didn't work :) $_SERVER['HTTP_ACCEPT_LANGUAGE'] works too.

Ah, in that case using $HTTP_ACCEPT_LANGUAGE relies on the
register_globals setting, which is a security risk (and turned off by
default). Please read up on this, so you know what you're up against...
See: http://www.php.net/register_globals

Ivo

--- End Message ---
--- Begin Message ---
On 25/10/06, Ivo F.A.C. Fokkema <[EMAIL PROTECTED]> wrote:
Ah, in that case using $HTTP_ACCEPT_LANGUAGE relies on the
register_globals setting, which is a security risk (and turned off by
default). Please read up on this, so you know what you're up against...
See: http://www.php.net/register_globals

Actually, I have read that. I'll pass it on to they guy who manages
this server, though. Thanks.

Dotan Cohen

http://what-is-what.com/what_is/skype.html
http://essentialinux.com/

--- End Message ---
--- Begin Message ---
Ron Piggott (PHP) wrote:
I have used the strtotime command to calculate a week ago (among other
things) with syntax like this:

$one_week_ago = strtotime("-7 days");
$one_week_ago = date('Y-m-d', $one_week_ago);

How would you use this command to figure out the last day of the month
in two months from now --- Today is October 24th 2006; the results I am
trying to generate are December 31st 2006.  I want to keep the same
result until the end of October and then on November 1st and throughout
November the result to be January 31st 2007

Ron
my suggestion:

$thefuturedate = mktime(0, 0, 0, date("m") + 3, 0,  date("Y"));

--
Regards,

Clive

--- End Message ---
--- Begin Message ---
On 24 Oct 2006, at 19:07 , Brad Chow wrote:
$date=("2006-10-26");
$date=strtotime($date);
$date=date('Y-m-1',$date);
$now=strtotime("+3 month", strtotime($date));
$lastday=strtotime("-1 day", $now);
echo date('Y-m-d',$lastday);
//2006-12-31

Yep, that's pretty much exactly what I do. I suspect there is a much shorter, and more opaque but elegantly clever way of doing it, but that basic methodology has been with me since the mid 80's :)


--
One by one the bulbs burned out, like long lives come to their expected ends.
--- End Message ---
--- Begin Message ---
Hi,

I wanted to give some feedback on PHP 5 hosting in case it helps someone. I signed up with DreamHost last Thursday. I also signed up with OCS Solutions to compare the two services. I also maintain a server with CalPop.

When I signed up with Dreamhost, I discovered that you have to fill out a form and fax it to them, along with a rubbing of your credit card. Personally, I found that part rather annoying. They say it's for added security, but I've never had to do that with any other online transactions that I've done. OCS Solutions had me pay for a year up front, which always makes me nervous when checking out a new provider, but they do offer a money back guarantee. Actually, both providers offered a money back guarantee. DreamHost's is 97 days. That's pretty good.

Cost-wise, both companies were fairly inexpensive. I ran a Google search for "DreamHost Coupon" and found a coupon that eliminated a majority of the up front cost. Actually, I was pretty surprised. They give you a free domain registration that includes private whois for free. After the coupon, I paid $9.90 and covered the start-up fee (normally $45), the first month of service, and the domain registration. It feels like I paid for a domain registration and got free hosting for a month.

My account with DreamHost was created on Monday. Technically, it took 5 days to get my account set up. That's the longest set up delay I've ever experienced with any host provider. OCS Solutions called me an hour after signing up and had my account setup shortly thereafter.

I also registered a domain when signing up with OCS Solutions. The whois was wrong. Somehow it ended up showing as registered to one of their employees, but I called and they quickly fixed it. The account was set up under the wrong username, but they fixed that quickly, along with problems with cpanel when it doesn't handle the name change correctly. Mistakes were made, but I was really pleased with how easy it was to get help and I was really happy with how much people obviously cared about helping out.

After signing up with DreamHost, the domain that I'd registered with them wasn't working. I was exploring their control panel to figure out the problem when I came upon a DNS management page. The page automatically identified and fixed the problem. That was impressive.

Also, I started exploring the DreamHost forums after signing up, something I almost wish I'd done beforehand. I found a lot of posts from very disgruntled customers. It sounds as if they've been running into problems lately on their servers. People complain A LOT about the lack of phone support from DreamHost... you have to submit a trouble ticket for everything. If your account subscription is high enough, they offer a limited number of call backs. The worst part was reading debates between the really happy and the really unhappy DreamHost clients. A lot of the discussions boiled down to verbal attacks between customers. I'm honestly surprised DreamHost didn't intervene.

One last thing with OCS, the plan I started on turned out to be insufficient for my needs. I talked with them and they came up with a new plan that does everything I want and just charged me a little more to cover the difference.

End result so far...

CalPop: I've always had problems with the initial set up of servers at CalPop. Talking with their tech support on the phone is a nightmare; there's something wrong with their phone lines (seems like a really bad voice over IP solution). It usually takes way too many emails to resolve problems. I've also experienced a lot of hardware failures, which makes me wonder about the quality of parts they purchase. Once the server works though, everything seems to settle down until the next problem shows up.

DreamHost: Best prices, low service. It seems like DreamHost is run by and tailored toward experienced techies. That's fine, I can work with that. I'm willing to try working with limited phone support. I'm really only concerned with delays I might experience when a problem shows up in something that's mission critical. Beyond that, there are a lot of features available here that aren't elsewhere. I'm getting great value for my money.

OCS Solutions: Good prices, but you have to pay up front. Best customer service I've experienced from an ISP so far. I feel a lot more comfortable using them for anything mission critical.




On Oct 11, 2006, at 10:12 PM, Kyle wrote:

Hello,
I would suggest dreamhost at www.dreamhost.com.
Their prices look a bit hefty at first but there are referral codes all over the internet and you can end up saving $97. Their plans have tons
of bandwidth and space and I haven't had any trouble with it.  But I
would suggest them highly, their service is quite impressive.  And if
you don't like the PHP features they let you compile you own!

Good Luck with it!
Kyle

--- End Message ---
--- Begin Message ---
Hi,

I'm using PHP 4.x and I'm trying to understand a bit about memory usage...

Firstly, when I say 'include files' below, I mean all forms, include, require and the _once versions.

That said, when a script runs and it's made of several include files, what happens?

Are the include files only compiled when execution hits them, or are all include files compiled when the script is first compiled, which would mean a cascade through all statically linked include files. By statically linked files I mean ones like "include ('bob.php')" - i.e the filename isn't in a variable.

Secondly, are include files that are referenced, but not used, loaded into memory? I.e Are statically included files automatically loaded into memory at the start of a request? (Of course those where the name is variable can only be loaded once the name has been determined.) And when are they loaded into memory? When the instruction pointer hits the include? Or when the script is initially loaded?

Are included files ever unloaded? For instance if I had 3 include files and no loops, once execution had passed from the first include file to the second, the engine might be able to unload the first file. Or at least the code, if not the data.

Thirdly, I understand that when a request arrives, the script it requests is compiled before execution. Now suppose a second request arrives for the same script, from a different requester, am I right in assuming that the uncompiled form is loaded? I.e the script is tokenized for each request, and the compiled version is not loaded unless you have engine level caching installed - e.g. MMCache or Zend Optimiser.

Fourthly, am I right in understanding that scripts do NOT share memory, even for the portions that are simply instructions? That is, when the second request arrives, the script is loaded again in full. (As opposed to each request sharing the executed/compiled code, but holding data separately.)

Fifthly, if a script takes 4MB, given point 4, does the webserver demand 8MB if it is simultaneously servicing 2 requests?

Lastly, are there differences in these behaviors for PHP4 and PHP5?

Many thanks,

Jeff

--- End Message ---
--- Begin Message ---
i do not get any output from mysql except form echo $bin that displays 1 ?
<?php
exec("mysql -h hhh -u uuu -pppp <test.php",$out,$bin);
print_r($out);
echo $bin;
?>

--- End Message ---
--- Begin Message ---
What is the SQL you are running in test.php?

David


On 10/25/06, Gert Cuykens <[EMAIL PROTECTED]> wrote:

i do not get any output from mysql except form echo $bin that displays 1 ?
<?php
exec("mysql -h hhh -u uuu -pppp <test.php",$out,$bin);
print_r($out);
echo $bin;
?>

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



--- End Message ---

Reply via email to