歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

Linux 架設LAMP

1>CentOS

yum install mysql mysql-server

chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
mysql_secure_installation
yum install httpd
chkconfig --levels 235 httpd on
/etc/init.d/httpd start
yum install php
/etc/init.d/httpd restart
vi /var/www/html/info.php
在 CentOS 中
Apache 的默認根目錄是 /var/www/html
配置文件 /etc/httpd/conf/httpd.conf
其他配置存儲在 /etc/httpd/conf.d/
<?php
phpinfo();
?>
yum search php
yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc

/etc/init.d/httpd restart

2>Ubuntu

1.安裝 Apache
sudo apt-get install apache2
2.測試 Apache
http://localhost/
3.安裝 PHP5
sudo apt-get install php5 libapache2-mod-php5
sudo /etc/init.d/apache2 restart
4.測試 PHP
sudo gedit /var/www/testphp.php
<?php phpinfo(); ?>
http://localhost/testphp.php
5.安裝 MySQL
sudo apt-get install mysql-server
mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin




Copyright © Linux教程網 All Rights Reserved