Install Lamp Server on Ubuntu

January 14th, 2012 | By: | How to’s, PHP, Tips, tricks & fixes (juicy bits!) | 5 comments »
Install LAMP server ubuntu

Install LAMP Server – Ubuntu: The command we're all after….

Installing LAMP Server on Ubuntu is simple and possible with one command and then following the on-screen instructions:

(NOTE: All the commands here need to be typed into a terminal, open one by pressing Ctrl+Alt+T.)

sudo apt-get install lamp-server^

It’s important to remember the caret (^) at the end of the command.

Thought I’d get that out the way for all the hit and runners looking for the command!

What is LAMP Server

LAMP Server is a collection of open source software used to create a web server. The collection consists of:

Where is php.ini?

January 14th, 2012 | By: | PHP | 2 comments »

Where is php.ini? There it is!

Depending on what system you are running, php.ini could have different locations. But where is php.ini hidden?

Find php.ini

There are few ways to know where is php.ini file.

Find it with a PHP script

The safest way to know it, is through the following script:

 <?php
phpinfo();
?>

Once you run the script in your favourite browser, the function phpinfo() will output the what you see in the image.

You can find much more details with this function, but in order to locate php.ini, we need to focus only on the field “Loaded Configuration File”.

PHP time limit – extend script running time

December 7th, 2011 | By: | PHP | No comments »

Some scripts require some time to execute, and they might reach your PHP time limit.

Fatal error

If PHP time limit is too short for your script, you will see this error:

Fatal error: Maximum execution time of N seconds exceeded in /path/to/script.php on line N

Configuring php.ini

PHP time limit can be configured in php.ini, open it up and change the following line to something more suitable:

(EDIT: Can’t find it? Look where is php.ini)

max_execution_time = 30

NOTE: PHP time limit is measured in seconds!

PHP memory limit – increase memory allocation

December 7th, 2011 | By: | PHP | No comments »

Sometimes, when executing a script with a strong memory usage, we might reach the PHP memory limit.

Fatal Error

This is what we can see when that moment happens:

Fatal error: Allowed memory size of a certain amount bytes exhausted (tried to allocate another amount bytes) in /path/to/script.php

Configuring php.ini

This means you have exceeded PHP memory limit. The default value is set in php.ini file with the following line:

memory_limit “amount of memory

To change this you need to open your php.ini file (which can be located in a number of places depending on your system: find where is php.ini) and edit this line.