Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP The php.ini File

How to set up a local server?

This video speaks about editing the php.ini file in your local host with mamp. https://teamtreehouse.com/library/the-phpini-file

I understand that you can do this through the console in workspaces, and that is what I did, but where can I find directions to set up a local server on my pc, so that I get a more thorough understanding?

2 Answers

Christopher Johnson
Christopher Johnson
2,069 Points

If you are using Windows, you will usually need a compiler to install Apache and PHP etc for you, one I've used in the past is XAMPP, if you do a web search for this, there is an easy down-loader and installer available which sets up the full environment for you.

If you are using Linux Ubuntu, it's slightly more complicated. You can install LAMP (Linux, Apache, MySQL, PHP) which will enable you to have your own PHP Development area on your PC (localhost).

To install this:

sudo apt-get update sudo apt-get install apache2

To check Apache works, go to localhost in your browser and it should display the default Apache screen or something along the lines of "It works!".

If you need MySQL (for database integration), you can install and set it up using these commands:

sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql sudo mysql_install_db sudo /usr/bin/mysql_secure_installation

To install PHP, use:

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

then edit the following file using:

sudo nano /etc/apache2/mods-enabled/dir.conf

and add your working directory to the file by typing something like:

<IfModule mod_dir.c>

      DirectoryIndex index.php index.html index.cgi index.pl index.php index.xhtml index.htm

</IfModule>

That's it on Linux. You can look up guides online on how to customize various PHP elements such as PHP.ini but usually one is generated for you when you start a directory. If none, just create one with the following command:

sudo touch php.ini

Kind regards, Chris

Sebastian Karg
Sebastian Karg
28,705 Points

Hi McKenzie,

i've found this course on treehouse

https://teamtreehouse.com/library/setup-your-local-development-environment-2

Maybe this will answer your question.

Greetings, Basti