Showing posts with label wamp. Show all posts
Showing posts with label wamp. Show all posts

How to Fix the Socket Exception in Wamp2.2 and Netbeans

So I have this setup going on:

  • Windows 8 64bits
  • Wamp 2.2
  • PHP 5.4.3
  • Apache 2.4.4
  • And by default Xdebug  2.2.0-5.4-vc9
  • Netbeans 7.2 

The normal setup that comes with the new WAMP 2.2. When I was trying to debug a simple drupal project I got the tipical please  configure you php.ini according to this:

[xdebug]
xdebug.remote_enable = on
xdebug.remote_handler = dbgp
xdebug.remote_host = localhost
xdebug.remove_port = 9000

Nice, so I set up my PHP.INI  with the info above and start debuging again and BAM: Socket Exception on NetBeans with some instruction to disable watches. Thats the usuall stuff that netbeans tells when xdebug is not well configured.  So heres comes the solution:

Want to easily open up php.ini? Just leftclick your wampserver icon and navigate to it



THE MIGHTY SOLUTION:

1) Download the latest release of xdebug. Now you got to be very carefully chosing the adecuate file. In my case I downloaded : PHP 5.4 VC9 TS (64 bit).

Now, How do you choose the one?. Easy. The first part of the name is the version of PHP you use, so I have to choose those that start with PHP 5.4. Then comes the version of Visual Studio that this .dll has been compiled. Usually you got to choose the same one has your PHP and Apache have been compiled and for Wamp2.2 it is VC9. Now what about TS? TS means Thread Safe and for what I know is the one thats work well with newest apaches and phps. I downloaded another version (this one: PHP 5.4 VC9 (64 bit) , notice it doesnt say TS) that wasn't threat safe and I got the Netbeans message that It couldn't connect to the port.... so make sure is TS using my configuration above. Now dont forget the 64 bits part or 32bits part, its depend of the version of WAMP youre using.

2) Find this chain in your PHP.ini : zend_extension, comment it and add this one zend_extension = "c:/wamp/bin\php/php5.4.3/zend_ext/php_xdebug-2.2.3-5.4-vc9-x86_64.dll". And yes move your dowloaded xdebug to that address. And restart. 


 This is what's will look like your php.ini after the changes. Usually the xdebug info is at the bottom of your php.ini

3) Woalla, now youre debugging =).

Fixing Wamp and Undefined function pg_connect() in Windows7

So this is an update to my post on Fixing Wamp not so friendly extension.
I was trying to configure WAMP in WIndows7 so I can play with postgres 8.4. So I put on the extension php_pgsql and php_pdo_pgsql and it doest work.

To fix this you must find the libpq.dll file in C:\wamp\bin\php\php5.X.X whatever your version is) and put it on C:\Windows\System32 AND  to c:/wamp/bin/apache/apachex.x/bin (this is the difference with my post) .


 Please note that just in case you must install a WAMP of the same bitage that your postgres version. In my case Wamp 64 bits didnt work on my Postgres of 32 bits, so i reinstalled and used the Wamp of 32bit.

Hope it help anyone!

Easy Way to install PEAR and PHPUnit in WAMP 2.2 with Windows 7

Quite a big title but i found an easy way to install PEAR and PHPUnit in WAMP. I am really new about doing this but seems that it install them correctly. So here we go.

Preamble

Well make sure you have installed WAMP server on your PC. Its quite straightforward to install it so we are not making any special instruction to do it. Just download the installer, double click and select the browser you will want WAMP to use as default

Installing PEAR

  • First download the PEAR .phar file and put it in c/wamp/bin/php/php5.3.8. 
  • Now search for the windows console and open it up as an administrator. Take a look at the picture to give you an idea:
