Posts Tagged XDebug

TYPO3 on Windows localhost with Subversion and XDebug

SVN Client side

Prerequisites: a remote svn repository with all your typo3 sources.

Download TortoiseSVN at http://tortoisesvn.net/downloads

Clicking on the file saved will automatically install the SVN client on the windows environment.

Download XAMPP at http://www.apachefriends.org/en/xampp-windows.html
Click on the saved file and an icon will ask where to extract the files; extract them to c:\Program Files.

The system will save the files into the C:\Program Files\xampp.
Open the folder and click the setup_xampp.bat; this will configure all files to work correctly in your system like the php.ini needed by apache web server.

Xampp default installation installs webserver Apache2 too.

Right click on the desktop, on the menu select the SVN Checkout and change these values:

  • URL of Repository: http://your-svn-repository/repositoryname
  • Checkout Directory: c:\…xampp\htdocs

Once the checkout ends, users can find all source code inside their working area in c:\…xampp\htdocs\

Setting Data Base Access:

In the foder typo3conf there is a file named localconf.php, open it and make the following changes:

$typo_db_username = “root”;
$typo_db_password = “”;
$typo_db_host = ‘localhost’;
$typo_db = ‘your-typo3-database‘;

Note: to rollback to a previous version with Tortoise SVN see our related post.

Installing Junction

Junction is a tool thank to which users can take advantage of symbolic link on window.

It is available to http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx and it is a simple exe file that will be executed when needed to create symbolic links typo3 needs to run without problem.

Junction configuration

After downloading the repository the following symbolic links where created to work with TYPO3:

  • junction -s c:htdocs c:Program Files\xampp\htdocs
  • junction -s c:Program Files\xampp\htdocs\t3lib\ c:Program Files\xampp\htdocs\typo3_src-version\t3lib
  • junction -s c:Program Files\xampp\htdocs\typo3\ c:Program Files\xampp\htdocs\typo3_src-version\typo3

Database settings

The structure of the production database is too heavy for a local environment so it was performed a dump of the production database only with CREATE statement avoiding so all the INSERT statements which would take too hard disk space problems and the query execution very slow.

The files created are stored in the subversion repository and to execute the batch file we need a Xampp installation with a working and a loaded mysql process.

You can create a mysqlbuild.bat. Clicking on it will execute all sql commands necessary to create the typo3 database structure.

The file will execute the following commands:

c:

CD C:\Program Files\xampp\mysql\bin

mysqladmin -u root create typo3-database

mysql -u root typo3-database < “C:\htdocs\sql_fixtures\structure.sql”

mysql -u root typo3-database < “C:\htdocs\sql_fixtures\be_users.sql”

mysql -u root typo3-database < “C:\htdocs\sql_fixtures\pages.sql”

mysql -u root typo3-database < “C:\htdocs\sql_fixtures\static_template.sql”

mysql -u root typo3-database < “C:\htdocs\sql_fixtures\sys_template.sql”

mysql -u root typo3-database < “C:\htdocs\sql_fixtures\tx_templavoila_datastructure.sql”

mysql -u root typo3-database < “C:\htdocs\sql_fixtures\tx_templavoila_tmplobj.sql”

(Note: the .sql files are store in the sql_fixtures folder)

Thank to this file a local copy of the database will be available for development purpose

XDEBUG – phpDesigner2008

  • Note: the following settings could be applied with different IDEs.
  • Download the Xdebug dll located in http://www.xdebug.org/download.php; the version you have to install is the 5.2 VC6 that will work fine with the latetest release of Xampp (In this guide we refer to Xampp Windows version 1.7.0)
    Save the dll file into the folder C:\Program Files\xampp\php\ext\
  • Go into the C:\Program Files\xampp\php folder
    We need to modify here the php.ini in this way:
    - In the [Zend] section comment all the lines putting a ; at the line beginning
    - In the [Xdebug] section you must have this lines:
    zend_extension_ts=”C:\Program Files\xampp\php\ext\php_xdebug-2.0.4-5.2.8.dll”
    xdebug.remote_enable=true
    xdebug.remote_host=127.0.0.1
    xdebug.remote_port=9000
    xdebug.remote_handler=dbgp
    xdebug.profiler_enable=1
    xdebug.profiler_output_dir=”C:\Program Files\xampp\tmp”
  • Copy and paste the C:\Program Files\xampp\php\php.ini into C:\Program Files\xampp\apache\bin (overwriting the existing php.ini)
  • Open the C:\Program Files\xampp\xampp-control.exe and a tray icon will appear by which we can control xampp services like mysql and apache. To verify Xampp is working fine open a browser like Firefox and type http://localhost/xampp/; if installation goes fine you should see the xampp welcome page.
  • Go in C:\Program Files\xampp\htdocs and move all existing files in another folder: you can perform this creating a new temporary folder under htdocs named /temp and cut and paste the files under /htdocs into /htdocs/temp.

Firefox configuration

  • Download Firefox add-on located in https://addons.mozilla.org/en-US/firefox/addon/3960
  • Once the installation is finished, in Firefox go to the menu Tools -> Add-ons and select the Options button under Xdebug Helper addon to access the setup page.
  • In the first text box of the add-on be sure these lines are present:
    zend_extension_ts=php_xdebug.dll
    xdebug.remote_enable=1
    xdebug.remote_handler=dbgp
    xdebug.remote_mode=req
    xdebug.idekey=default
  • In the second text box insert phpDesigner2008. This key represents the Xdebug idekey value that allows firefox understanding which integrated development environment (IDE) we will use to start the debug mode (users can install also Eclipse, Netbeans, etc.)
  • The extension will insert an icon in the status bar: clicking on it the linkage with Xdebug will be active or disabled.
    If the icon is green firefox will run pages in debug mode.

NOTE:

It’s important to know that the debug mode runs from firefox. The first thing to do is to light the new icon present in the status bar.

Once the light became green the user has to insert into the address bar the link he wants to access in debug mode (e.g. 127.0.0.1/typo3/backend.php). Firefox doesn’t load the page until users presses F7 (debug mode to see work flow line by line) or F9 (debug mode to see where code breaks) in phpDesigner2008.

PhpDesigner2008 configuration

Create the project selecting the folder C:\Program Files\xampp\htdocs; phpDesigner will import all files located under the htdocs folder.

Open the menu Tools -> Preferences

Select Debugger and in the PHP panel insert

C:\Program Files\xampp\php\php-cgi.exe

under the Configuration panel insert

C:\Program Files\xampp\php\php.ini

Select Run (under debugger) and under the php panel write

C:\Program Files\xampp\php\php-cgi.exe

and under configuration panel insert

C:\Program Files\xampp\php\php.ini

Select localhost (under debugger) and under Server path write http://localhost while in Local Server Path write

C:\Program Files\xampp\htdocs

The port must be the 80.

, , , , , , , ,

1 Comment