Technical info.

Monday, December 29, 2014

PHP installation

PHP is a script language designed for web development. if you want to get more information please check Wikipedia first [PHP in Wikipedia]

Step 1 : Install PHP

Enter following command to install PHP
$ sudo apt-get install php5 php5-common libapache2-mod-php5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
php5-common is already the newest version.
php5-common set to manually installed.
The following packages were automatically installed and are no longer required:
  kde-l10n-ko language-pack-kde-en language-pack-kde-ko language-pack-kde-en-base kde-l10n-engb
  language-pack-kde-ko-base
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  apache2-mpm-prefork php5-cli
Suggested packages:
  php-pear
The following packages will be REMOVED:
  apache2-mpm-worker
The following NEW packages will be installed:
  apache2-mpm-prefork libapache2-mod-php5 php5 php5-cli
0 upgraded, 4 newly installed, 1 to remove and 1 not upgraded.
Need to get 6,197 kB of archives.
After this operation, 16.6 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://kr.archive.ubuntu.com/ubuntu/ precise-updates/main apache2-mpm-prefork i386 2.2.22-1ubuntu1.7 [2,418 B]
Get:2 http://kr.archive.ubuntu.com/ubuntu/ precise-updates/main libapache2-mod-php5 i386 5.3.10-1ubuntu3.15 [3,109 kB]
Get:3 http://kr.archive.ubuntu.com/ubuntu/ precise-updates/main php5 all 5.3.10-1ubuntu3.15 [1,076 B]
Get:4 http://kr.archive.ubuntu.com/ubuntu/ precise-updates/main php5-cli i386 5.3.10-1ubuntu3.15 [3,084 kB]
Fetched 6,197 kB in 6s (940 kB/s)                                                                  
dpkg: apache2-mpm-worker: dependency problems, but removing anyway as you requested:
 apache2 depends on apache2-mpm-worker (= 2.2.22-1ubuntu1.7) | apache2-mpm-prefork (= 2.2.22-1ubuntu1.7) | apache2-mpm-event (= 2.2.22-1ubuntu1.7) | apache2-mpm-itk (= 2.2.22-1ubuntu1.7); however:
  Package apache2-mpm-worker is to be removed.
  Package apache2-mpm-prefork is not installed.
  Package apache2-mpm-event is not installed.
  Package apache2-mpm-itk is not installed.
(Reading database ... 198596 files and directories currently installed.)
Removing apache2-mpm-worker ...
 * Stopping web server apache2                                                                      apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
 ... waiting .                                                                               [ OK ]
Selecting previously unselected package apache2-mpm-prefork.
(Reading database ... 198592 files and directories currently installed.)
Unpacking apache2-mpm-prefork (from .../apache2-mpm-prefork_2.2.22-1ubuntu1.7_i386.deb) ...
Setting up apache2-mpm-prefork (2.2.22-1ubuntu1.7) ...
 * Starting web server apache2                                                                      apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
                                                                                             [ OK ]
Selecting previously unselected package libapache2-mod-php5.
(Reading database ... 198597 files and directories currently installed.)
Unpacking libapache2-mod-php5 (from .../libapache2-mod-php5_5.3.10-1ubuntu3.15_i386.deb) ...
Selecting previously unselected package php5.
Unpacking php5 (from .../php5_5.3.10-1ubuntu3.15_all.deb) ...
Selecting previously unselected package php5-cli.
Unpacking php5-cli (from .../php5-cli_5.3.10-1ubuntu3.15_i386.deb) ...
Processing triggers for man-db ...
Setting up libapache2-mod-php5 (5.3.10-1ubuntu3.15) ...

Creating config file /etc/php5/apache2/php.ini with new version
 * Restarting web server apache2                                                                    apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
                                                                                             [ OK ]
Setting up php5 (5.3.10-1ubuntu3.15) ...
Setting up php5-cli (5.3.10-1ubuntu3.15) ...

Creating config file /etc/php5/cli/php.ini with new version
update-alternatives: using /usr/bin/php5 to provide /usr/bin/php (php) in auto mode.
$ 

Step 2 : Check PHP service

The default documentation directory of Apache server is "/var/www".  So if you want to check your php service, you can create test php file in /var/www directory.

$ sudo vi /var/www/test.php 
<?php
   phpinfo();
?>
After create test.php, enter "http://localhost/test.php" in your web browser. You can see the following screen.

If you can see this screen, you successfully install PHP and Apache server.  



No comments:

Post a Comment