Top PHP IDE’s

There are a number of IDE’s available for PHP development. In this article we’ll discuss about some free/open-source and some paid IDE’s that might help you in selecting the best. A wisely selected IDE will help you increase productivity while developing web applications.

What is an IDE?

An IDE (integrated development environment) is a software application that provides comprehensive facilities to programmers for web development. An IDE normally consists of a source code editor, build automation tools and a debugger. Most IDEs offer Intelligent code completion feature.

In order to get success in developing PHP sites it is necessary to have a good development environment. While producing web sites it is often necessary to edit HTML, CSS and JavaScript files. That is why usable IDE should supply all those file types and provide full set of tools for effective development.

Below are what we think best PHP IDE’s:

Komodo

Pricing: Free/Paid Website: http://komodoide.com
OS Platforms:  Linux, Windows, Mac

Komodo is a multi-language IDE. The code intelligence is solid. Version Control is also surpported via Subversion, Mercurial, Git, Perforce, Bazaar, CVS. You can edit with multiple users simultaneously with Code Collaboration. it has also great debugging and unit testing features. For more information you can visit http://komodoide.com.

PhpStorm

Pricing: Paid Website: http://www.jetbrains.com/phpstorm/
OS Platforms:  Linux, Windows, Mac

PhpStorm provides an editor for PHP, HTML and JavaScript with on-the-fly code analysis, error prevention and automated refactorings for PHP and JavaScript code. PHP code refactoring also reviews PHPDocs to keep them up-to-date. It includes a full-fledged SQL editor with editable query results. It also helps you to form your code, run unit-tests or perform full debugging.

Codelobster PHP Edition

Pricing: Free/Paid Website: http://www.codelobster.com/
OS Platforms:  Windows

Codelobster PHP Edition streamlines and simplifies the PHP development process. You don’t need to keep in mind the names of functions, arguments, tags or their attributes — we’ve implemented all these for you with autocomplete features for PHP, HTML, JavaScript and even CSS. And you can always get necessary help information by pressing F1 or using the special Help control.

Eclipse

Pricing: Free Website: http://www.eclipse.org/
OS Platforms:  Linux, Windows, Mac

Eclipse allows you to select language, platform and vendor environment. Eclipse encompasses the development components necessary to develop PHP-based Web Applications and facilitates extensibility.  It also involves Data Tools Platform to control the databank, plug-ins for interaction with JavaScript, C / C + +, XML editor, and other different tools.

PHP Designer

Pricing: Paid Website: http://www.mpsoftware.dk/
OS Platforms:  Windows

Php Designer focus on the designing aspect of the PHP Web Development. Its features includes intelligent syntax highlighting, debug support, syntax analyzing, support for object-oriented coding, code insight on the fly, code templates, code snippets, todo and bug managers, work with projects and frameworks, intuitive code navigation, code formatters and minifiers and all wrapped into a nice looking intuitive user interface.

PhpED

Pricing: Paid Website: http://www.nusphere.com/
OS Platforms:  Windows

NuSphere PhpED  is a Windows only IDE. PhpED features include Advanced PHP Editor, PHP Debugger and PHP Profiler, Code Insight, Database Client, Integrated Help System, Code Insight. PhpED supports JavaScript, HTML, CSS, XML, SMARTY, XHTML and others. Full support for PHP versions from 4.3 to 5.4 (5.5 is fully supported for debugging and profiling) in IDE and the Editor – from functions and local variables to namespaces and aliases.

PHPEdit

Pricing: Paid Website: http://www.phpedit.com/
OS Platforms:  Windows

PHPEdit is a Windows-only IDE, and it’s easy to set up. PhpEdit works with a fully-featured, highly ergonomical Integrated Development Environment for PHP. To help with deployment, PHPEdit connects to CVS and Subversion, as well as FTP and its own proprietary ezDeployment system.

Zend Studio

Pricing: Paid Website: http://www.zend.com/
OS Platforms:  Linux, Windows, Mac

Zend Studio is one of the best IDE available for PHP development. It has very powerful PHP and Javascript debugging, team collaboration and remote server tools. The Zend studio is one of the highest priced PHP IDEs, though it has a free version however that does not come with very good features. Using Zend Studio You can easily deploy your PHP application onto public or private cloud by using the built-in cloud deployment integration features. Zend Studio includes a fully working mobile app with source code. Use the code to learn how to create mobile apps or leverage it for your apps.

