NYCPHP Meetup

NYPHP.org

[nycphp-talk] Advice on setting for testing server

Joelle Tegwen tegwe002 at umn.edu
Tue Aug 25 13:50:55 EDT 2009


I switched over from Windows a couple of years ago. I'm not a pro, but I 
found a few things that were frustrating for me as I switched distros or 
got a new machine.

Here's my advice that others have not already covered.
1) Take the time to figure out how to move your /home to another partition.

2) I use E_ALL | E_STRICT. Then you know you're good regardless of the 
production server settings.

3) Find a way to reproduce the environment on your machine. This caused 
me no end of headaches at first because it took me days to finally 
remember all of the applications I needed installed and figuring out how 
they were configured different.

I created two files. The first is a shell script that installs all of 
the applications I use, changes settings/permissions and makes copies of 
config files. Then you've always got your back covered. The second is 
instructions and information about how to manually change things that 
need to be manually changed. (config files, etc) . The only trick is 
being religious about updating the files every time you 
install/configure applications. However, this made my last hardware 
upgrade go wickedly fast.

So for LAMP I've got this:
(script)

    sudo tasksel install lamp-server
    #extensions
    sudo apt-get install -y sendmail php-pear php5-mysql php5-ldap
    php5-xsl php5-xdebug php5-curl php5-mcrypt
    sudo mkdir /var/lib/php5/session
    sudo chgrp www-data /var/lib/php5/session
    sudo chmod g+w /var/lib/php5/session


    sudo pear channel-discover pear.phpunit.de
    sudo pear install phpunit/PHPUnit
    sudo pear install phpunit/phpcpd
     
    cd /etc/php/apache2
    sudo cp php.ini php.ini.original

    cd /etc/mysql
    sudo cp my.cnf my.cnf.original


(config)

    cd /etc/php5/apache2/
    gksudo gedit php.ini &
    # see php.ini.diff
    diff php.ini php.ini.original > ~/howtos/php.ini.diff

    cd /etc/mysql/
    gksudo gedit my.cnf &
    # see my.cnf.diff
    diff my.cnf my.cnf.original > ~/howtos/my.cnf.diff

Where php.ini.diff looks like this:
390c390
< error_log = /localhost/web_logs/php_errors.txt
---
 > ;error_log = filename
1007c1007
< session.gc_maxlifetime = 14400
---
 > session.gc_maxlifetime = 1440

HTH
J

lists at nopersonal.info wrote:
> Okay, one last batch of questions then I'll leave you guys alone for
> another six months. ;-)
>
> I recently set up my first LAMP stack using Ubuntu--it seemed like the
> easiest option, and so far I love it. From now on this will be my local
> testing server.
>
> I've installed OpenSSH so I can practice "talking" to Linux & MySQL via
> the command line from my primary computer. I intend to perhaps also
> install up some sort of FTP & mail server, if for no other reason than
> to understand how they work on the other end.
>
> Aside from occasional shell access to remote servers and setting up cron
> jobs I'm a total Linux noob, so this is a whole new world for me. I've
> dealt with Apache .conf files a bit, and also with php.ini files. Not so
> much with MySQL .cnf files.
>
> At present, aside form having set passwords I'm still using the default
> config files that were installed with Apache 2.2.11, PHP 5.26, MySQL
> 5.0.75, and phpMyAdmin 3.1.2. I'd like to turn off things that are
> commonly disabled in shared hosting environments so that I don't
> inadvertently use something that's not going to work on a production
> server over which I have little or no control.
>
> Do any of you have recommendations on configuration settings to use?
>
> Which packages/extensions/modules should be installed/enabled?
>
> Should I go ahead and turn off error reporting and enable it via my
> scripts, or should I leave it on all the time? If I should leave it on,
> at what level should I set it? E_ALL?
>
> Are there any other settings or extensions that might be helpful someone
> like me who's still prone to making rookie mistakes?
>
> Would it be a good idea to use one php.ini file while I'm writing &
> debugging my code, and then a second one for testing immediately prior
> to moving to a production server? If so, how should they differ?
>
> Would this be a good time to learn how to use CVS or Subversion?
>
> As always, any advice is greatly appreciated.
>
> Regards,
> Bev
>
> _______________________________________________
> New York PHP User Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> http://www.nyphp.org/show_participation.php
>
>   



More information about the talk mailing list