Home Backend Development PHP Tutorial PHP环境搭配(二):lamp(linux+apache+mysql+php)搭建,附moodle与onlinejudge配置

PHP环境搭配(二):lamp(linux+apache+mysql+php)搭建,附moodle与onlinejudge配置

Jun 23, 2016 pm 02:37 PM

  linux相比windows更安全,更稳定,而且是开源的,所以常作为服务器系统使用。因此,搭配lamp也是不可或缺的能力哦。不过,对于不熟悉linux系统的童鞋还是有点困难的。

一、准备工作。

ubuntu-12.04.1-desktop-i386.iso

二、安装ubuntu

  ubuntu是linux系统的一种,因有强大的桌面系统在最近越来越火,不过作为服务器用的话CentOS也是不错的选择

使用虚拟机加载ubuntu-12.04.1-desktop-i386.iso镜像文件,然后一直安装就行。安装完之后默认是英文界面,不熟悉英文界面的童鞋可以上网搜搜怎么改成中文界面。

安装好之后进入桌面按windows键输入“te”找到终端命令并把它拖到菜单栏里

三、安装mysql

进入终端,首先输入 sudo su进入权限模式,再输入 apt-get install mysql-server mysql-client确认安装即可

四、安装apache2

继续输入 apt-get install apache2确认安装即可

  这里要说明一下的就是ubuntu下的apache默认网页执行文件夹在/var/www/下面,配置文件在/etc/apache2/apache2.conf,配置文件子目录在/etc/apache2/下

  进入火狐浏览器,键入http://localhost,出现It works!代表安装成功

五、安装php

继续输入 apt-get install php5 libapache2-mod-php5确认安装即可

重启apache,输入/etc/init.d/apache2 restart

建立新的网页,vi /var/www/info.php,添加内容保存即可,也可以apt-get install gedit ,然后gedit /var/www/info.php

  进入火狐浏览器,键入http://localhost/info.php,出现php属性页面代表安装成功

六、安装phpmyadmin

  phpmyadmin可以在网页上管理数据库,十分方便

继续输入 apt-get install phpmyadmin

输入 cp -rf /usr/share/phpMyAdmin /var/www/

  进入火狐浏览器,键入http://localhost/phpmyadmin,出现phpmyadmin页面代表安装成功

附一、安装moodle

  moodle是一个很强大的教学用系统,里面集成了很多考试、测试之类的插件,就是用起来比较麻烦而已。

继续输入 apt-cache Search php5

安装PHP的各种库 apt-get install php5-mysql php5-curl php5-gd php5-idn php-pear php-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

创建moodledata文件夹 mkdir /var/moodledata

下载moodledata解压到/var/www/下

更改文件夹权限 chmod 777 /var/moodledata

                 chmod 777 /var/www/moodle

  进入火狐浏览器,键入http://localhost/moodle,出现moodle页面代表安装成功

附二、安装onlinejudge

  onlinejudge在线评测系统,程序设计的训练与比赛平台,因开发难度和移植性等等比较难搭建。这里介绍一个开源的OJ-hustoj http://code.google.com/p/hustoj/

在ubuntu下依次键入以下命令安装即可:

sudo apt-get update&& sudo apt-get install subversion
sudo yum update&& sudo yum install subversion.i386
svn checkout http://hustoj.googlecode.com/svn/trunk/install hustoj
cd hustoj
编辑install.sh和web/include/db_info.inc.php,设定数据库用户名密码后
sudo ./install.sh

  进入火狐浏览器,键入http://localhost/onlinejudge,出现onlinejudge页面代表安装成功,使用管理员账号root登陆后台进行测试查看评测系统是否能运作,其他相关问题查看http://code.google.com/p/hustoj/wiki/FAQ

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

How does session hijacking work and how can you mitigate it in PHP? How does session hijacking work and how can you mitigate it in PHP? Apr 06, 2025 am 12:02 AM

Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.

Describe the SOLID principles and how they apply to PHP development. Describe the SOLID principles and how they apply to PHP development. Apr 03, 2025 am 12:04 AM

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to debug CLI mode in PHPStorm? How to debug CLI mode in PHPStorm? Apr 01, 2025 pm 02:57 PM

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...

Framework Security Features: Protecting against vulnerabilities. Framework Security Features: Protecting against vulnerabilities. Mar 28, 2025 pm 05:11 PM

Article discusses essential security features in frameworks to protect against vulnerabilities, including input validation, authentication, and regular updates.

How to automatically set permissions of unixsocket after system restart? How to automatically set permissions of unixsocket after system restart? Mar 31, 2025 pm 11:54 PM

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

See all articles