Ubuntu Server 12.04 builds PHP environment

Source: Internet
Author: User
Tags fpm gmp odbc snmp snmp module sqlite sybase tidy

Ubuntu server and desktop are all equipped with PHP lamp environment, the steps are no different, the relevant tutorials online also a lot, here to their own configuration process record down, save every time Google ... For reference

The entire environment uses APACHE2, MySQL, PHP5 and phpMyAdmin

1. Install Apache2 $ sudo apt-get install apache2

1 $ sudo apt-get install apache2

After loading in the browser to access http://[server-ip-address] if you see a page similar to the following figure, the Apache2 installation is successful

Ubuntu, Apache configuration information in the/etc/apache2 directory, the default root directory in/var/www

2, install MySQL, modify the default character set $ sudo apt-get install mysql-server mysql-client

1 $ sudo apt-get install mysql-server mysql-client

The installation process needs to set the password for root. Ubuntu, MySQL configuration information in the/etc/mysql directory

The MySQL default character set is Latin1

In order to avoid the garbled problem that Chinese may bring, the default character set is changed to Utf-8, can refer to this article concretely, modify/ETC/MYSQL/MY.CNF file, add [client] Default-character-set=utf8 in the corresponding position [MySQL ] Default-character-set=utf8 [mysqld] collation-server = Utf8_unicode_ci init-connect= ' Set NAMES UTF8 ' Character-set-server = UTF8

1 2 3 4 5 6 7 8 9 10 [client] Default-character-set = UTF8 [mysql] default-character-set = UTF8 [mysqld] collation-server = Utf8_unicode_ci init-connect = ' SET NAMES utf8 ' character-set-server = UTF8

That's what happens when you change.

3, install PHP5 and Apache PHP5 module $ apt-get Install php5 LIBAPACHE2-MOD-PHP5

1 $ apt-get Install php5 LIBAPACHE2-MOD-PHP5

Restart Apache $ sudo service apache2 restart * Restarting Web server apache2 ... waiting [OK] $

1 2 3 4 $ sudo service apache2 restart * Restarting Web server apache2 ... waiting [OK] $

Create a new info.php file in the/var/www directory, which reads as follows <?php Phpinfo ()?>

1 <?php phpinfo ()?>

Access http://[server-ip-address]/info.php in the browser if you see a page similar to the following figure, PHP5 installation is successful

In the/var/www directory under the new testmysql.php file, test PHP connection MySQL, file contents as follows <?php $link = mysql_connect ("localhost", "[user name]", "[Password]"); if (! $link) {die (' could not connect: '. Mysql_error ())} else echo "MySQL connection succeeded"; Mysql_close ($link);?>

1 2 3 4 5 6 7 8 9 <?php $link = mysql_connect ("localhost", "[user name]", "[Password]");      if (! $link) {die (' could not connect: '. Mysql_error ());      else echo "MySQL connection succeeded"; Mysql_close ($link);?>

Access Http://[server-ip-address]/testmysql.php,http error 500 in the browser ...

4. Install php5 mysql module, install other modules required by PHP

The default installed PHP5 is not able to interact with MySQL. By command $ sudo apt-cache search php5 libapache2-mod-php5-server-side, html-embedded scripting language (Apache 2 module) ph p-pear-pear-php Extension and Application Repository php5-server-side, html-embedded scripting language (metapackage ) Php5-cgi-server-side, html-embedded scripting language (CGI binary) Php5-cli-command-line interpreter for the php5 s Cripting language Php5-common-common files for packages built to PHP5 source Php5-curl-curl module for php5 php5 -dbg-debug symbols for PHP5 php5-dev-files for PHP5 Module Development PHP5-GD-GD module for PHP5 PHP5-GMP-GMP MoD Ule for php5 php5-ldap-ldap module for php5 php5-mysql-mysql module for php5 php5-odbc-odbc module for PHP5 Php5-pgs Ql-postgresql module for PHP5 php5-pspell-pspell module for php5 php5-recode-recode module for PHP5 php5-snmp-snmp Module for PHP5 php5-sqlite-sqlite module for php5 php5-tidy-tidy module for PHP5 PHP5-XMLRPC-XML-RPC module for PH P5 php5-xsl-xsl module for PHP5 CAKEPHP-MVC Rapid Application Development Framework for PHP DWOO-PHP5 template engine jffnms-web-based Network Management System (NMS) for IP Networks Libapache2-mod-php5filter-server-side, html-embedded scripting language (Apache 2 filter Module) libexpect-php5-expect module for PHP 5 LIBGV-PHP5-PHP5 bindings for graph Viz libkohana2-modules-php-lightweight PHP5 MVC Framework (Extension modules) libkohana2-php-lightweight PHP5 MVC Fram Ework LIBKOHANA3.1-CORE-PHP-PHP5 Framework Core Classes LIBKOHANA3.1-PHP-PHP5 Framework Metapackage libkohana3.2-core- PHP-PHP5 Framework Core Classes LIBKOHANA3.2-PHP-PHP5 Framework Metapackage Libow-php5-dallas 1-wire SUPPORT:PHP5 b Indings libphp-jpgraph-object oriented graph library for PHP5 libphp-jpgraph-examples-object oriented graph library fo R PHP5 (examples) php-auth-php PEAR modules for creating a authentication system php-codesniffer-tokenises PHP code A ND detects violations of A defined set of coding standards php-doc-documentation for PHP5 php-imlib-php Imlib2 Extension Php5-adodb-extensio N Optimising the ADODB Database Abstraction Library php5-auth-pam-a PHP5 extension for Pam authentication Php5-enchant- Enchant module for php5 php5-exactimage-fast Image Manipulation library (PHP bindings) Php5-ffmpeg-audio and video Su Pport via FFmpeg for php5 php5-fpm-server-side, html-embedded scripting (language fpm-cgi) binary mod Ule for php5 php5-imagick-imagemagick module for php5 php5-imap-imap module for PHP5 php5-interbase-interbase/firebi RD Module for PHP5 php5-intl-internationalisation module for PHP5 php5-lasso-library for Liberty Alliance and SAML Pro tocols-php 5 Bindings PHP5-LIBRDF-PHP5 language bindings for the Redland RDF Library php5-mapscript-php5-cgi module For MapServer php5-mcrypt-mcrypt module for php5 php5-memcache-memcache Extension module for PHP5 Php5-memcached-mem Cached Extension ModuleFor PHP5, uses libmemcached php5-midgard2-midgard2 Content REPOSITORY-PHP5 language bindings and module Php5-ming-mi NG module for php5 php5-mysqlnd-mysql module for PHP5 (Native Driver) php5-ps-ps module for PHP 5 php5-radius-pecl R Adius Module for PHP 5 php5-remctl-pecl module for kerberos-authenticated command execution PHP5-RRD-RRD module for PH P 5 php5-sasl-cyrus SASL Extension for PHP 5 php5-suhosin-advanced protection module for PHP5 php5-svn-php bindings For the Subversion Revision control system php5-sybase-sybase/ms SQL Server module for PHP5 php5-tokyo-tyrant-php in Terface to Tokyo Cabinet ' s network interface, Tokyo tyrant PHP5-UUID-OSSP uuid module for PHP5 php5-xcache-fast, STABL e php opcode cacher php5-xdebug-xdebug Module for PHP 5 Phpunit-unit Testing Suite for PHP5 $

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 3 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 The
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.