Installing and Configuring Apache2 + PHP5 + MySQL + XDebug & Eclipse + PDT + XDebug on Ubuntu 7.10
In this topic, I will tell you how to install and configure Apache2 + PHP5 + MySQL + virtual hosts + xdebug, as well as XDebug in Eclipse + PDT.
Install MySQL
Open the terminal and write with pens:
1.
2. After installation, the dialog for creating the root password for MySQL should open, if this does not happen, then write:
where XXXX is your password
3. Now install the GUI for managing the MySQL database:
MySQL is installed.
Install Apache2 and PHP5
Again, make the pens:
1.
2. Now connect to the new php5 apache, along with the libraries for working with MySQL and graphics:
3. After installation, restart the Apache:
Check the performance of our web server - go to the browser and write :
localhost / apache2-default An
inscription should appear: “It works!”.
Default directories:
/ var / www / - scripts and user files;
/ etc / php5 / and / etc / apache2 / - configuration files php5 and apache2;
4. Check the performance of PHP5. Create the phpinfo.php file: Enter the following
into it:
5. Save it and go to the link: localhost / phpinfo.php
If the info about php5 appears - everything is ok! We
configure Virtual Hosts for Apache2
1. Enter in the terminal:
2.
3.We will comment out everything that is after the line "NameVirtualHost 127.0.0.1:80" (put the line "#" at the beginning of the line);
4. Here I will show 3 ways to create virtual hosts. At the end of the file, add the following lines: Do not forget to create the directories specified in DocumentRoot'ah. 5. Go to System> Administration> Network. Go to the "Sites" tab. We are looking for the ip-shnik "127.0.0.1". Have you chosen? - click "Properties". Add the following entries: localhost namebased 6. Next, click “Add” and enter the ip-address to which we want the ipbased host to respond. In the field "Aliases" enter: ipbased 7. 8. That's it! Check hosts: ipbased , localhost , namebased , 127.0.0.1 , http: // [ip-address of the ipbased host] Install XDebug and connect it to PHP5
If you installed Apache and Php according to the instructions above, then it's time to show how to install and glue the xdebug debugger to this:
1. In the terminal, enter:
2. Next:
3. Now open php.ini:
XDebug is in / usr / lib / php5 / 20060613 + lfs / (if you installed the server, follow these instructions). Perhaps the last directory may be different. Want - find :).
Small tuning for the current item:
So, we write at the end of the php.ini file (xdebug.ini, if you used tuning number 2) the following: That's it. We are done with the server :) Install Eclipse + PDT and configure XDebug 1 in it . Download Eclipse SDK v3.3.1.1:
2. Unpack the eclipse into the directory of your choice, launch it and go to Help> Software Updates> Find and Install
3. Select "Search for new features to install"
4. In the next window, click "New Remote Site ..."
5. In the "Name" field, enter "PDT Updates", and in the "URL" - " download.eclipse.org / tools / pdt / updates . " We check all the mirrors. Next>
6. As soon as the search is over, open “PDT Updates” and check the box next to “PDT SDK ...”. Also do not forget to click "Select Required" to install the necessary components
7. Restart Eclipse
8. Go to Window> Open Perspective> PHP. If there is such a menu item - everything is ok. If not, try these options:
9. Go to Window> Prefernces ...> PHP> PHP Servers.
10. Click "New." In the "Name" field, enter "My Site On localhost", below - " localhost ". Next Finish
11. Now go to Window> Prefernces ...> PHP> Debug. We select the following settings:
PHP Debugger: XDebug
Server: My Site On localhost
PHP Executable: None Defined
12. Go to Window> Prefernces ...> General> Web Browser. If the checkbox “Use internal Web Browser” is hidden, then click “New” and add your favorite browser.
13. That's it! We create a PHP project and rejoice. If we are not happy, we smoke manuals on www.eclipse.org :)
I hope I haven’t forgotten anything;)
Used sources
Ubunters forum
Obout blog
Eclipse
Install MySQL
Open the terminal and write with pens:
1.
sudo apt-get install mysql-server
2. After installation, the dialog for creating the root password for MySQL should open, if this does not happen, then write:
sudo mysqladmin -u root password XXXX
where XXXX is your password
3. Now install the GUI for managing the MySQL database:
sudo apt-get install mysql-admin
MySQL is installed.
Install Apache2 and PHP5
Again, make the pens:
1.
sudo apt-get install apache2
2. Now connect to the new php5 apache, along with the libraries for working with MySQL and graphics:
sudo apt-get install php5 libapache2-mod-php5 libapache2-mod-auth-mysql php5-mysql php-image-graph imagemagick
3. After installation, restart the Apache:
sudo /etc/init.d/apache2 restart
Check the performance of our web server - go to the browser and write :
localhost / apache2-default An
inscription should appear: “It works!”.
Default directories:
/ var / www / - scripts and user files;
/ etc / php5 / and / etc / apache2 / - configuration files php5 and apache2;
4. Check the performance of PHP5. Create the phpinfo.php file: Enter the following
sudo gedit /var/www/phpinfo.php
into it:
5. Save it and go to the link: localhost / phpinfo.php
If the info about php5 appears - everything is ok! We
configure Virtual Hosts for Apache2
1. Enter in the terminal:
sudo /etc/init.d/apache2 stop
2.
sudo gedit /etc/apache2/sites-available/default
3.We will comment out everything that is after the line "NameVirtualHost 127.0.0.1:80" (put the line "#" at the beginning of the line);
4. Here I will show 3 ways to create virtual hosts. At the end of the file, add the following lines: Do not forget to create the directories specified in DocumentRoot'ah. 5. Go to System> Administration> Network. Go to the "Sites" tab. We are looking for the ip-shnik "127.0.0.1". Have you chosen? - click "Properties". Add the following entries: localhost namebased 6. Next, click “Add” and enter the ip-address to which we want the ipbased host to respond. In the field "Aliases" enter: ipbased 7. 8. That's it! Check hosts: ipbased , localhost , namebased , 127.0.0.1 , http: // [ip-address of the ipbased host] Install XDebug and connect it to PHP5
ServerAdmin webmaster@localhost
DocumentRoot /var/www/localhost/www
ServerName localhost
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
ServerAdmin webmaster@localhost
DocumentRoot /var/www/ipbased/www
ServerName ipbased
ErrorLog /var/log/apache2/error.log
TransferLog /var/log/apache2/access.log
ServerAdmin webmaster@localhost
DocumentRoot /var/www/namebased/www
ServerName namebased
ErrorLog /var/log/apache2/error.log
TransferLog /var/log/apache2/access.log
sudo /etc/init.d/apache2 start
If you installed Apache and Php according to the instructions above, then it's time to show how to install and glue the xdebug debugger to this:
1. In the terminal, enter:
sudo apt-get install php-pear php5-dev
2. Next:
sudo pecl install xdebug
At this point, an error like the following might pop up:
pecl.php.net is using a unsupported protocal - This should never happen.
install failed
It is treated with the following commands:# cd `pear config-get php_dir`
# mv .channels .channels-broken
# pear update-channels
3. Now open php.ini:
sudo gedit /etc/php5/apache2/php.ini
XDebug is in / usr / lib / php5 / 20060613 + lfs / (if you installed the server, follow these instructions). Perhaps the last directory may be different. Want - find :).
Small tuning for the current item:
- tuning number 1:
By default, extensions are stored in a directory of the form / usr / lib / php5 / 20060613 + lfs. I don’t like this way, so I suggest changing the directory to / usr / lib / php5 / ext and writing the changes in php.ini
sudo gedit /etc/php5/apache2/php.ini
Replace; extension_dir = '. /' With extension_dir = “/ usr / lib / php5 / ext /”.
Thanks S2nek . - tuning number 2:
I would suggest putting the lines regarding xdebug in /etc/php5/conf.d/xdebug.ini. It’s really more convenient.
Thanks develop7 .
So, we write at the end of the php.ini file (xdebug.ini, if you used tuning number 2) the following: That's it. We are done with the server :) Install Eclipse + PDT and configure XDebug 1 in it . Download Eclipse SDK v3.3.1.1:
zend_extension="/usr/lib/php5/20060613+lfs/xdebug.so" ;("/usr/lib/php5/ext/xdebug.so", если использовали тюннинг №1)
xdebug.remote_enable=1
xdebug.profiler_output_dir = "/home/yourhome/projects/tmp_xdebug" ;здесь директория для сохранения результатов профилировщика
2. Unpack the eclipse into the directory of your choice, launch it and go to Help> Software Updates> Find and Install
if, at startup, the eclipse makes a fuss that it says “there is no Java” :), then we type the following command in the terminal with the handles:sudo apt-get install sun-java6-jdk
3. Select "Search for new features to install"
4. In the next window, click "New Remote Site ..."
5. In the "Name" field, enter "PDT Updates", and in the "URL" - " download.eclipse.org / tools / pdt / updates . " We check all the mirrors. Next>
6. As soon as the search is over, open “PDT Updates” and check the box next to “PDT SDK ...”. Also do not forget to click "Select Required" to install the necessary components
7. Restart Eclipse
8. Go to Window> Open Perspective> PHP. If there is such a menu item - everything is ok. If not, try these options:
- 1st option:
I got this problem due to the java virtual machine. I installed java-6-sun, then installed eclipse + pdt. PHP Perspectives was absent (although I installed All in one)
As a result, the command helped:sudo update-alternatives --config java
I chose java-6-sun installed there, launched Eclipse - voila. everything is
Thanks ewgRa . - 2nd option:
We go syudy
9. Go to Window> Prefernces ...> PHP> PHP Servers.
10. Click "New." In the "Name" field, enter "My Site On localhost", below - " localhost ". Next Finish
11. Now go to Window> Prefernces ...> PHP> Debug. We select the following settings:
PHP Debugger: XDebug
Server: My Site On localhost
PHP Executable: None Defined
12. Go to Window> Prefernces ...> General> Web Browser. If the checkbox “Use internal Web Browser” is hidden, then click “New” and add your favorite browser.
13. That's it! We create a PHP project and rejoice. If we are not happy, we smoke manuals on www.eclipse.org :)
I hope I haven’t forgotten anything;)
Used sources
Ubunters forum
Obout blog
Eclipse