Platforms, SDKs and frameworks.

with Ulysses sub forum
KBleivik
Site Admin
Posts: 178
Joined: Tue Sep 29, 2009 6:25 pm
Location: Moss Norway
Contact:

Platforms, SDKs and frameworks.

Postby KBleivik » Thu Apr 07, 2011 11:39 am

1. Packages and Development platforms .
There is a lot of PHP Installation Kits: http://www.hotscripts.com/category/php/ ... tion-kits/ We will look at three, Bitnami, XAMPP and WAMP.

In the readme.txt document of the BitNami kit, you can read

BitNami Stacks are completely self-contained, and therefore do not interfere with any software already installed on your system. For example, you can upgrade your system's MySQL or Apache Tomcat without fear of 'breaking' your BitNami Stack.

I have installe BitNami, WAMP and XAMPP on my laptop. Since BitNami is run as a service and start when I start my laptop, I have to stop BitNami:
Start + All Programs + BitNami Wappstack + BitNami Wappstack Service + Stop BitNami Wappstack Service
before I can use the WAMP or the XAMPP server. The server that is running is used when I point my browser at http://localhost.

Since our preferred open databaseplatform is PostGreSQL we start with BitNami. If you want't to work with the latest (a later) version of PHP, XAMPP may be your preferred platform since it is our impression that XAMPP is faster to upgrade to the latest version of PHP. You can of course install a later version of PHP in combination with BitNami manually. Read here: http://bitnami.org/forums/forums/wappst ... -php-5-3-x how that is done. Read here http://bitnami.org/forums/forums/wappst ... -localhost if you want to use both PostGreSQL and MySQL on localhost.

Before we start, read this

8. TROUBLESHOOTING

This version of the BitNami WAPP Stack is a preview version, and as such, may contain a number of bugs and be a little bit rough around the edges. We are working on the next release, which will contain several improvements along with expanded documentation. In addition to the resources provided below, we encourage you to post your questions and suggestions at:

http://bitnami.org/forums/

We also encourage you to sign up for our newsletter, which we'll use to announce new releases and new stacks. To do so, just register at: http://www.bitnami.org/catalog/newsletter.

cut from the readme.txt document.

1.1 BitNami
There are two much used database platforms that are used by php developers, PostGreSQL and MySQL. The BitNami package uses PostGreSQL and phpPgAdmin. The package can be downloaded (Remember the password that you use during installation) here:

http://bitnami.org/stack/wappstack

See this http://bitnami.org/learn_more/installers page or the Wiki http://wiki.bitnami.org/Native_Installe ... tart_Guide if you need additional information. If you need a book that uses PostGreSQL as the database platform we can recommend http://www.wrox.com/WileyCDA/WroxTitle/ ... 95095.html

After installation, you should point your browser at http://127.0.0.1/ or http://localhost/ and you will see the BitNami welcome page. On that page you can access the built-in management tool phpPgAdmin using the password that you used during installation and the user name that is mentioned on the page. You need administrator rights to change the read to write permission of the htdocs folder mentioned below. That is changed by browsing to the folder, right click on the folder and change to write permission. In case you don't wan't to change to write permission on the htdocs folder, you can save the file in another (temporary) folder and copy it to the htdocs folder assuming you have administrator rights to the OS.

Testing your installation

The easiest way to test your PHP installation is to create a test script using the phpinfo() function. Open your favorite text editor and type:

Code: Select all

<?php phpinfo(); ?>

Save the file as phptest.php in C:\Program Files\BitNami Wappstack-1.2-5/apache2/htdocs/.

Make sure Apache is up and running, open a browser and type http://127.0.0.1/phptest.php. You should then see a screen showing detailed information about the PHP version you are using.

6. STARTING AND STOPPING BITNAMI WAPP STACK

as explained in the readme.txt seems to be made for the UNIX OS:
http://wiki.bitnami.org/Native_Installe ... servers.3f

