Although I have previously set up eclipse + PHP + MySQL + Apache in ubuntu11.04, I recently came into contact with PEAR and Amarty, I want to install these two plug-ins before I find that a lot of things have not been installed, so I just got everything done for a long time. Just record it.
1. PEAR
The installation of pear is actually quite simple, and his official website also provides a very detailed explanation. Simplified as follows:
1. Install the SDK.
1
$ Sudo wget http://pear.php.net/go-pear.phar
2
$ Sudo php go-pear.phar
2. Check whether pear is working and input "pear" on the terminal. If it is normal, the following items should be displayed:
1
$ Pear
2
Commands:
3
Build an Extension From C Source
4
Bundle Unpacks a Pecl Package
5
Channel-add Add a Channel
6
Channel-alias Specify an alias to a channel name
7
Channel-delete Remove a Channel From the List
8
Channel-discover Initialize a Channel from its server
9
...
3. Check the path. In the root directory of the server,/var/www/, create a PHP file and write the following content:
1
<? Php
2
Require_once 'System. php ';
3
Var_dump (class_exists ('system', false ));
4
?>
If the path is correct, open the file in the browser.
1
Bool (true)
If a warning error occurs, the path is incorrect. You need to modify include_path in the php. ini file. Enter the following content on the terminal to find the location of the php. ini file.
1
$ Php -- ini
Enter the following content on the terminal to find the location of the pear.
$ Php-c/path/to/php. ini-r 'echo get_include_path (). "\ n ";'
After modification, remember to restart apache:
1
Sudo/etc/init. d/apache2 restart
Ii. Smarty
1. Download Smarty in http://www.smarty.net/download, and find a convenient place to decompress.
2. Create a Smarty folder in the root directory of the server, and copy the files in the lib directory under the decompressed package.
3. Create an application directory under the root directory. Create the myapp directory under the root directory (which can be obtained at Will) and create the smarty directory under myapp. Create Four folders in the smarty Directory: templates, templates_c, cache, and config. (Although I don't know why it should be created, it seems necessary ).
4. Create the myapp/smarty. PHP file and tell the PHP program to contain the Smarty file and the location of the application.
1
<? Php
2
$ Base_path = basename (dirname (_ FILE __));
3
Require ('/var/www/Smarty. class. php'); // This is where you copy files from the lib directory.
4
$ Smarty = new Smarty ();
5
$ Smarty-> template_dir = $ base_path. '/smarty/templates ';
6
$ Smarty-> compile_dir = $ base_path. '/smarty/templates_c ';
7
$ Smarty-> cache_dir = $ base_path. '/smarty/cache ';
8
$ Smarty-> config_dir = $ base_path. '/smarty/configs ';
9
?>
Then, the file require_once can use Smarty.
Iii. smartypdt.
Smartypdt is a plug-in that enables eclipse to better support smarty, including syntax highlighting and code completion. However, smartypdt requires eclipse to use zend debugger, But I installed Xdebug and had to unload and reinstall it.
[Zend Debugger]
1. Uninstall xdebug
Www.2cto.com
$ Sudo apt-get remove php5-xdebug
2. Download Zend Debugger: Release. I am using PHP 5.3.5, so I am looking for ZendDebugger. so in the 5_3_x_comp folder, and then copy it to the/usr/lib/php5/20090626 + lfs/directory.
3. Configure the PHP. ini file and add
1
[Zend Debug]
2
Zend_extension =/usr/lib/php5/20090626 + lfs/ZendDebugger. so
4. Copy the dummy. php file in the software package to the root directory of the server.
5. Restart the server
6. Then it is about eclipse.
Window-> preferences-> PHP-> Debug-> PHP Debuger select Zend Debugger
Window-> preferences-> PHP-> Editor-> php Executables-> Add, the configuration is as follows:
Name: PHP 5.3.5 (CLI) (you can obtain one by yourself)
Executable path:/usr/bin/php
SAPI Type: CLI
PHP Debugger: Zend Debugger
Here, Zend dedebugger is installed completely.
[Smartypdt]
1. Download http://code.google.com/p/smartypdt/downloads/list here
2. In eclipse, Help-> Install New Software-> Add...-> Archive, select the smartypdt file you downloaded (you do not need to decompress it), and just give it a name. If "Group items by category" is selected after OK, cancel it and you will see that a software named "Smarty Feature" can be installed, click Next or Finish.
3. Window-> Preferences-> General-> Content Type: Check whether HTML and PHP Content Type are associated with *. tpl. If yes, cancel it.
5. Open the PHP release E Section, select the PHP project, right-click and choose Configure> Add Smarty Support.
Now, you can use smartypdt.