ubuntu14 php环境配置

前端之家收集整理的这篇文章主要介绍了ubuntu14 php环境配置前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

方法一:

1.更新ubuntu软件列表

  1. # apt-get update

2.安装apache

  1. # apt-get install apache2

3.安装PHP

  1. # apt-get install PHP5

4.安装MysqL

  1. # apt-get install MysqL-server

安装过程需要设置root密码

安装MysqL PHP扩展

  1. # apt-get install PHP5-MysqL

5.安装PHPmyadmin

  1. #apt-get install PHPmyadmin
  2. #ln -s /usr/share/PHPmyadmin /var/www/PHPmyadmin

install 安装的PHPmyadmin 项目一般在 /usr/share中,需要进行 ln -s /usr/share/PHPmyadmin /var/www/PHPmyadmin 复制并连接

注意: http://localhost 访问的是 /var/www/html/里面的index.PHP,所以需要修改配置

vim /etc/apache2/sites-enabled/000-default.conf

  1. <VirtualHost *:80>
  2. # The ServerName directive sets the request scheme,hostname and port that
  3. # the server uses to identify itself. This is used when creating
  4. # redirection URLs. In the context of virtual hosts,the ServerName
  5. # specifies what hostname must appear in the request's Host: header to
  6. # match this virtual host. For the default virtual host (this file) this
  7. # value is not decisive as it is used as a last resort host regardless.
  8. # However,you must set it for any further virtual host explicitly.
  9. #ServerName www.example.com
  10.  
  11. ServerAdmin webmaster@localhost
  12. DocumentRoot /var/www/html
  13.  
  14. # Available loglevels: trace8,...,trace1,debug,info,notice,warn,# error,crit,alert,emerg.
  15. # It is also possible to configure the loglevel for particular
  16. # modules,e.g.
  17. #LogLevel info ssl:warn
  18.  
  19. ErrorLog ${APACHE_LOG_DIR}/error.log
  20. CustomLog ${APACHE_LOG_DIR}/access.log combined
  21.  
  22. # For most configuration files from conf-available/,which are
  23. # enabled or disabled at a global level,it is possible to
  24. # include a line for only one particular virtual host. For example the
  25. # following line enables the CGI configuration for this host only
  26. # after it has been globally disabled with "a2disconf".
  27. #Include conf-available/serve-cgi-bin.conf
  28. </VirtualHost>

DocumentRoot /var/www/html 改为DocumentRoot /var/www,这样http://localhost将访问 /var/www目录下,PHPmyadmin的路劲为:http://localhost/PHPmyadmin/

6.重启MysqL,apache

  1. # service apache2 restart
  2. # service MysqL restart

方法二:

  1. # tasksel install lamp-server

猜你在找的Ubuntu相关文章