Build an Eclipse-based php development environment in Ubuntu

Source: Internet
Author: User
Tags php development environment phpinfo
Step 1: first install eclipsesudoapt-getinstalleclipse, enter java-version in the shell to test whether the installation and configuration are successful. then install LAMP1. If you install it on the local machine for testing, make sure that the hosts content is www.linuxidc.com @ Ubuntu :~ $ Cat/etc/hosts127.0.0.1 & n

Step 1: first install eclipse
Sudo apt-get install eclipse
Enter java-version in shell.
Test whether the installation and configuration are successful
Install LAMP

1. if you install it on the local machine for testing, it is best to ensure that the hosts content is as follows:
Www.linuxidc.com @ Ubuntu :~ $ Cat/etc/hosts
127.0. 0.1 localhost
Www.linuxidc.com @ ubuntu :~ $ Cat/etc/hosts
127.0.0.1 localhost

2. Careful manual installation (minimum component)
Www.linuxidc.com @ ubuntu :~ $ Sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server
Www.linuxidc.com @ ubuntu :~ $ Sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server
Some of them are automatically installed because of dependencies, but they are more suitable for insurance purposes. At the beginning of installation, sudo will ask you for the password (only possible), which is the password of the system administrator. During installation, MySQL requires a password for the account, which is irrelevant to the operating system. In linux, phpmyadmin cannot use a blank password.
Open http: // localhost

3. Install phpmyadmin
Www.linuxidc.com @ ubuntu :~ $ Sudo apt-get install phpmyadmin
Www.linuxidc.com @ ubuntu :~ $ Sudo apt-get install phpmyadmin
Save and restart apache2
Www.linuxidc.com @ ubuntu :~ $ Sudo/etc/init. d/apache2 restart
Www.linuxidc.com @ ubuntu :~ $ Sudo/etc/init. d/apache2 restart
Enter http: // localhost/phpmyadmin in the browser
Phpmyadmin is not installed under/var/www by default, but in/usr/share/phpmyadmin
You can copy or link phpmyadmin.
Www.linuxidc.com @ ubuntu :~ $ Sudo ln-s/usr/share/phpmyadmin/var/www/phpmyadmin
Sudo gedit/etc/phpmyadmin/apache. conf
Www.linuxidc.com @ ubuntu :~ $ Sudo ln-s/usr/share/phpmyadmin/var/www/phpmyadmin
Sudo gedit/etc/phpmyadmin/apache. conf
Then, change the path of the following two sentences to/var/www/phpmyadmin (because I have configured the environment, I forgot how to write the default configuration in phpmyadmin .. There are two sentences in the third and fourth rows. If I remember correctly, it should be the following:
Alias/phpmyadmin/usr/share/phpmyadmin

Alias/phpmyadmin/usr/share/phpmyadmin
Change
Alias/phpmyadmin/var/www/phpmyadmin

Alias/phpmyadmin/var/www/phpmyadmin

LAMP has been configured.

4. Test phpinfo (). (You can choose one or more based on your needs)
Www.linuxidc.com @ ubuntu :~ $ Sudo gedit/var/www/info. php

Open http: // localhost/info. php
Www.linuxidc.com @ ubuntu :~ $ Sudo gedit/var/www/info. php

5. Create a PHP5 project, which is not stored in the/var/www directory. Compile a php file, but cannot run or debug it. The reason is that PHP5 is the server script language and runs on the server. Eclipse is not automatically associated with The Apache2 server here, And the php source code is not stored in the/var/www directory. The solution is as follows:
Configure Apache in Ubuntu to support virtual directories and write the following content in the/etc/apapche2/httpd. conf file:
ServerName localhost
Alias/PHP "/home/XXX/workspace/PHP"

Options Indexes FollowSymLinks Multiviews
AllowOverride None
Order allow, deny
Allow from all

ServerName localhost
Alias/PHP "/home/XXX/workspace/PHP"

Options Indexes FollowSymLinks Multiviews
AllowOverride None
Order allow, deny
Allow from all

Note that if there is/behind/web, there must be/behind the physical path /. When the virtual directory name is the same as the php project directory name In workspace, you can directly run the test on eclipse.

When running the PHP file in the virtual directory in the browser, add the virtual directory. If the virtual directory is/PHP (as shown in the preceding example), http: // localhost/php/*. PHP.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.