NOTE: This page has been translated automatically from Russian to English. Original page.



Debugging exchange with web-site on the Bitrix

Often it is necessary to debug the exchange between 1C and web-site at Bitrix. Let us examine what tools there to do ...

I often have to deal with the integration of 1C with online shopping on Bitrix, and often there are strange situation when the exchange on the side of the site, and no single step takes a lot of time figuring out the causes of these errors ...

I'll tell you what I use in such cases.

What you will need:

1. Virutalnaya Bitrix machine, I use a version of VirtualBox

2. PHP development environment, I use phpStorm

Now what we do:

1. Install VirtualBox and run it in a virtual machine downloaded Bitrix, pre-configured network connection:

After starting the virtual machine, we will see the ip address of the virtual machine, using this address and go on a freshly deployed site

Then, by clicking on the address in the browser, we can either set up a new site, or immportirovat backup from another site ....

While the backup takes place, you want to include xdebug module virutalnoy car, he is already there, simply turned off. Go to BitrixVM console under root (default password bitrix). And add to /etc/php.d/15-xdebug.ini following text file:

 zend_extention = / usr / lib64 / php / modules / xdebug.so
xdebug.remote_enable = on
xdebug.remote_host = 192.168.99.150 // ip address of your computer
xdebug.remote_port = 9000
xdebug.idekey = phpstorm 

then? After restoring a backup site, you must restart the virtual machine.

to verify the correctness of the information can be viewed xdebug in /phpinfo.php, shall be as follows:


Now configure PhpStorm. Create a new project from existing files: File menu - New project from existing files ... and select the location of the files on a remote server via SFTP:

Then specify the name of the project and its path, further indicates the address http sftp and our Bitrix Virtual Machine, you will now be prompted to select the path to the sftp server download project files:

choose the path / home / bitrix / www and click ProjectRoot.

While the project synchronizes files, move on to the 1C:

We will need to add in the exchange plan B_ObmenSSaytom string props - KlyuchOtladki, 10 characters is sufficient, and to make this revision on the site form. And in the general module in B_ObschieProtseduryIFunktsiiObmenaSSaytom PoluchitDannyeSServera function to change the first lines of code as follows:

 If <> ParametryObmena.Ssylka.KlyuchOtladki "" Then,
		KodOtladki = "& XDEBUG_SESSION_START =" + ParametryObmena.Ssylka.KlyuchOtladki;
	otherwise
		KodOtladki = "";
	ENDIF;
	
	ImyaFaylaOtveta PoluchitImyaVremennogoFayla = ();
	
	Attempt
		
		Soedinenie.Poluchit (SokrLP (ParametryZaprosa) + KodOtladki, ImyaFaylaOtveta, SokrLP (headers));
		
	An exception
		
		SoobschitPodrobno ( "Failed to retrieve data from the server. Verify that the server address, port, user name and password," + Simvoly.PS + "and configure connection to the Internet." ParametryObmena)
		
	KonetsPopytki; 

Now we start our configuration debugging, shape node communications plan indicate KlyuchOtladki "phpstorm". In PhpStorm include waiting debug button:

Now includes a breakpoint at the desired exchange 1s code, for example:

and launching an exchange of 1C as soon as it comes to execution on the server of the site, in PhpStorm intercept and stop the execution on this line ...

There will be questions - ask!

1C:Enterprise Developer's Community