On my Vista Laptop where I installed BitNami as explained above, BitNami is run as a service: http://runasservice.sourceforge.net/ wappstackPostGreSQL and wappstackApache respectively. So in the Windows Task manager (CTRL + Alt + Del + Start task management) it is not seen as a process, but as a service where it can be stopped by choosing go to services and click the stop link. On the same page the service can be restarted by clicking the restart link. You can also start and stop BitNami Stacks using the shortcuts created in the Start Menu, under Programs -> BitNami WappStack -> BitNami WappStack Service->Stop or Start.

See also this: http://bitnami.org/forums/forums/wappst ... start-wapp

General BitNami / wappstack forum here: http://bitnami.org/forums/forums/wappstack/

BitNami Documentation (Wiki): http://wiki.bitnami.org/

If you get problems during the installation, go to the folder where you installed BitNami, locate the pdf document wappstack.pdf and read the Installation guide. The easiest way is often to uninstall the software and reinstall it, esepcially if you get an error (cut from the readme.txt document)

"Installer payload initialization failed. This is likely due to an incomplete or corrupt downloaded file"

The installer binary is not complete, likely because the file was not downloaded correctly. You will need to download the file and repeat the installation process.


following the exact installation Guide. This document is also important since it explains how to use the different components that is included in the package. When you install software, you should always look for readme.txt documents in different folders. There is one in the root folder of the platform. As a rule, you should read readme or readme.txt documents, since they may contain important last minute information like.
8.2 Apache

If you find any problem starting Apache, the first place you should check is the Apache error log file:

C:\Program Files\Bitnami Wappstack-1.2-5/apache2/logs/error.log

Most errors are related to not being able to listen to the default port. Make sure there are no other server programs listening at the same port before trying to start Apache. Some programs, such as Skype, may also use port 80. For issues not covered in this Quick Start guide, please refer to the Apache documentation, which is located at http://httpd.apache.org/docs/

8.3 PostgreSQL

If you encounter any problems starting PostgreSQL, the first place to look in is PostgreSQL documentation, which you will find at http://www.postgresql.org/docs/

# "Can't connect to server" message.

Make sure that the PostgreSQL daemon is up and running. Remember also that if during installation you selected a different listening port for PostgreSQL, you
may need to pass that as an extra command line option.

8.4 phpPgAdmin

To test your phpPgAdmin installation first make sure that your Apache and PostgreSQL servers are up and running. You can access your phpPgAdmin installation
by opening a browser and typing http://127.0.0.1:8080/phppgadmin. You will then asked for a username and password. As user name, use "administrator" and
as password use the value specified during installation.

If I search in the BitNami main and sub folders, 18 readme documents and 8 readme.txt documents are listed. Of special interest to me I note two imagemagic -- http://www.imagemagick.org/ -- readme.txt documents.

ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 100) including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG, and TIFF. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.

Note that there is BitNami cloud hosting solutions: http://bitnami.org/cloud/

You may note that the BitNami package was build using BitRocks http://bitrock.com/ cross platform install builder: http://installbuilder.bitrock.com/ that we mention here, since you may need that tool in your projects.

1.2 WAMP
If you have a windows OS, we think that the easiest platform to set up is WAMP: http://www.wampserver.com/ . MySQL is used as database platform on the WAMP server. The WAMP server is so easy to install that we will instead focus on XAMPP for Windows here. We have indicated how it is installed under the heading "Setting up a development server on your local computer" in this viewtopic.php?f=18&t=177&p=212#p212 post. Our recent experienc is that you may have problems if you delete and reinstall the Wamp server. Generelly, ask on the forum http://www.wampserver.com/phorum/list.php?2 if you have problems with the installation or the Wamp server.
uninstall wamp, delete wamp folder, run regedit to search and delete wampapache and wampmysql, restart computer, download wamp from here to try again

http://www.wampserver.com/phorum/read.php?2,48338

I did that on my second install, but it did not function when I pointed my browser at http://localhost/ . I got a 403 forbidden error saying:

Forbidden

You don't have permission to access / on this server.


But when I pointed my browser at http://127.0.0.1/ I got the WAMPSERVER home page as explained in this http://www.petri.co.il/install_wamp_server_on_vista.htm installation guide. Could the reason be that I already have XAMPP (se below) installed on my computer? So if I stop the WAMP server, I have no problem loading the XAMPP server by pointing my browser at http://localhost/ It is even loaded when I point my browser at http://127.0.0.1/ I need both, but don't run them simultaneously.

