Super Global Variables in PHP

  • What is Super Global Variable?

Super global variable is a variable which can be used in two different files for manipulation.

For example we have a variable “a” in File1.php and we need to print, edit or any manipulation needed to be done in the variable in File2.php then we have to use Super Global Variable as a variable in File1.php.

  • Types of Super Global Variable in PHP:-

– $_GET

– $_POST

– $_REQUEST

– $_COOKIE

– $_SESSION

– $_FILES

  • To see the use of variable $_GET and $_POST follow the link given below:

/https://www.scmgalaxy.com/tutorials/_get-and-_post-variable-in-php/

  • Use of variable $_REQUEST

 $_REQUEST can catch the data which is sent using both POST GET methods whereas $_GET and $_POST can catch the data which is sent by get and post.

  • Use of variable $_SERVER

When we use $_SERVER we can extract extra data from the client when the form is filled. Extra data in a sense we can extract:

– HTTP Connection

– Server Information

– Host Information

– URL Information

We can see it with the example given below:

Now when we insert the data in the form.html we will see the following information:

  • Use of $_COOKIE variable:

Cookies are small file that the server embeds on the user’s computer each time the same computer requests a page with a browser it will send the cookie too. With PHP, we can both create and retrieve cookie values.

To create a cookie we need to run the following command:

setcookie()

Syntax:

setcookie(name, value, expire, path, domain, secure, httponly);

In the syntax only the name parameter is mandatory rest other parameters are optional.

Example for creating a cookie:

  • Use of $_SESSION variable

For session variable refer the link given below:

How Session works in PHP

Tagged : / / / /

How to backup and restore Gerrit server?

How to backup and restore gerrit server?

There are 3 coponent which should be backed up in gerrit

  1. Repository – According to me best way to backup the repository is to setup a replication with other gerrit hosting tools using gerrit replication plugins. The steps can be find as below;
  2. Gerrit Database
    Depends on the database, you should take the database backup. It can be H2 or mysql….
  3. Gerrit Config
    Rysnc is the best tools to take the entire gerrit site backup.

How to replicate Gerrit repository using replication plugins?

Step 1- Setup Gerrit Server
http://www.devopsschool.com/tutorial/gerrit/gerrit-install-and-configuration.html

Step 2 – Create a Project in Gerrit

Step 3 – Setup a Developement Machine
git clone http://admin@35.154.81.167:8080/a/prj1 && (cd prj1 && curl -kLo `git rev-parse –git-dir`/hooks/commit-msg http://admin@35.154.81.167:8080/tools/hooks/commit-msg; chmod +x `git rev-parse –git-dir`/hooks/commit-msg)

Step 4: Sample Commits to be done
> touch file1.txt;git add .;git commit -m”adding first version”

Step 5: Sample push and submit it
> git push origin HEAD:refs/for/master

Step 6: create it $site_path/etc/replication.config

Content of the files is –
[remote “github”]
url = git@github.com:scmgalaxy/${name}.git

Within each URL value the magic placeholder `${name}` is replaced with the Gerrit project name.

Step 7: Generate a public/private key

> ssh-keygen -t rsa

Step 8: create a “config” under /root/.ssh

Host github.com
User git
IdentityFile /root/.ssh/id_rsa
StrictHostKeyChecking no
UserKnownHostsFile /dev/null

Step 9: Update the public key to github

Step 10: Create a repo in Github.com with same name.

Tagged : / / /

Server sent unexpected return value (423 Locked) i

scmuser created the topic: Server sent unexpected return value (423 Locked) i
Hi
During checking of files i am getting following error. Any help?

“Server sent unexpected return value (423 Locked) in response to PUT request for”

scmuser replied the topic: Re:Server sent unexpected return value (423 Locked) i
i found the solution using Tortoise Svn. Steal lock and then update and it worked for me.

Raj

Tagged :

Error validating server certificate for

scmuser created the topic: Error validating server certificate for
I am getting error during checkout source code from Svn.

Error validating server certificate for https://XYZ:443:
– Unknown certificate issuer
Fingerprint: 81:bb:5d:da:c5:7d:fa:f3:f4:9f:06:55:c6:34:e3:b4:64:d0:47:bc
Distinguished name: www.digicert.com , DigiCert Inc, US