Searching for CMD and using it as an administrator
  • Now in CMD write this: cd C:\wamp\bin\php\php5.3.8 
  • After that write this: php gp-pear.phar
  • It will ask "Are you installing a system-wide PEAR or a local copy? write system and shot enter
  • It will output crazy stuff like temporary directory and so, wait until it ask 1-12, 'all' or Enter to Continue, just press enter
  • Then it will ask If the specified directory is also not in the include_path.... write Y
  • Then it will end. Now as strange as it sound, install it again writing php gp-pear.phar and do the same stuff all over again. Why you may ask, well there's an error that comes the first time you install PEAR, so doing it again solve that error. So do it again :)
  • Now after it finished installing open this file with notepad C:\wamp\bin\php\php5.3.8\php.ini and search for the line ;include_path = ".;c:\php\includes", after this line write this  include_path = ".;C:\wamp\bin\php\php5.3.8\pear"   It will look like this:


  • Nice!, now do the same for this other php.ini file: C:\wamp\bin\apache\Apache2.2.21\bin\php.ini, open it up search for ;include_path = ".;c:\php\includes" and after that line write  include_path = ".;C:\wamp\bin\php\php5.3.8\pear"
  • Excellent, now reset your WAMP making left-click on his icon an pressing the button Restart all Services:


  • Congrats yourself, you just installed PEAR on Windows. Now lets test it. On your CMD, make sure youre on c:\wamp\bin\php\php5.3.8 and write pear. You should see appear a list of commands from pear. 
  • Now to call pear from the command line from anywhere, not only the pear directory we must install it on the path variable of windows. Go to your control panel  and in the search toolbox write variable

  • There will be an option called edit the system variables. Use the one with the Shield. Click that option and it should appear something like this: 

  • Select the Path Variable and click on Edit, and put this (yes including the semicolon) ;C:\wamp\bin\php\php5.3.8


  • Nice, one more thing that may help. In C:\wamp\bin\php\php5.3.8 theres a file called PEAR_ENV.reg. Execute it. It will put some new variables on your PATH. I guess there are very important. But please comment if you know something about it.


Installing PHPUnit


  • This is easier that PEAR. First open your CMD and write pear upgrade pear
  • Once pear is updated, write one at a time and press enter for each line:
    •  pear channel-discover components.ez.no 
    •  pear channel-discover pear.phpunit.de
    •  pear channel-discover pear.symfony-project.com
  • After that write this: pear install --alldeps phpunit/PHPUnit
Excellent PHPUnit and PEAR are installed on your WAMP. If you want to thank me please first thanks this dudes, they write this down first. I only put some more images here : 

Fixing WAMP 2.0 i and not so friendly extensions

WAMP2 is like a defacto standard for developing and testing PHP in a Windows enviroment. Particulary i used to use Wamp 2.0A in a WinXP SP2 platform. Also i use Postgres instead of Mysql, just because Pg owns Mysql big time. But there was a problem...

Also it didnt work in other WAMP versions

Like a year ago i wanted to use the next version of Wamp2... the B version. But I couldn't. Well i could install the Wamp server but there was an error when i wanted to activate the php_pgsql extension, an error like...

PHP Unable to Load the muthaphucking Dynamic Library 'c:\blah\blah\ext\php_pgsql.dll' - The specified module could not be found.


Yup, something like that. So after a lot of search and falses promises in google, i found the solution not only for that postgres extension, but for all other extensions that doesnt want to be loaded dinamically.

The Solution: Make sure that you are using the right php.ini file when you....

Ah Ha..Just kidding, the fast and furious solution is to search for this file libpq.dll in your wamp directory and then copy it to WINDOWS/system32 if youre using win XP(sorry for those using Vista, btw Vista sucks).
Hate & Love this file

And its done, you can now use Postgres with WAMP2 version I (yes version I, not 2.. long story).

I dont know exactly why its works, but it works and that the only thing i want to know. And for fixing others extensions, well u got to look for the access library of that extension and put it on system32, and replace it, if it is the case. Hope it helps someone. =)

I found it looking here., but they fix mysql, so this is my sand grain for the Postgres Project.