Showing posts with label NetBeans. Show all posts
Showing posts with label NetBeans. Show all posts

Friday, March 04, 2011

OpenBSD NC4200: Apache + PostgreSQL + PHP5 + P4A. Another interesting project.

Ok this is my current project. I'm exploring PHP now and because I only have a little knowledge on programming PHP, I need to use some sort of RAD / Visual tool to start building PHP website fast. I read that P4A - PHP For Applications - PHP RAD Framework is one of the tool that can be use so I'm exploring that now. So I need to build a OAPP (OpenBSD + Apache + PostgreSQL + PHP) environment on my 4.8. I would love a pre-built stack for this but AFAIK, there's none for OpenBSD. It's not a bad thing though because manual installation is better for my brain somehow.

1) Setting up Apache
OpenBSD have a custom Apache 1.3 installed by default. There's also Apache 2 package but I'll just focus with what's already there. To get the Apache running I just edit /etc/rc.conf.local and add:

httpd_flags=""

2) Setting up PostgreSQL
I installed these packages:
postgresql-server-8.4.4
postgresql-client-8.4.4
postgresql-docs-8.4.4

After installation, you can see the brief steps you need to take to enable PostgreSQL. I had problem using su - _postgresql because I kept getting wrong password. After searching for answer, I found a way for that.

2.1) Set password for _postgresql
# su
# passwd _postgresql


Then after the password for user _postgresql has been set, I can finally follow the brief tips for starting up PostgreSQL (which can also be read at /usr/local/share/doc/postgresql/README.OpenBSD).

# su - _postgresql
# mkdir /var/postgresql/data
# initdb -D /var/postgresql/data -U postgres -A md5 -W


You can follow the rest of the steps contained inside /usr/local/share/doc/postgresql/README.OpenBSD. I also read somewhere on the net that I need to edit /etc/rc.conf.local and add this line:

postgres_flags=""

2.2) Set up phpPgAdmin
I installed phpPgAdmin-4.2.3 package which will also install core php5 packages. I had a problem trying to log in to phpPgAdmin using postgres id which has been created earlier. After googling for answer, here's the way to do that. Edit the file /var/www/phpPgAdmin/conf/config.inc.php. Then edit/add the bolded text.

// Hostname or IP address for server. Use '' for UNIX domain socket.
// use 'localhost' for TCP/IP connection on this computer
$conf['servers'][0]['host'] = 'localhost';

// If extra login security is true, then logins via phpPgAdmin with no
// password or certain usernames (pgsql, postgres, root, administrator)
// will be denied. Only set this false once you have read the FAQ and
// understand how to change PostgreSQL's pg_hba.conf to enable
// passworded local connections.
$conf['extra_login_security'] = false;


Then after that I can log in using postgres id and manage the PostgreSQL database. There's also pgadmin3 program which uses wxWidget, a GUI program to manage PostgreSQL database.

3) Install PHP5
As I wanted to try out P4A - PHP For Applications - PHP RAD Framework, the relevant PHP5 packages I installed is:

php5-core-5.2.13p0
php5-pdo_pgsql-5.2.13p0
php5-pgsql-5.2.13p0

Installation is straightforward and there's brief description on how to enable PHP5 support + testing out PHP5.

4) Set up P4A - PHP For Applications - PHP RAD Framework
http://p4a.sourceforge.net/ have the nescessary files for the application. I downloaded p4a-3.8.1.zip from the site, unzip the package and rename the p4a-3.8.1 folder to p4a. After that I move the folder to /var/www/htdocs/. When I open up http://localhost/p4a/ using Firefox, I can see the P4A page. I'm currently having problem viewing the hello_world sample page correctly and I'm trying to find some answer for that. This RAD program is made for linux but I noticed there's OpenBSD user using it too. So I guess there's a way for me to get it to work correctly.

5) Install NetBeans + PHP plugins.
I installed NetBeans 6.9 from OpenBSD's package. I know NetBeans still have weird character issue on compiling Java codes but I'm not using NetBeans to write Java program. Instead, I want to use NetBeans to write PHP codes. So after I installed NetBeans from package, I installed PHP related plugins. After that, I wrote the hello_world sample P4A code which is available in the P4A website and wallah! It's working. I've also linked NetBeans with PostgreSQL and it's working fine.