NetBeans IDE

Pricing: Free Website: http://netbeans.org/
OS Platforms:  Linux, Windows, Mac

Netbeans allows developer to quickly and easily develop desktop, mobile and web applications with Java, HTML5, PHP, C/C++ and more. NetBeans IDE is FREE, open source, and has a worldwide community of users and developers. The NetBeans PHP editor provides code templates and code generation tools, such as “getter and setter” generation, refactoring, such as “instant rename”, parameter tooltips, hints, and quick fixes, and smart code completion. NetBeans IDE supports the popular web frameworks like Zend Framework, Symfony2 Framework, Symfony1 Framework.

Aptana Studio PHP Editor

Pricing: Free Website: http://www.aptana.com/
OS Platforms:  Linux, Windows, Mac

Aptana Studio is developed on Eclipse platform and is very stable and powerful. It aids in developing HTML, CSS, JavaScript, PHP, and Ruby applications. Aptana Studio supports the latest HTML5 specifications. Also includes information about the level of support for each element in the major web browsers.

How To: Create aliases on WAMP server

If you are looking for a quick and easy ways to create server aliases, WAMP server is your answer.

What is an Alias?

Let us assume that you are using the document root for main site, and you want to direct the server directories outside the document root. For example, you want to map following:

  • Students -> C:students
  • Teachers -> C:teachers
  • Principal -> C:principal

WAMP server interface by default allows you to quickly set up aliases, but they might not work.

Adding Aliases from WAMP Interface

Left-click the system tray icon and then go to the Apache -> Alias Directories -> Add An Alias

How To: Create aliases on WAMP serverA command prompt will open prompting you to create the alias URL

How To: Create aliases on WAMP server

Type the names of the alias; this will be what is added onto the http://domain_name/address e.g. (http://www.webtamarin.com/students)

Enter the location of the folder that will house the pages for this website. keeping with our earlier example, type C:students and then hit Enter.

The alias will now set up according to WAMP.

Don’t panic if the alias doesn’t work.

When you create the alias using the WAMP server, it creates the necessary file in the correct location, but it adds all the content in one line

 The file should look like

To edit that file, follow these steps:

  • Left-click the WAMP icon in the system tray.
  • Go to Apache -> Alias Directories -> ALIAS_NAME -> Edit Alias (here ALIAS_NAME is the name of the alias you just created).
  • In the Notepad window which just opened, edit the configuration file to reflect the above contents and save it.
  • Edit the configuration file to best fit your needs (according to the Apache specifications).

Restart the WAMP server, and you should be able to point your browser to http://localhost/students. (Of course, you’ll need content within the C:students directory.) If you get an error, check to make sure the alias directory’s permissions allow the server to read the contents; this will be dictated by a number of issues, such as whether the server resides on a Windows domain.

Fix: WordPress Memory Exhausted Error – Increase WordPress Memory Limit

Sometime you might have to face an error while activating a new plugin or doing some other stuff. This error might look like:

 The most possible reason for this error is that you have exceeded your default Memory Limit.

Since WordPress 2.5 there is a wp-config.php option WP_MEMORY_LIMIT which allows you to change the maximum amount of memory allocated to your website. If you change this option for your website it will only affect your WordPress website and not other PHP websites on the server.

WordPress allocates 40MB for single websites and 64MB  for multisite installation. But the php.ini allocated memory supersede the wp-config.php value. For example, if php.ini is configured to 64MB and your WordPress allocated 40MB memory, then the website will 64MB not 40 MB memory.

There are number of ways to fix this error. Some are listed below:

From wp-config.php

To change the WordPress memory limit you just add the following into the wp-config.php.

WordPress memory can be different to the server – you need to set this regardless of server memory settings

From php.ini

If you have access to your php.ini file, then you can change the line in php.ini. Search for the property memory_limit and change the value to something greater like 64M

 From .htaccess

If you don’t have the access to php.ini file you can change the memory limit from the .htaccess file. Go to the root folder of your website and create a new .htaccess file if it doesn’t already exist and add the following line to your htaccess file.

 If none of the above methods work, please contact your hosting service provider.

Everything about WordPress Child Themes

As more and more WordPress users now customize their themes and only few users like the themes in default mode we will learn in this article how to create a Child Theme from a WordPress Theme.

Why use a Child Theme?

