I’m a web and mobile application developer by profession and developing on LAMP (Linux, Apache, MySQL and PHP) stack for last couple of years. Now it’s time to get development environment ready on my newly installed elementary OS “Freya”. I will install everything separately instead of using the tasksel command.
At the time of writing this article, I’m installing the latest stable version of all the things I am going to need.
- PHP 5.6
- Apache 2.4
- MySQL 5.6
Installing Apache 2.4
We will add the repository of the latest Apache version to our system by using the following command:
1 |
sudo add-apt-repository ppa:ondrej/apache2 |
Then run the following two commands to install Apache 2.4:
1 2 |
sudo apt-get update sudo apt-get install apache2 |
Installing PHP 5.6
First, we will add the repository of the latest PHP version to our system by using the following command:
1 |
sudo add-apt-repository ppa:ondrej/php5-5.6 |
Then run the following two commands to install PHP 5.6:
1 2 |
sudo apt-get update sudo apt-get install php5 |
This will install PHP on our system.
Installing MySQL 5.6
We will add the repository of the latest MySQL version to our system by using the following command:
1 |
sudo add-apt-repository ppa:ondrej/mysql-5.6 |
Then run the following two commands to install MySQL 5.6:
1 2 |
sudo apt-get update sudo apt-get install mysql-server |
This will install MySQL on our system.
You will be asked to set password for the “root” user for the MySQL server during the process.
Voila! Our development environment is ready now 🙂
If you visit http://localhost now, you will see the Apache2 Ubuntu Default Page.
Now let’s write some PHP code to check if everything is working properly. Let’s create a PHP file named info.php on the default document root folder of Apache web server which is /var/www/html and add the following code to the file:
1 2 |
<?php phpinfo(); |
Save the file. Then visit the file on your browser: http://localhost/info.php
You should get an output like this:
You may need to install some other PHP extensions and libraries according to your need manually. I will cover this in future. Feel free to comment if you have any queries.
Thanks for your information, very helpful 🙂
Nice to know that!
Hi how about phpmyadmin i currently install php5.6 and once i install phpmyadmin it says mbstring is missing got any solution to that? thanks
Run the following command to install mbstring:
sudo apt-get install php5.6-mbstring
good guide! I guess, since the user wants to use mysql with php, you should add howto add php mysql extension which doesn’t come with the basic php5 package
Thanks for your suggestion. I will write one.
where to write the command ????????????
Write the command on your terminal.
Hi, thanks for the info, if I’m already installing to ‘official’ repo which I get are PHP 5.5.9 and MySQL 5.5, can I just follow your instructions or I have to remove them one by one?
Thanks
Yeah. You have to first remove them so that they don’t conflict with each other. And the system exactly know which version is to be used.
Hi thanks for the info, I have a problem with my kernel 4.1.4 on freya but i don’t why. Something to do?
Can you please describe what problem you are facing?
Hello I might have a question about changint DocumentRoot, i found in documentation I have to install suEXEC to be able to change it (they say i cannot change apache2.conf , while i tried i had an perrmision error occured even with set up permission at 777 -R on folder i wanted to be my DocumentRoot). Buut i wasnt able to proceed with suEXEC and setup succesfully new DocumentRoot folder (I want it to be a Dropbox folder so i can edit codes from another devices ).
Sorry for my quite not good english, hope you understand my problem and im looking foward to your answer
Can you let me know more about your OS and Apache version?
I m using elementary OS 0.3.1 Freya (64-bit) and Apache ver. 2.4.7 (Ubuntu – more or less your installation)
Have you tried editing the
/etc/apache2/sites-available/default
file?You should change the document root on this file and reload the Apache server.
Yeah i tried that already, came out with error:
You don’t have permission to access / on this server.
Apache/2.4.16 (Ubuntu) Server at localhost Port 80
Folders permission is set to 666, tried 777 and still doesnt work. I had no problems with other devices (windows 7, Ubuntu). The folder im trying to reach is in Dropbox folder, may this have some effect? I tried to reinstall apache2 (purge apache2 and install it with your guide) and still the same error.
I tried to change documentroot folder outside of Dropbox folder and still the same error..
Can I know what is the user group that those folders are under? You can view by running
ls -la
command.Hello Friend, i just have a problem, when i installing mysql-server
====================
The following packages have unmet dependencies:
mysql-server : Depends: mysql-server-5.6 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
=============================
I just after tried [sudo apt-get autoclean && sudo apt-get autoremove] sudo apt-get install -f sudo apt-get dist-upgrade && sudo apt-get update
And try again sudo apt-get install mysql-server
but not change anything, can yoou help me ?
Can we please try with these?
sudo apt-get purge mysql-client-core-5.6
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get install mysql-client-core-5.5
sudo apt-get install mysql-server