So far, all is ok. I'm studying PHP bits by bits, slowly as a serious hobby rather than serious work. One thing for sure, this is a start. Later.

Tuesday, January 19, 2010

OpenBSD NC4200: Howto change the web browser for NetBeans 5.5 & other issues.

Hola. NetBeans 5.5 can be installed using OpenBSD's package. I got mine installed and after playing with it, found a few things that might be interesting fer those who're using OpenBSD + NetBeans.

First of all, by default NetBeans have a few web browser listed in Tool > Options > General tab. If you have either Mozilla, Firefox or Netscape installed; there should be no issue but if you're like me, who installed Firefox 3.5 instead, the will be some problem. If you choose Firefox in NetBeans option, you'll get the browser not configured error as Firefox 3.5 will be installed as "firefox35". Well, previously I just create a symbolic link for "firefox" pointing to "firefox35" like this:

# ln -s /usr/local/bin/firefox35 /usr/local/bin/firefox

and wallah! NetBeans can use the web browser feature happily. Then just now I found out another way round. In NetBeans's Tool > Options window, click on the Advanced Options's button. Go to Options > IDE Configuration > Server and External Tool Settings and then expand the Web Browser link. You'll see Mozilla, Firefox, Netscape and Swing HTML Browser listed there. Right-click on the Firefox link and choose "rename". Rename it to Firefox35 (basically this is optional, it's just a name). Then click on the Firefox link, change the "Browser Executable" option in the Properties window to the right from:

firefox -remote "openURL({URL})"

to

firefox35 -remote "openURL({URL})"

so that the "Process" option is changed from "firefox" to "firefox35" and leaving "Arguements" text intact. Then click "Ok" and "Close" the Advanced Options window. Then try selecting the NetBeans "Help" link and it should open the requested page from firefox35. But as the NetBeans version is lagged behind the current NetBeans version, you'll mostly get "Page Not Found" page from NetBeans's website. Oh well.

I also found another issue with NetBeans. I think this is a problem for a wide variety of OpenBSD + NetBeans user regarding of the NetBeans's version. The not-so-famous "garbled output text" issue. In my case, when I build any project, the first few build will display boxes in the Output window instead of readable build results. So I need to hit F11 a few times before the build result will display the correct readable text. But unfortunately the Run (F6) and Debug (F5) function is much worst. The Output's result is ALWAYS displaying boxes instead of readable text. Why is it not so famous? Well I guess there's only a handful of people using NetBeans on OpenBSD. If I managed to get any similar issue from Google, there's no solution whatsoever. There was one person using Ubuntu and NetBeans 5.5 who had the same issue but there seems no follow up on it. Maybe he managed to find a solution? I'm not sure. In OpenBSD's camp, a guy did put the issue in mailing list and then he opted to go for Eclipse instead. So, no luck to find the solution fer now. I downloaded Eclipse and whoa, with so many modules I can choose; I don't think I have the time.

Anyway, in NetBeans's Tools > Options > Miscellaneous > Ant, I noticed that if I change the "Verbosity Level" from "Normal" to "Quiet", building my project will not display any garbled / boxes text. But then any project which will display any result to Output (System.out.println( ) for example), Running / Debugging the project is as useless as Output with unreadable text because "Quiet" level will not display any output result, just a simple "Build Successful (Total time: x seconds)". *Sigh*. If not for this issue, NetBeans will be just perfect. I'm not sure if this is related to Ant or the 5.5 version of NetBeans. But I do know nearly all people who have/had this problem is using OpenBSD.

I read somewhere that a person suggested to another OpenBSD+NetBeans user to install "dejavu" font but there's no follow up after that. So I don't know if that will resolve the issue or not. Maybe I'll find something the more I play with NetBeans. But still, if anyone out there now any info / solution for this problem, please just comment on my blog here so I can test and share it. Any link/workaround/script/module worth trying is, well, worth trying.

That's it fer now. Yeah well I started learning Java programming a few days ago. Still a newbie. Later.

6.5 amd64: Modify existing certbot certificates.

Hi, It's been quite some time eh. As you can see, I still upgrade my OpenBSD system regularly but currently I do not have the time to ...