You will save yourself from a lot of headache by creating a child theme. Child theme allows you to make changes without affecting the original theme, which will in turn make it easier to update your parent theme to latest versions without loosing all the changes you made. In the child theme you create a completely separate set of files that you can use to customize the theme without affecting the original theme. This way you will make sure that your original theme is intact as you are not making any changes to it.

Getting Started

  1. Create a new folder/directory in your themes folder. This new folder will contain you child theme. For our reference we will create a child theme of WordPress Twenty Fourteen Theme.
  2. In the child theme folder create a stylesheet file named style.css. This is the only required file for a Child Theme. Open the newly creates file and put the following code at the top.

    You can make changes to the above code according to your suitability. Only Theme Name and Template are required, all the rest are optional. The Template value is the name of the directory of the parent theme.

  3. Go to your website’s dashboard, and go to Administrator Panel -> Appearance -> Themes. Here you will now see your newly create theme among the list of other themes. Activate the Child Theme.

Editing the functions.php File

The functions.php of a child theme does not override its counterpart in the parent them unlike style.css. It is loaded in addition to the parents function.php not in place of it. Your child theme’s functions.php file should start with a php opening tag and end with a php closing tag. In between, you can add your desired php code.

 For example, you want to add a new function to you theme, the fastest way is that you open your theme’s function.php and add the new function. But now if you update your theme the new function added by you will be removed. The better way is that you add the new function toy your child theme’s function.php. 

Editing Other Templates

If you want to make structural changes to your theme by changing PHP template files, this can be done by replacing the file entirely with a new one  in your child theme. Your child theme can override any file in the parent theme: simply include a file of the same name in the child theme directory, and it will override the equivalent file in the parent theme directory when your site loads. For instance, if you want to change the PHP code for the site header, you can include a header.php in your child theme’s directory, and that file will be used instead of the parent theme’s header.php.

Decoding WordPress wp-config.php

wp-config,php is one of the most important file of a WordPress installation. This file is located in the root of your WordPress file directory and contains your website’s base configuration details, such as database connection information. In this article we will try to understand all the settings that are done in wp-config.php and their usage.

Database Settings

  • DB_NAME: This will be the name of your WordPress database.
  • DB_USER: This will the username to access your database.
  • DB_PASSWORD: This will the password to access your database.
  • DB_HOST: This will the hostname of your database server. Most of the times its localhost. But if you are not sure you can ask you hosting company and they will provide you the database server information of your server. Below is a table of possible database hosts.
  • DB_CHARSET: This will define the character set used by your database.The default is utf8 which supports all languages, so it should not be changed unless absolutely necessary.
  • DB_COLLATE: Used to define the sort order of the database character set. if you are changing this value, make sure is is set to a UTF-8 character set, such as utf8_general_ci or utf8_spanish_ci
Hosting Company Possible DB_HOST values
1and1 db12345678
AN Hosting localhost
Aruba.it localhost or real IP provided with activation mail.
A Small Orange localhost
BlueHost localhost
DreamHost mysql.example.com
GoDaddy – Shared and 4GH Hosting In the Databases menu go to MySQL. To the right of the database name click on Actions and Details. The hostname is at the bottom of the window.
GoDaddy – cPanel Hosting localhost
GoDaddy – Plesk Hosting Use the IP address shown in the Databases Section in Plesk. Do not include :3306
HostGator localhost
HostICan localhost
ICDSoft localhost:/tmp/mysql5.sock
Infomaniak Network mysql.yourdomain
InMotion Hosting localhost
iPage username.ipagemysql.com
IPower username.ipowermysql.com
LaughingSquid localhost
MediaTemple Grid internal-db.s00000.gridserver.com – (Replace “00000” with the actual site number)
MediaTemple DV localhost
MegnaHost localhost
NearlyFreeSpeech.Net username.db
NetworkSolutions mysqlv5
one.com example.com.mysql
pair Networks dbnnnx.pair.com
QTH.com localhost
Rackspace Cloud localhost for unmanaged servers, variable for Cloud Sites like mysqlXY-AB.wcN.dfQ.stabletransit.com where X,Y,A,B,N,Q are variables
SysFix.eu Power Hosting datapower.sysfix.eu
Yahoo mysql
Hosts with cPanel localhost
Hosts with Plesk localhost
Hosts with DirectAdmin localhost
Tophost.it sql.your-domain-name.it

Table Prefix