sgadmin replied the topic: Re:Error validating server certificate for
It seems your cache Security certification for SVN server has been expired to removed. please Click on “Accept Permanently” to get rid of this issues.

Background:

When speaking to Apache via https://, a Subversion client can receive two different types of information:

a server certificate
a demand for a client certificate

If the client receives a server certificate, it needs to verify that it trusts the certificate: is the server really who it claims to be? The OpenSSL library does this by examining the signer of the server certificate, or certifying authority (CA). If OpenSSL is unable to automatically trust the CA, or if some other problem occurs (such as an expired certificate or hostname mismatch), the Subversion commandline client will ask you whether you want to trust the server certificate anyway.

svn list host.example.com/repos/project

Error validating server certificate for ‘ home.example.com:443 ‘:
– The certificate is not issued by a trusted authority. Use the
fingerprint to validate the certificate manually!
Certificate information:
– Hostname: host.example.com
– Valid: from Jan 30 19:23:56 2004 GMT until Jan 30 19:23:56 2006 GMT
– Issuer: CA, example.com, Sometown, California, US
– Fingerprint: 7d:e1:a9:34:33:39:ba:6a:e9:a5:c4:22:98:7b:76:5c:92:a0:9c:7b

(R)eject, accept (t)emporarily or accept (p)ermanently?

This dialogue should look familiar; it’s essentially the same question you’ve probably seen coming from your web browser (which is just another HTTP client like Subversion!). If you choose the (p)ermanent option, the server certificate will be cached in your private run-time auth/ area in just the same way your username and password are cached (see the section called “Client Credentials Caching”.) If cached, Subversion will automatically remember to trust this certificate in future negotiations.

Your run-time servers file also gives you the ability to make your Subversion client automatically trust specific CAs, either globally or on a per-host basis. Simply set the ssl-authority-files variable to a semicolon-separated list of PEM-encoded CA certificates:

[global]
ssl-authority-files = /path/to/CAcert1.pem;/path/to/CAcert2.pem

Many OpenSSL installations also have a pre-defined set of “default” CAs that are nearly universally trusted. To make the Subversion client automatically trust these standard authorities, set the ssl-trust-default-ca variable to true.

When talking to Apache, a Subversion client might also receive a challenge for a client certificate. Apache is asking the client to identify itself: is the client really who it says it is? If all goes correctly, the Subversion client sends back a private certificate signed by a CA that Apache trusts. A client certificate is usually stored on disk in encrypted format, protected by a local password. When Subversion receives this challenge, it will ask you for both a path to the certificate and the password which protects it:

$ svn list host.example.com/repos/project

Authentication realm: host.example.com:443
Client certificate filename: /path/to/my/cert.p12
Passphrase for ‘/path/to/my/cert.p12’: ********

Notice that the client certificate is a “p12” file. To use a client certificate with Subversion, it must be in PKCS#12 format, which is a portable standard. Most web browsers are already able to import and export certificates in that format. Another option is to use the OpenSSL commandline tools to convert existing certificates into PKCS#12.

Again, the runtime servers file allows you to automate this challenge on a per-host basis. Either or both pieces of information can be described in runtime variables:

[groups]
examplehost = host.example.com

[examplehost]
ssl-client-cert-file = /path/to/my/cert.p12
ssl-client-cert-password = somepassword

Once you’ve set the ssl-client-cert-file and ssl-client-cert-password variables, the Subversion client can automatically respond to a client certificate challenge without prompting you. [24]

Tagged :

Steps to Start-Stop Nagios XI Server | Nagios XI Tutorial

Steps to Start-Stop Nagios XI Server

How to start and stop Naxios XI Server?

How to stop Naxios XI Server?

service nagiosxi stop

service npcd stop

service ndo2db stop

service nagios stop

service postgresql stop

service mysqld stop

service httpd stop

How to start Naxios XI Server?

service httpd start

service mysqld start

service postgresql start

service nagios start

service ndo2db start

service npcd start

service nagiosxi start

Tagged : / / / / / / / / / / / / /

How to Host your own Nuget Feed? | Step by Step Guide | Tutorial

hosting-your-own-nuget-feed

Hosting your own Nuget Feed?

