📜 ⬆️ ⬇️

Installing and configuring Apache2 + PHP5 + MySQL + XDebug & Eclipse + PDT + XDebug in Ubuntu 7.10

In this topic, I will explain 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. sudo apt-get install mysql-server
2. After installation, a dialog to create a root-password for MySQL should open; if this does not happen, then we write:
sudo mysqladmin -u root password XXXX
where XXXX is your password
3. Now install the GUI to manage the MySQL database:
sudo apt-get install mysql-admin
MySQL is installed.

Install Apache2 and PHP5
Again we make pens:
1. sudo apt-get install apache2
2. Now let's connect to the newly-made Apache php5, 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 Apache:
sudo /etc/init.d/apache2 restart
We check the performance of our web server - go to the browser and write:
localhost / apache2-default
Should appear the inscription: "It works!".
Default directories:
/ var / www / - user scripts and files;
/ etc / php5 / and / etc / apache2 / - configuration files php5 and apache2;
4. We check the performance of PHP5. Create a phpinfo.php file:
sudo gedit /var/www/phpinfo.php
In it we bring the following:
<?php phpinfo(); ?>
5. Save it and follow the link: localhost / phpinfo.php
If there was information about php5 - everything is OK!
')
Configuring Virtual Hosts for Apache2
1. Enter in the terminal:
sudo /etc/init.d/apache2 stop
2. sudo gedit /etc/apache2/sites-available/default
3. Let's comment on everything that exists after the line “NameVirtualHost 127.0.0.1:80” (put "#" at the beginning of the line);
4. Here I will show 3 ways to create virtual hosts. At the end of the file we add the following lines:
<VirtualHost 127.0.0.1:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/localhost/www
ServerName localhost
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
</VirtualHost>

<VirtualHost ipbased>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/ipbased/www
ServerName ipbased
ErrorLog /var/log/apache2/error.log
TransferLog /var/log/apache2/access.log
</VirtualHost>

<VirtualHost 127.0.0.1:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/namebased/www
ServerName namebased
ErrorLog /var/log/apache2/error.log
TransferLog /var/log/apache2/access.log
</VirtualHost>

Do not forget to create the directories specified in DocumentRoot.
5. Go to System> Administration> Network. Go to the "Nodes" tab. We are looking for ip-shnik "127.0.0.1". Chose? - click "Properties". We add such records:
localhost
namebased

6. Next, click "Add" and enter the ip-Schnik to which we want the host to respond "ipbased". In the "Aliases" enter:
ipbased
7. sudo /etc/init.d/apache2 start
8. Everything! Check hosts: ipbased , localhost , namebased , 127.0.0.1 , http: // [ip-address of the host ipbased]

Install XDebug and connect it to PHP5
In case you installed apache and pkhp according to the above instructions, then it’s time to show how to install and paste the xdebug debugger to this whole thing:
1. In the terminal, enter:
sudo apt-get install php-pear php5-dev
2. Further:
sudo pecl install xdebug
At this stage, the following error may 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, using these instructions). Perhaps the last directory may be different. Want to - find :).
A little tuning on the current item:

So, we write the following at the end of the php.ini file (xdebug.ini, if we used tuning No. 2):
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" ;

Everything. With the server finished :)

Install Eclipse + PDT and configure XDebug in it
1. Download Eclipse SDK v3.3.1.1:

2. Unpack the eclipse in the directory of your choice, launch it and go to the menu Help> Software Updates> Find and Install
if at launch Eclipse scribbles, saying that “but there is no java” :), then we type the following command in the terminal:
sudo apt-get install sun-java6-jdk

3. Choose "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 tick all the mirrors. Next>
6. As soon as the search is over, open the “PDT Updates” and tick the “PDT SDK ...” box. Also, do not forget to click "Select Required" to install the necessary components.
7. Reboot 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 field "Name" enter "My Site On localhost", below - " localhost ". Next. Finish.
11. Now go to Window> Prefernces ...> PHP> Debug. 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 tick "Use internal Web Browser" is hidden, then click "New" and add your favorite browser.
13. Everything! Create a PHP project and enjoy it. If we are not happy, we smoke manuals on www.eclipse.org :)

I hope I have not forgotten anything;)

Used sources
Ubuntov Forum
Obout blog
Eclipse

Source: https://habr.com/ru/post/20736/


All Articles