The $table_prefix is the value placed in the front of your database tables. If you haven’t changed this while installing the WordPress, then most probably you are using the default wp_ as table prefix.  From security perspective, this is very unsafe and this should be changes as soon as possible. If you are an advance user you can change it manually by replacing wp_ by something random like aedc_ and then updating the database tables. But if you are not and advance user you can do it by using some security plugin such as iThemes Secutiry.

You can have multiple installations in one database if you give each a unique prefix.

 A second blog installation using the same database can be achieved simply by using a different prefix than your other installation.

Security Settings

A secret key is a password with elements that make it harder to generate options to break through you security barriers. All the keys are randomly auto-generated and should not be disclosed to anyone.

You can assign any random string to these keys or you can use the online generator to generate security keys.

These keys will be used to sign the cookies for your website.

  • AUTH_KEY: This key is used to sign auth cookies for the non-SSL. These can also be used to make changes on the blog.
  • SECURE_AUTH_KEY: It is used to sign an auth cookie for SSL admin and these cookie can be used to make changes on blog. (With the new version there will be two type of auth cookie one for SSL and other for non-SSL)
  • LOGGED_IN_KEY: It will be used to generate a cookie for a logged in user and this cookie can’t be used to make changes on the blog.
  • NONCE_KEY: It is used to sign the nonce key which protects the nonces from being generated, protecting you from certain forms of attacks where a hacker attempts to guess the nonce.

Salt is an addition to the secret keys. They work in combination with keys.

There are 4 salts named as AUTH_SALT, SECURE_AUTH_SALT, LOGGED_IN_SALT, and NONCE_SALT.

Defining them is not compulsory, but it is a good practice to have them in your wp-config.php file. If you don’t define those than WordPress will generate it automatically. These can also be a random complex string and you can define them either by yourself or through the online random key generator.

Language and Language Directory

  • WPLANG: It defines the name of the language translation (.mo) file.If your blog is in English, leave it blank. But if your blog is in a language other than English, you can look up your language code here: http://codex.wordpress.org/WordPress_in_Your_Language. For example, for Spanish the code will be 
  • WP_LANG_DIR: This defines what directory the WPLANG .mo file resides. If WP_LANG_DIR is not defined WordPress looks first to wp-content/languages and then wp-includes/languages for the .mo defined by WPLANG file.

Debug Settings

  • WP_DEBUG: This option controls the reporting if errors and warnings. This is set to false by default. But if you wish to debug code you must set it to true.
  • CONCATENATE_SCRIPTS: This option will concatenate all the JavaScript into one for a faster Administrator area. This is set to true by default, but if the JavaScript is not working properly in your Administrator area you can set it to false.

WAMP does not start

A lot of time you might face a trouble that WAMP will not start. The Wamp icon may be red or yellow prompting that there is some trouble in starting the WAMP properly. Sometime even the icon is green but the WAMP would not run even then.

What is WAMP?

Wamp is package of services (Apache, Mysql, etc.) running on your computer. All these services (Apache, Mysql, etc.) use certain ports to run. If the port required by a service is being already used by some other service, then the WAMP will give you a warning by making the WAMP icon appear either in red or orange color.

Solutions

How to solve Apache port conflict:

If the issue is related to the Apache port conflict, we can resolve it by changing the default Apache port (Port 80) to some other port number. To do so please follow the steps given below:

  • In the systems tray at the bottom right of your window left-click the orange WAMP icon.
  • Go to the Apache option.
  • You can see the httpd.conf  option. Left-click on it.
  • Search for a line that says “Listen 80” and change it to “Listen 81”.
  • Now left-click the orange WAMP icon and choose “Restart all services”.

httpconfig

If the WAMP icon turns green then you had the Apache port error and it has been resolved. But you will have to use http://localhost:81 as your URL instead of http://localhost.

If you don’t like to use http://localhost:81 as your URL then you have to find the application running on port 80. To do this please follow the steps given below:

  • In the systems tray at the bottom right of your window left-click the orange WAMP icon.
  • Go to the Apache option.
  • You can see the Service  option. Left-click on it.
  • Click “Test Port 80”.

testport80

A command prompt window will open. This window will show if the Port 80 is being used by Apache or not.

port-check

Now if some other application is running on port 80, we have to find it and close it. Follow the steps below:

  • Press Window+r and type cmd. Press Ok. This will open Command Prompt.
  • Type netstat -aon | findstr:80 and press enter button. This will show all the applications running on the port 80.
  • Here you can also see the PID of the application running on the port 80.