1. Local File Based Package Source

Limitation with fles based source –
It does not have nuget capable feed.
Can not push the package. We will have to copy into local directly
Can not use Nuget Gallery

2. Setup Nuget.Server

Step 1 – In Visual Studip, New Project and Select empty ASP.net Empty Web Application and name and save it.
Step 2 – Using Package Manager console, install package Nuget.Server.
$ install-package nuget.server
Step 3 – Look at the property of the project, under bottom part of web tab – find a port number. i.e – 42386. and open the server.
http:localhost:42386/nuget
Step 4 – Navigate the page and learn about how to user server.
Step 5 – Copy manually one nuget package and try using New NuGet Server using Visual Studip as source with http:localhost:42386/nuget
$ get-package -listavailable
Step 6 – Go to http:localhost:42386/nuget and Refresh the package feed.
Step 7 – How to access using command line – Modify the web.config and modify the apiKey as you want, Restart the application and to go http:localhost:42386/nuget to find the insructions to push the package.
$ nuget.exe push pack.nupkg -s http:localhost:42386/nuget SECRETKEY

3. Setup your Nuget Gallery

Step 1 – Download the zip software from https://github.com/NuGet/NuGetGallery

Step 2 – Unzip it under your visual studio project folder and setup with IIS.

Tools which is helpful to navigate the Nuget package feed.
LinkQPad4

Tagged : / / / / / / / / / / /

How to Install and Configure Nagios Server and Clients | Nagios Tutorial

install-and-configure-nagios-server-and-clients
Install and Configure Nagios Server and Clients
Download the Nagios Server Source copy from https://www.nagios.com/products/nagios-xi/
You can also use the direct download links as below;
> wget https://assets.nagios.com/downloads/nagiosxi/5/xi-5.2.0.tar.gz
Extract the xi-5.2.0.tar.gz using
> tar -zxvf xi-5.2.0.tar.gz
Run the following commands to install it.
> ./fullinstall
At the end of installation, you will get the url address  using you can access the Nagios server.
e.g http://10.160.34.98/nagiosxi/
Open the url http://10.160.34.98/nagiosxi/
and enter and save following info.
Administrator Name:
Administrator Email Address:
Administrator Username:
Administrator Password:
and presss “Install”
Once you get “Installation Complete” message that means you have Nagios Server install completed.
Tagged : / / / / / / / / / / /

How to Setup SVN Server with Apache2 in Ubantu?

setup-svn-server-with-apache2-in-ubantu

This tutorial is to setup the SVNServer from base using Apache2 in Ubantu only.

> sudo apt-get update

> sudo apt-get install subversion apache2 libapache2-svn apache2-utils

> sudo addgroup subversion

> sudo mkdir /home/svn

> sudo chown -R www-data:subversion /home/svn

> sudo chmod -R g+ws /home/svn

> sudo svnadmin create /home/svn/myWebsite

sudo vim /etc/apache2/mods-available/dav_svn.conf

& add the following entry at the end of file.

<Location /svn/myWebsite> DAV svn SVNPath /home/svn/myWebsite AuthType Basic AuthName "myWebsite subversion Repository" AuthUserFile /etc/subversion/passwd <LimitExcept GET PROPFIND OPTIONS REPORT> Require valid-user </LimitExcept> </Location>

sudo htpasswd -c /etc/subversion/passwd rajesh

sudo chown -R www-data:subversion /home/svn/myWebsite

sudo chmod -R g+rws /home/svn/myWebsite

sudo /etc/init.d/apache2 restart

sudo htpasswd /etc/subversion/passwd user1

sudo /etc/init.d/apache2 restart

All DONE.

Now you can access the SVN Server using….

http://uvo12exe3iancqqq622.vm.cld.sr/svn/myWebsite/

If you are still not able to open the url, that means you have IPtables services running and stopping you to access the server. For testing, you can stop the sudo ufw stop

Tagged : / / / / / / / / / / / / / /

Server configuration monitoring and diagnostics

server-configuration-monitoring-and-diagnostics

ScriptRock’s GuardRail

As DevOps gets more agile, infrastructure needs unit tests too. Enterprise startup ScriptRock offers cloud-hosted testing configuration tools to get you started.

Tagged : / / / / / /