Tag: tutorial

Learning PHP – Step 2

Following my previous post I’m now preparing an environment to develop in PHP.

1) Install XAMPP – There are other alternatives, but this one, after some research was my choice. Why? Because in the future I’m thinking developing some skills in Perl and with XAMPP it’s a 2 in 1! (Besides mysql included!)

2) IDE – I’m trying Netbeans 7.1. There are a lot others IDEs out there like: komodo, phpstorm, phpide, aptana, eclipse, phpdesigner. My choice probably it’s not the best one, but I develop in Visual Studio and Eclipse and as a Oracle trainer, sometimes I have to use Netbeans. I will try it, if the experience gets troubled I will change to another and keep this learning. I think, anyway, the experience will be always positive.

I’m now following the steps to create a project in Netbeans…

  • New Project PHP
  • Advantage – Netbeans detected my xampp instalation and discovered where to put the php files.
  • Project name: LearningPHP (in my drive sits at: D:\xampp\htdocs\LearningPHP)
  • Local Web Site
  • Project URL: http://localhost:8001/LearningPHP/
  • I will not use any PHP framework… maybe in a future post I’ll try one besides WordPress.

After the wizard I have the file below already created:

index.php (the first file in any web tech is always index.



   
       
       
   
   
                // put your code here
        ?>
   

 

Now I will change the Title and put some basic code inside the



   
       
        Learning PHP – Step 2
   
   
                 echo "My second step to learn php!";
        ?>
   

 

Let’s run it (In Netbeans just hit the “play”!

PS: Make sure xampp is running and the port it’s the correct one. In my example the url is: http://localhost:8001/LearningPHP/index.php

 

and the result, as expected, it’s the browser output:

My second step to learn php!

 

Now, I have an environment to run php and a first “hello word” example.

Next post: The usual language basics of php!

Learning PHP – Step 1

 

I develop in several programming languages like C#, VB.NET, VB, Java, JavaScript, Python, Groovy, Powershell, PL-SQL, T-SQL, a little of Ruby, C, C++, Assembly (in the last years not so often), Prolog, List/Scheme, F#, Perl and and few others less used. I’ve read and I can understand PHP, from the knowledge I have from “C” Languages, but I never developed a complete project in PHP, and I don’t know if in the future I will need to do it, but from what I’ve been reading PHP is used in the TOP CMS Frameworks/Applications as WordPress, Drupal, Joomla, etc.

I’m thinking to create a synergy here, I will deep my understanding and knowledge about PHP and WordPress, tweaking my blog, this blog! Which I think will enrich my CV and, in the future, my career, making me a better team leader and software architect.

Starting PHP.

1) It’s a language to use in web sites.

2) You mix HTML with PHP, which is different from ASP.NET and JSP for instance. To differentiate the HTML from PHP you use in the middle of the HTML. The server will know how to process the PHP and merge it with HTML.



My first example in PHP

 

This code will output “My first PHP!” in the browser.

Great! It’s the first step!

Next Post let’s install the software we need to run this example. Then, the sky it’s the limit!

Bad Behavior has blocked 127 access attempts in the last 7 days.

Hyper Smash