php-general Digest 26 Nov 2011 15:14:46 -0000 Issue 7585

Topics (messages 315819 through 315825):

Re: Howto detect the hostname of the server?
        315819 by: Curtis Maurand
        315822 by: Tamara Temple

PHP exercises
        315820 by: Larry Garfield
        315821 by: shiplu

Re: Tutorial for the structure of an php-app ?
        315823 by: Tamara Temple

5.3.9RC2 and 5.4RC2
        315824 by: Tommy Pham

PHP 5.3.8, 5.3.9RC2 & 5.4.0RC2 handler for Apache 2.3.15
        315825 by: Steffen

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


----------------------------------------------------------------------
--- Begin Message ---
On 11/25/2011 7:35 PM, Simon J Welsh wrote:
On 26/11/2011, at 1:14 PM, Andreas wrote:

Hi,
how could I identify the server the script runs on?

I've got a testserver on Windows and a remote system on Linux that need a 
couple of different settings like IP and port of db-server or folder to store 
logfiles.

I'd like to do something like:

if ( $_SERVER['some_key'] = 'my_test_box' ) {
    $db_host = '1.1.1.1';
    $db_port = 1234;
} else {
    $db_host = '2.2.2.2';
    $db_port = 4321;
}


I looked into phpinfo() but haven't found anything helpful, yet.
Have I overlooked something or is there another way to identify the server?

php_uname('n'); http://php.net/php_uname

folks  try:

 $_SERVER['SERVER_NAME']

Cheers,
Curtis


--- End Message ---
--- Begin Message ---
Andreas <maps...@gmx.net> wrote:

> Am 26.11.2011 01:35, schrieb Simon J Welsh:
> > On 26/11/2011, at 1:14 PM, Andreas wrote:
> >
> >> how could I identify the server the script runs on?
> >>
> >
> > php_uname('n'); http://php.net/php_uname
> >
> 
> Great, that even works on a ssh-tunnel.
> I got derailed by the fact that my tunnel maps the remote server to
> localhost:80 so
> $_SERVER['SERVER_ADDR']   and
> $_SERVER['SERVER_NAME']   wouldn't help.
> On the other hand for everyone on the remote LAN $_SERVER['...'] would
> work ok, though I didn't realise that before.

This may work in some circumstances, but not others. 

For example, I have a VPS with several sites hosted on it. php_uname
will always return the default host name, which very likely might be
different than the virtual host's hostname.

I'm not doing any ssh tunnelling in my local setups, so looking at
$_SERVER['SERVER_NAME'] works for me, but obviously won't for you. I
simply set up the /etc/hosts file with a lot of aliases, and then they
can become virtual hosts.

--- End Message ---
--- Begin Message --- Hi folks. A friend of mine is trying to learn PHP. She already knows programming basics, but wants to learn PHP specifically. However, she learns much better with assignments or exercises than just from reading articles or books.

The only site I've found so far is PHP Exercises (http://phpexercises.com/), but it of course went offline the day after I found it. Fail!

Can anyone recommend other sources for tutorial-based or exercise-based PHP learning? Paid is OK if it's not too expensive and it's worth the money, although free is always preferred.

TIA and all that.

--Larry Garfield

--- End Message ---
--- Begin Message ---
On Sat, Nov 26, 2011 at 11:54 AM, Larry Garfield <la...@garfieldtech.com>wrote:

> Hi folks.  A friend of mine is trying to learn PHP.  She already knows
> programming basics, but wants to learn PHP specifically.  However, she
> learns much better with assignments or exercises than just from reading
> articles or books.
>
> The only site I've found so far is PHP Exercises (http://phpexercises.com/),
> but it of course went offline the day after I found it.  Fail!
>
> Can anyone recommend other sources for tutorial-based or exercise-based
> PHP learning?  Paid is OK if it's not too expensive and it's worth the
> money, although free is always preferred.
>
>
IMO, the best way is to learn something is by cloning. Convince your friend
to clone a simple website. If you exercise it, your target would be to pass
in the exercise. After you pass, you forget it. When it comes to real deal,
you never forget it.

-- 
Shiplu Mokadd.im
Follow me, http://twitter.com/shiplu
Innovation distinguishes between follower and leader

--- End Message ---
--- Begin Message ---
Bastien <phps...@gmail.com> wrote:
> Why not download some and dig into them? Something from sourceforge or a cms 
> like pyrocms? See how they stuck it all together. 

This is not a bad idea at all. Learning from something concrete, how
they do things, looking into why they chose to do it that, etc. Don't
pick just one, though, as there are many examples to learn from. CMSes
(Drupal, Joomla), Wikis (Mediawiki, PmWiki), Blog software
(Wordpress). These all solve similar and different problems.

Also, I cannot stress Tommy's point about learning design patterns
enough. It isn't enough to be able to just cable together code, you have
to know the structures and architecture to building something that won't
fall down. Programming isn't something you learn in a weekend
project. It's also not something you learn just by reading a language
manual, even one as good as PHP's. No language manual is going to give
you any insight into deciding among the many options that are available.

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

5.3.9RC2 works fine with all my apps so far.  5.4RC2 broke with sqlsvr
and its PDO in addition to Wincache, which I've already brought to MS'
attention.  What's the estimated official release of 5.4?  I can't
wait for the feature session.upload_progress* in 5.4 which I need to
do some testing as how I can implement that into my existing apps!!!
That's just awesome!!  Thanks for all your continuous hard work :)

Platform: Win08R2/IIS7.5 SP1 with current patches running PHP as FastCGI.

Applications:
drupal, joomla, mediawiki, wordpress, and a few of my own :)

Cheers,
Tommy

--- End Message ---
--- Begin Message --- The module php5apache2_3.dll for Apache 2.3.15 with PHP version 5.4.0RC2, 5.3.9RC2 and 5.3.8 now available.

See http://www.apachelounge.com/viewtopic.php?p=19861

Steffen

--- End Message ---

Reply via email to