Defaultlinuxtexprogramminglifeotherubuntu
Install apache2: sudo apt-Get install apache2 install PHP module: sudo apt-Get install PhP5 php5-gd edit test page :() sudo gedit/var/www/testphp. PHP install mysqlsudo apt-Get install mysql-servermysqladmin-u Root Password db_user_password # db_user_password Replace with password install MySQL module sudo apt-Get install libapache2-mod-auth-mysqlsudo apt-Get install php5-mysqlsudo apt-Get install php5-gdsudo/ ETC/init. d/apache2 restart configure PHP. INI: sudo gedit /Etc/PhP5/apache2/PHP. ini remove the # extension = mysql. So # extension = Gd. So # file after the file. Install phpmyadminsudo apt-Get install phpMyAdmin test: http: // localhost/PHPmyAdmin/Note that this may fail. You need this command: sudo ln-S/usr/share/phpMyAdmin // var/www/restart apachesudo/etc/init. d/apache2 restart
Possible problems in the process
# Mysql-uroot-penter password: Error 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: No) use the methods described on the Internet to change the password of the root user: # mysqladmin-uroot-P password 'newpassword' enter password: mysqladmin: connect to server at 'localhost' failederror: 'Access denied for user' root' @ 'localhost' (using password: Yes )'
Method 1:
#/Etc/init. d/MySQL stop # mysqld_safe -- user = MySQL -- skip-grant-tables -- skip-Networking & # mysql-u root mysqlmysql> Update user SET Password = PASSWORD ('newpassword ') where user = 'root'; mysql> flush privileges; mysql> quit #/etc/init. d/MySQL restart # mysql-uroot-penter password: <enter the new password newpassword> mysql>
Method 2:
Directly use/etc/MySQL/Debian. the user name and password provided in the [client] section of the CNF file: # mysql-udebian-sys-Maint-penter password: <enter the password in the [client] section> mysql> Update user SET Password = PASSWORD ('newpassword') where user = 'root'; mysql> flush privileges; mysql> quit # mysql-uroot-penter password: <enter the new password newpassword> mysql> quit
Possible problems in the process
Why does an error occur when http: // localhost/PHPmyAdmin/is enabled?
Not found the requested URL/PHPmyAdmin/was not found on this server. Apache/2.2.9 (UBUNTU) PHP/5.2.6-2ubuntu4 with suhosin-patch server at localhost port 80
This is because the default installation path of phpMyAdmin is not in/var/www/(/var/www/is the root directory of your web service site), so you can create a soft connection. The above command is to create a phpMyAdmin soft link under/var/www. The solution is as follows:
sudo ln -s /usr/share/phpmyadmin/ /var/www/
How to Use PHP
Note that ,. PHP files are files that need to be explained by the server, rather than directly running programs on local machines. Generally, you can use the Apache server, or asii server. For example, I did this by installing Apache on a local host, and then
Use
sudo /etc/init.d/apache2 start
After the local server is opened, you can access the local server through http: // localhost/. Then, you can open Hello under the directory of the local server. PHP, that is, http: // localhost/hello. PHP
The local address of localhost is/Var/WWW
Basic Apache Authentication
First, make sure that you want to set the user authentication folder, for example,/var/www/test /.
Remove the annotator before configuring accessfilename. htaccess in the/etc/apache2/apache2.conf file,
Add the following content to the configuration file apache2.conf or httpd. conf:
<Directory "/var/www/test/">Options Indexes MultiViewsAllowOverride AuthConfigAllow from all</Directory>
Create a. htaccess file in the/var/www/test/folder. The file content is
AuthName "You need to have the privilege to view this page ,Please log in : AuthType BasicAuthUserFile /etc/apache2/authpwd Require user maturn test #maturn
Create a password file and set a password for the user. Enter the command
htpasswd -c /etc/apache2/authpwd maturn
The authentication is basically completed. EnterLocalhost/testTo verify whether it is successful
Updated: 2010-02-20 |
Index |
|