1.3 XAMPP for Windows
This package uses MySQL and phpMyAdmin as the database platform. The package can be downloaded here:

http://www.apachefriends.org/en/xampp.html

Note the following

Vista Note:

Because of missing or insufficient write permissions in "C:\Program Files", we recommend to use alternate folder for XAMPP ("C:\xampp" or "C:\meinverzeichnis\xampp").

On the XAMPP options page, I recommend that you do not install the components as services. If they are installed as services, they will start automatically every time you turn on your computer, so stick to the default options. Click Install and wait for the various packages to be extracted and installed. If the command prompt window opens, don't touch it, just let it run. Click Finish and select Yes to start the XAMPP Control Panel. Start the servers by clicking the Start buttons next to Apache and MySQL in the Control Panel. If you get trouble during the installation, read the information that is written on the XAMPP download page, for windows that is:
http://www.apachefriends.org/en/xampp-windows.html or the Apache friends FAQ page: http://www.apachefriends.org/en/faq-xampp.html

A reinstall using the correct installer for your OS can be the fastest solution to your problem.

It is always wise to read what is written on the download page like the must read security, the upgrade and basic questions paragraphs.

When Apache is running, point your browser at http://localhost and you should be redirected to the XAMPP start page at: http://localhost/xampp/splash.php. When you click the link for your preferred language, eg. English you should come to the XAMPP Welcome page that starts with

Welcome to XAMPP for Windows!
Congratulations:
You have successfully installed XAMPP on this system!

On that page, you should start by looking at the left menu and click the phpinfo() link that describes which version of php that came with the package (php 5.3.5 when this post was written). That may not be the last stable version of php from the http://www.php.net/ site (php 5.3.6 when this post was written). If you want to go to the phpMyAdmin page under the tools menu, you must first start MySQL from the XAMPP control panel or you will get an error.

By default, when you install XAMPP there is no password set for the 'root' MySQL user. This isn't a major security problem, when you're only running a local server. Here is the way you set a 'root' Password for MySQL:
1. Open your web browser and go to http://localhost/. From the XAMPP welcome page, select phpMyAdmin under Tools in the left hand menu. You'll now see the phpMyAdmin home page.
2. Click on the Privileges link. You will be presented with the User overview.
3. Click on the Edit privileges (far right on the User overview) icon for 'root' on 'localhost'. On the next page, scroll down to Change password, enter a password and click Go.
4. Go to the XAMPP directory on your computer. This should be c:\xampp\ (or wherever you installed it), open the phpMyAdmin folder and locate the config.inc file.
Open the file in any text editor (Windows Notepad should be fine). Find the line that begins with:

Code: Select all

$cfg['Servers'][$i]['password'] = '  ';

5. Insert the MySQL password you choose above between the quote marks just before the semi-colon, so the line now reads:

Code: Select all

$cfg['Servers'][$i]['password'] = 'mypassword';

6. Now save the config.inc file and close it.
7. On the phpMyAdmin home page click on the privileges link again and do the same for 'root' on '127.0.0.1' as you did for localhost.

This http://apress.com/book/view/9781430224730 book explains how to install and use XAMPP and the MySQL database platform. In addition it explains how to use one of our favourite SDKs, Eclipse.

2. SDKs and IDEs
There are a lot of SDK's and IDE's. We have extensive experinece with using the Adobe Dreamwaever IDE http://www.adobe.com/products/dreamweaver.html. That is proprietary software and it is not free. Dreamweaver is one of the better IDE's. Here we will list two popular SDK's for php that is free, and they are good enough for many purposes, like setttin up your content management system on your local computer and uploading it to the internet. We begin with our preferred free SDK.

2.1 NetBeans for PHP
There are different download options Java SE, Java EE, C/C++, PHP and All. Since this post is written in the PHP sub forum, choose PHP if you wan't a minimalistic installation. The other options or all can be choosen when needed. So download and install it NetBeans for PHP. We recommend that you use the default options. We don't need to repeat the installation here, since it is explained in detail on this http://netbeans.org/kb/docs/php/quickst ... stallation page. After you have downloaded and installed the SDK, it is done in minutes to make your first project and test the following

