In Windows,i used WAMP and adobe dreamweaver. In Ubuntu,i am planning to use bluefish editor. I hear that WAMP server equivalent is LAMP in ubuntu. I need detailed and simple explaination to install LAMP server in ubuntu. I am a beginner,so make it simple as you can.
4 Answers
1. Installing and setting up the LAMP stack
- Open Terminal by hitting Ctrl+Alt+T
- Update the
apt
cache and installlamp-server^
by runningsudo apt-get update && sudo apt-get install lamp-server^
(you should be able to go through the on-screen setup; it's just a matter of setting up themysql
root password)
2. Installing and setting up PHPMyAdmin
- Open Terminal by hitting Ctrl+Alt+T
- Update the
apt
cache and installphpmyadmin
by runningsudo apt-get update && sudo apt-get install phpmyadmin
(you should be able to go through the on-screen setup; it's just a matter of providing themysql
root password, setting up thephpmyadmin
password and choosing which DBMS you want to configure, i.e.mysql
)
3. Setting up Apache for PHPMyAdmin
- Open Terminal by hitting Ctrl+Alt+T
- Add this line (
Include /etc/phpmyadmin/apache.conf
) to/etc/apache2/apache2.conf
by runningecho 'Include /etc/phpmyadmin/apache.conf' | sudo tee -a /etc/apache2/apache2.conf
- Restart
apache
by runningsudo service apache2 restart
Finally, test Apache and PHPMyAdmin to see if everything went right;
Test Apache by opening http://localhost
in your web browser; if everything went right you should see this:
Test PHPMyAdmin by opening http://localhost/phpmyadmin
in your web browser; if everything went right you should see this:
-
-
@john9983 I just didn't understand why you switched, I tought something went wrong. No you shouldn't need to. Try to put a PHP file containing
<?php phpinfo(); ?>
in/var/www/html
and see if it works.– kosJul 25, 2015 at 17:18 -
it works.Can you tell me which is the best php editor in ubuntu?is it bluefish?do i need to switch?– john9983Jul 25, 2015 at 17:32
-
@john9983 I use
gedit
, so I'm not really the right person to ask. Sometimes I've had to do some more complex job and I used Notepad++ in WINE, since I loved it on Windows, but I suggest you to try more than one and to just stick to the one that you prefer. Bluefish seems legit tough.– kosJul 25, 2015 at 17:35
To install these packages in the command-line you can type
sudo apt-get install lamp-server^ phpmyadmin
There is also extensive documentation how to set up a LAMP environment with phpmyadmin at https://help.ubuntu.com/community/ApacheMySQLPHP | https://help.ubuntu.com/14.04/serverguide/lamp-applications.html
Feel free to ask more specific questions if you feel stuck somewhere in the process.
Run those commands:
sudo apt-get update
Install apache:
sudo apt-get install apache2
You can test apache2 is working by directing your browser to http://localhost , you should see "it works" output.
Install PHP:
sudo apt-get install php5 libapache2-mod-php5
Restart apache2 now:
sudo service apache2 restart
To test PHP now create a file testphp.php under the web root directory /var/www
sudo gedit /var/www/testphp.php
Then add this line:
<?php phpinfo(); ?>
Save and close the file, then open you're web browser direct your browser to: http://localhost/testphp.php
you should see a page showing the php information .
Install Mysql:
sudo apt-get install mysql-server
Optional you may need to install a program called phpMyAdmin
which is an easy tool to edit your databases.
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
You might also want to look at setting up a VirtualBox environment for PHP development. This way you keep your host OS free from server packages but you can still do all development on your own PC with the shared folder functionality. :)
sudo apt-get install lamp-server^ phpmyadmin
- it will install everything you need for LAMP development.