Saturday, March 27, 2010

Enabling Curl with PHP on Windows

Today I was installing Zen Cart when I ran into this error message:

CURL not compiled into PHP - notify server administrator
 
Even though it is quite simple to solve the problem, it took me a while to find this. That's usually a good sign that I should write it down ASAP so here it goes

1) remove ';' from extension=php_curl.dll in php.ini
2) ensure that  ssleay32.dll and libeay32.dll are in Windows/system32.
3) Copy php_curl.dll into Windows\System32 as well.


I hope it helps

Sunday, March 14, 2010

How to synchronize FTP files using Notepad++

Lately I have been working on the migration of a website to a new platform, which required me to modify many files through FTP or remote desktop, most of the times I do this on my Linux computer using Kate which already updates the file on the FTP folder without any issues.

This time I'm working on a Windows XP machine and Notepad++ doesn't include this feature out of the box. Fortunately there are many plugins for Notepad++ and FTP_synchronize can solve this problem for me, here goes basic info on how to install it and use it;

1.- Download FTP_synchronize here
2.- Unzip it and depending on your system copy the file "FTP_synchronizeA.dll" (Win9x/WinME) or "FTP_synchronize.dll" (Windows NT) to "C:\Program Files\Notepad++\plugins"
3.- Restart Notepad++
4.- Click on the new button in the toolbar that says "Show FTP folders"
5.- Click on the "Settings" button
6.- Add a new profile using your info (user, password, server, initial folder, etc) and click on "OK"
7.- Click on the "Connect" button and choose the profile you just created.

    Now you have access to your FTP folder from within Notepad++ and every time you  click on "Ctrl + S" the changes will be updated in the server.

    Friday, March 12, 2010

    Can't load PHP's mcrypt extension?

    After installing MySQL and PHP, both were working correctly and the only thing missing was to install phpMyAdmin. After downloading and unzipping the installation file I try to access the application through the browser and I get this error:

    "Cannot load mcrypt extension"

    This can be solved quite easily:

    1. Open your php.ini file (e.g. c://php5/php.ini or c://windows/php.ini)
    2. Find and uncomment "extension=php_mcrypt.dll", save the file.
    3. Copy "libmcrypt.dll" from your php folder to "c://windows"
    4. Restart the server
    That's it!

    Wednesday, March 10, 2010

    How to install PHP 5.2 on Windows 2003 Server with IIS6

    Let's skip all the blabbing and  go straight to the content.

    Requirements:

    1.    Windows 2003 Server
    2.    IIS6 Web server
    3.    PHP 5.2.13 binaries zip file (Download here)

    Installation:

    1.    Unzip the content of the zip in the following location "C:\php5"
    2.    Copy "C:\php5\php.ini-recommended" to "C:\WINDOWS"
    3.    Rename the previous file to "php.ini"
    4.    Copy "C:\php5\php5ts.dll" to "C:\WINDOWS\system32"
    5.    Open IIS Manager - Expand your server - Right click on "Websites" - Properties - Home Directory - Configuration - Add
    6.    Browse and select the file "C:\php5\php5isapi.dll" and set the extension value to ".php" and click "OK"
    7.    Now in the same "Websites" properties window, go to the "Documents" tab
    8.    Click on "Add" and enter this value "index.php" and move it to the top
    9.    Right click on the "Web Service Extensions" and add a new one
    10.    Set the extension name to "PHP", then click on "Add" and select the file "C:\php5\php5isapi.dll"
    11.    Tick on "Set extension status to Allowed"
    12.    Create a text file with the following content " to test our installation:
     <?php phpinfo(); ?>  
    
    13.    Save the file as "index.php" in the following location "C:\inetpub\wwwroot"
    14.    Open your internet browser and open "http://localhost" or "http://localhost/index.php"

    That should it be it! you should get a PHP info similar to this one:

    Monday, March 1, 2010

    Useful constants in JavaFX

    There are a couple of useful constants in JavaFX that for sure I'll use later in the future, check them out:

    __DIR__ 
    Dir will return the directory of the currently executed FX source file. A sample of how to use it would be something simple like:
     println("The current directory of this FX file is: {__DIR__});  
    
    The value of this constant may be a jar in case you are executing this from a jar.


    __FILE__ 
    File is similar to the previous one, the main difference is that it will return the url of the current source file.

    __PROFILE__
    Profile will have only three values, "mobile","desktop" and "browser" depending on how the script was executed.

    Codebase
    Using the following code you will get the value of the "codebase" attribute located in the .jnlp file from your application. So in case you .jnpl file goes like this:
     codebase="http://example.sun.com/JavaFX/AppletDeploy/dist/"   
    
    Then you can retrieve the value this way:
     var codebase = FX.getProperty("javafx.application.codebase");