How Do You Comment out a Line in PHP?

Problem scenario
You want to try some .php scripts or web pages without certain lines of code.  How do you comment out an individual line?

Solution
Use this at the beginning of a line of code: //

Example:  //this text will do nothing in the .php script

To comment out multiple lines, use this at the beginning of the first line: /*
Then conclude the multi-line comment with this: 

How Do You Troubleshoot Connecting to a Postgres Database When You Get the Error “FATAL: Ident Authentication Failed”?

Problem scenario
You are trying to establish a connection with a username and password to a Postgres database using PHP.  You have a PHP file like this:  

<?php
   $host        = “host=127.0.0.1”;
   $port        = “port=5432”;
   $dbname      = “dbname=contint”;
   $credentials = “user=contint password=excellent”;

   $db = pg_connect( “$host $port $dbname $credentials”  );
   if(!$db){
      echo “Error : Unable to open database\n”;

The Latest News on The Law and Technology

The news below is focused on the legal issues of computing, intellectual property (copyrights, patents and trademarks), science and technology.  The external links are to reputable websites.

How Do You Troubleshoot Mounting a Vboxsf Folder Share on a Linux Guest Running via Oracle VirtualBox on a Windows Host?

Problem scenario:  You are trying to mount a file share using Oracle VirtualBox.  You have a Windows host and a Linux CentOS guest.  (For complete directions on how to set up a folder share for this scenario, see this link.) 

You are trying to run this command:  “mount -t vboxsf contint /mnt/windows-share”
# where “contint” is the name of the folder share in the Oracle VirtualBox GUI.

How Do You Get the Apache Web Service to Start after a Cold Reboot?

Problem scenario
You want the Apache web service to start automatically after a Linux server is rebooted.  You want it to start automatically when you turn on a Linux server (after being off completely).  On Linux CentOS you have this entry in /etc/crontab:

@reboot            root         apachectl start

You notice that on reboots (warm or soft) it works.  But when you turn on your server after it has been off,

How Do You Get Apache Web Service to Start Automatically after a Reboot of a CentOS Linux Server?

Problem scenario  
You have to manually start Apache web server every time you do reboot the server.  You want the Apache web service to start automatically.

Solution
1.  Edit /etc/crontab.  Add the lowest line of these two (the line above is for reference):

# *  *  *  *  * user-name  command to be executed
@reboot         root       apachectl start

2.

How Do You Fix a PHP Web Page when the Page Is Completely Blank?

Problem scenario
Using a web browser you go to a PHP web page.  There are no errors, but the page is blank.  It is just all white, but you expect content to be rendered (e.g., text should be visible).  The WSOD (white screen of death) is a common problem to troubleshoot in a web browser.  What do you do to see output you want it to display?  

Solution
1.

How Do You Place a Postgres Database on a Flash Drive on a Windows Host Running Oracle VirtualBox with a Linux Guest VM?

Problem scenario
You have Postgres installed on the Linux guest of Oracle VirtualBox.  You have storage capacity on the Windows host.  You can interactively work with smbclient to share files between the Linux guest and the Windows host.   You want to share files between the two servers without the interactive smb commands.  You want the Postgres database to reside on the Windows host.  This way your Linux guest hard disk does not have to be expanded but can run Postgres commands from your Linux guest.

How Do You Troubleshoot an Apache Web Service Problem when from a Web Browser You Receive the Error “The Address Is Restricted”?

Problem scenario
You are using Oracle VirtualBox on a Windows host.  You are using a Linux guest that is running Apache web server.  The Apache httpd service is running on the guest Linux server.  But when you are on the Windows host, you try to access the website, you get an error in the web browser.  This is the error you receive:

“This address is restricted
This address uses a network port which is normally used for purposes other than Web browsing.

How Do You View the Website That Your Oracle VirtualBox Guest Server Is Presenting with a Web Browser on Your Windows Host?

Problem scenario:  You have a Linux VM guest running on Oracle VirtualBox.  You installed Apache web server on this server.  How do you browse to its website from your Windows host machine?

Solution

#1  Determine the host IP address as configured for the guest.  In Oracle VirtualBox go to Devices -> Network -> Network Settings.  For Adapter1 go to “Advanced” and click the button for “Port Forwarding.” The host IP address may be 127.0.1.1.