Code: Select all

<?php
            echo "Hello, world! This is my first PHP project!";
 ?>

locally. There you go. It is that simple. Note:

Remote and Local Project Development
PHP projects can easily be deployed from within NetBeans IDE for testing to local or remote servers via FTP or SFTP, or by the use of an upload script for more complex deployments. You can easily create a new project from remote sources, and the IDE will upload your changes automatically when you save a file. Run the project as a local web site, as a command line script, or as a remote web application via FTP or SFTP.

Note: The IDE also supports a range of version control systems, including CVS, SVN, Git, and Mercurial. For more information about NetBeans IDE's version control support, please see Version Control & Developer Collaboration.

Source: http://netbeans.org/features/php/

For further information on setting up a remote connection, see here:
http://netbeans.org/kb/docs/php/remote- ... onSettings

http://netbeans.org/kb/docs/php/project ... iteWebSite

NetBeans IDE PHP Quick Start Tutorial
http://netbeans.org/kb/docs/php/quickstart.html

PHP Learning Trail
http://netbeans.org/kb/trails/php.html

Creating a Database Driven Application With NetBeans IDE PHP Editor
http://netbeans.org/kb/docs/php/wish-li ... -page.html

Lesson 9: Deploying the Application on a Remote Web Server
http://netbeans.org/kb/docs/php/wish-list-lesson9.html

If you need additional information, look on the NetBeans home page: http://netbeans.org/ or on the http://blogs.oracle.com/netbeansphp/

2.2 Eclipse for PHP
Eclipse for php can be downloaded here: http://www.eclipse.org/

After the installation is finished, go to the folder where you installed Eclipse and right the Eclipse program icon and choose send to desktop as shortcut. That creates an Eclipse icon on your desktop. Now start eclipse by klicking that icon and after a while a dialog box will pop up that asks you to select your work space. We will start with XAMPP like the above mentioned book. We select the htdocs sub folder in the folder where we installed XAMPP. We select this folder and check the "Use this as the default and don't ask me again" box. After clicking "Choose," close the welcome screen that shows up by clicking the "X" in the tab at the top, next to "Welcome". We are now ready to make our first php project, by following these steps:
  1. The file menu + New + PHP Project.
  2. Name your project simple_blog and click finish.
  3. The simple_blog project will now be listed in your left hand menu.
  4. Right click the simple_blog project folder. Hover over New, and click PHP File.
  5. Name your file test.php and click finish.

Write the following code in the test.php file:

Code: Select all

<?php
   echo "Hello world!"
?>

and save the file.

Point your browser to http://localhost/simple_blog/test.php and if the Apache server is running on your computer, you should see the traditional "Hello World" message in your browser window.

If you need further information on how to use the SDK, see the above mentioned book or search for online tutorials:

Eclipse tutorial php

or variations thereof. There are more advanced integrated development ides (IDEs) like DreamWeaver from Adobe. Some people like it more simple, and then you can even use NotePad or the more advanced NotePad++ http://notepad-plus-plus.org/. We recommend using an SDK, since it has nice features like code highlighting, auto complete etc.

3. Frameworks
There is no need to reinvent the wheel, so you should learn to use some frameworks in your projects. The very minimalistic Ulysses (35 Kb) framework

http://sourceforge.net/projects/ulyssesframewor/

is explained in the above mentioned book "PHP 6 professional". There are other frameworks like the well known Norwegian http://ezcomponents.org/ from http://ez.no/

http://jpgraph.net/

http://fpdf.org/

http://www.doctrine-project.org/ that is related to http://www.symfony-project.org/ is a fairly new framework. Read more here:

http://www.zalas.eu/doctrine2-and-symfony2

You find an overview of additional frameworks on this

http://www.phpframeworks.com/

site.

See also: http://www.webproworld.com/webmaster-fo ... ou-rate-it

Return to “PHP 6 and later”

Who is online

Users browsing this forum: No registered users and 1 guest