netstat

Now when you have found the culprit , the next step is to close the application running on port 80.

  • Right click on you taskbar. Click on the Task Manager option.
  • Click the details tab.
  • Here you can see the PID column. Search your culprit service.
  • Right click on the service and press End Task.

Once the conflicting application is stopped, you can now try to start the WAMP and it will hopefully work fine.

How to solve MySQL port conflict:

Apart from Apache port conflict MySQL port conflict is another common cause on WAMP not working. If you are facing any such issue please follow the following steps to resolve the issue.

  • Press Window+r and type cmd. Press Ok. This will open Command Prompt.
  • Type “Services.msc” and press enter.
  • Sort the columns by name and look for “wampmysqld” or  “wampmysqld64or “MySQL”.
  • If the status of the process is running, double-click it and press the “Stop” button on the dialog box which appears.
  • Click Ok.
  • On the System Tray left-click on the WAMP icon and press “Restart all services”.

How To: Fix WAMP MSVCR110.dll Not Found or Missing Errors

MSVCR110DLLThere are more than one ways to resolve the issue of missing MSVCR110.dll on WAMP  server. The most common error message which occur while installing WAMP is This application failed to start because msvcr110.dll was not found. Re-installing the application may fix this problem.

Some of the most common reasons for this error

  1. There might be an issue with Windows Registry.
  2. You PC might be infected with some Malware.
  3. There might be a hardware failure.
  4. You might be installing a program that might have corrupted the MSVCR110.dll

How to fix the error

  1. Download the Visual C++ Redistributable for Visual Studio 2012 Update 4 package and run it. This will replace/restore the msvcr110.dll with the most recent copy provided by Microsoft. You will need to select the download based on the version of Windows installed on your PC. For example: x86 (32-bit) or x64 (64-bit). This solution will resolve the issue most of the times. For downloading the Visual C++ Redistributable CLICK HERE
  2. Run a malware/virus scan with you antivirus. It’s even possible that the msvcr110.dll error you’re seeing is related to a hostile program that’s masquerading as the file. Running a malware/virus scan will resolve this issue.
  3. If you think you might have accidentally deleted the msvcr110.dll then you might find it in Recycle Bin.
  4. Repair your Windows installation. If the individual msvcr110.dll file troubleshooting advice above is unsuccessful, performing a startup repair or repair installation should restore all Windows DLL files to their working versions.

Notes

  1. Do not download msvcr110.dll from a “DLL Download” website. They might contain virus. Try to get form a legitimate source.
  2. If you cannot access Windows normally due to msvcr110.dll error, try restarting Windows in Safe Mode.

 

Parse.com Retrieving Objects Using PHP CURL

If you have already created and object, you can retrieve its records by sending a GET request to the object URL.

For this tutorial I will assume that you already have an Parse.com account. Follow the below mentioned steps to get an Application Id ans REST API key:

  1. Sign In to Parse.com
  2. Move to Dashobard
  3. Create a New App
  4. Copy Application ID, Client Key and REST API Key

The code below will send a PHP CURL GET request to REST API of Parse.  You have to place you Application ID and REST API Key with the placeholders. You can run this code on a PHP server

The response body is a JSON object containing all the user-provided fields, plus the createdAt, updatedAt, and objectId fields. A sample response body is shown below:

If the object you are retrieving have pointers to children,  then you can fetch child objects by using the include option. For example, to fetch the object pointed to by the “game” key:

 

Parse.com Create New Object Using PHP CURL

Parse.com is an external BaaS (Backend as a service) provider.

Parse.com provides REST API that lets you interact with Parse.com from anything that can send an HTTP request. In this tutorial we will send and HTTP request to Parse.com using PHP CURL.

This tutorial assumes that you have Parse.com account. Follow the below mentioned steps to create a Parse.com App and obtain Application Id.

  1. Sign In to Parse.com
  2. Move to Dashobard
  3. Create a New App
  4. Copy Application ID, Client Key and REST API Key

The code below will send a PHP CURL request to REST API of Parse. To create a new object on Parse, send a POST request to the class URL containing the contents of the object. You have to place you Application ID and REST API Key with the placeholders. You can run this code on a PHP server.

When the creation is successful, the HTTP response is a 201 Created and the Location header contains the object URL for the new object:

The response body is a JSON object containing the objectId and the createdAt timestamp of the newly-created object: