Home > Backend Development > PHP Tutorial > Ubuntu PHP基础环境配置(含Memcached)

Ubuntu PHP基础环境配置(含Memcached)

WBOY
Release: 2016-06-23 13:38:51
Original
744 people have browsed it

首先,自然是安装Apache

sudo apt-get install apache2

之后,启动服务

sudo /etc/init.d/apache2 start


然后是PHP

sudo apt-get install libapache2-mod-php5 php5

如果你需要,还可以继续安装GD库

sudo apt-get install php5-gd

php5-mysql等其它库类似,不一一列举了。


重启服务

sudo /etc/init.d/apache2 restart


接着是mysql

sudo apt-get install mysql-server mysql-client


这个时候基础环境就OK了。你可以访问http://127.0.0.1 测试一下。



然后继续memcached 安装
sudo apt-get install memcached

memcached 参数说明
memcached -d -m 50 -p 11211 -u root
-m 指定使用多少兆的缓存空间;-p 指定要监听的端口; -u 指定以哪个用户来运行

安装php-memcache模块
sudo apt-get install php5-memcache

编辑配置文件
sudo vi /etc/php5/conf.d/memcache.ini

;uncomment the next line to enable the module
extension=memcache.so

[memcache]
memcache.dbpath="/var/lib/memcache"
memcache.maxreclevel=0
memcache.maxfiles=0
memcache.archivememlim=0
memcache.maxfilesize=0
memcache.maxratio=0


:wq! 退出 vi 即可。


在phpinfo()查看配置好的环境吧!


备用,如果安装过程中出错,还可以试试


卸载php:

    sudo apt-get autoremove php5-common

卸载 mysql:

    sudo aptitude purge mysql-server mysql-server-5.0


强制卸载apache2.2:

    $ sudo apt-get --purge remove apache2.2-common

    $ sudo apt-get --purge remove apache2.2



source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template