Feb 18, 2014

Ubuntu Programming Lesson 03 - Install Apache and PHP

It's easy to install web programming environment in your Ubuntu.

Make Ubuntu become a Web Server is easy!
sudo apt-get install apache2 # Apache Web Server


Use browser and connect to: http://localhost/
PHP: Web Programming
sudo apt-get install libapache2-mod-php5 php5 sudo etc/init.d/apache2 restart
Test PHP:
sudo gedit /var/www/pinfo.php
add this line: <?php  print_r(phpinfo()); ?>
Use browser and connect to: http://localhost/pinfo.php
If you want to manage PHP through web browser,please install mysql-server and phpmyadmin.
# phpmyadmin uses mysql databasesudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql # need to set passwordsudo apt-get install phpmyadmin  # install into /usr/share/phpmyadmin, need to set password for root
Add a symbolic link in the root web directory (/var/www), the link is (usr/share/phpmyadmin). This method can be also used to link to directories of you PHP programs in the future, since the permission of root web directory needs root login.
cd /var/wwwln -s /usr/share/phpmyadmin
Use browser and connect to: http://localhost/phpmyadmin
PHP has a lot of useful libraries and modules for installing into the web server, check these by:
apt-cache search php5-



No comments :

Post a Comment