PHP code calculate age based on date of birth

Many time we do face issue to calculate the date of birth using birthday date, therefore we have created following simple PHP script to calculate the age within few seconds only.

<?php
    $dob='1989-10-07';
    $diff = (date('Y') - date('Y',strtotime($dob)));
    echo $diff;
?>

Above script will show the output as per current date and year, for example today its 22nd Nov 2016, therefore above script output will be 27 years.

log in to MySql server without password

We can login into MySql prompt without password from shell using root user .

To configure mysql user prompt without password, open the file ~/.my.cnf file and add the following section.

[client]
user=root
password=password

If you don’t know MySql password,, then simply reset the mysql root user password and define it in above file.

disabled secure connection in joomla website

Some time when SSL certificate expires , we want to disable the SSL certificate redirect for joomla websites. We can disable secure connection from shell using configuration file.

Open the configuration.php file and change the value

From

public $force_ssl = ‘1’;

To

public $force_ssl = ‘0’;

As well as make sure that, you have disabled the secured connection redirect code in .htaccess file.

Enable or Disable comments in WordPress

Many time we do face spamming issue because of comment feature enabled in WordPress and we want to disable comments on all posts.

Simply login into the Server or phpmyadmin and run the following in WordPress database but make sure that you have selected correct database name.

UPDATE posts p SET comment_status = ‘closed’, ping_status = ‘closed’ WHERE comment_status = ‘open’;

If you want to enable the Wordpres post comments once spamming stopped, then execute the following command

UPDATE posts p SET comment_status = ‘open’, ping_status = ‘open’ WHERE comment_status = ‘closed’;

If you have any problem to enable or disable the WordPress posts, then simply contact us on live chat support.

 

Top 5 reasons for you to choose KTCHost Dedicated Hosting Provider

Top 5 reasons for you to choose KTCHost Dedicated Hosting Provider

These days all kinds of companies are it large or small have many options for hosting their website or web application through dedicated hosting providers. Shared hosting has now become the top choice for most of them where a number of websites share resources of a single server. However, if a company wants more power and control over their websites, apps and web application, they can opt for services providers who give the service of dedicated hosting. These providers make sure that the clients have CPU, disk space, and RAM but at the same time maintains the servers themselves, hence, reducing the cost of purchasing and maintaining their own servers.

We have shortlisted 5 advantages of using dedicated hosting providers:

1.You don’t need to share the server

By choosing a KTCHost dedicated hosting provider, you get all the resources available to a single server. There is no need to worry about other websites blocking the CPU and RAM of your server. Bad scripts and other problems with bandwidth usage do not slow down the server if you go for the option of KTCHost dedicated servers.

2. An increase in performance and security

Brander hardwareA KTCHost dedicated hosting  server makes sure that your website has a long uptime. This is best for websites that have very low or medium flow of traffic. Moreover, in the case of a high flow of traffic, dedicated servers enhances the stability and reliability than the shared hosts. Also, this makes sure that malicious websites and potential spammers don’t slow down the website. It gives high-level security which for transactions on FTP or SSL.

3. It gives high flexibility

If you opt for KTCHost dedicated servers, it customizes the servers to the needs of the clients in terms of CPU, disk space, software, and RAM. This is not the case in shared hosting where the customers have to take the limited services and sometimes software that they don’t really need. In contrast, in the KTCHost dedicated servers, you can only choose the services and software that you really really need.

4. Availability of a unique IP address

KTCHost Dedicated servers give you your own IP address that protects you from your website rank going down. In case you have a neighbor who is a spammer or running an adult website, it pushes the rating of your website further down. Therefore, dedicated servers play an important role especially in cases where you are running a big website of e-commerce services which requires you to have SSL for credit card processing.

5. Helps you save cost of purchasing and maintenance

SSL CertificateThe biggest advantage of using KTCHost dedicated server hosts is that you save on the cost of purchasing and maintenance. It is a very low-cost of having access to all kinds of resources in its full form. You don’t have to spend on building or the maintenance of server equipment. It also reduces the cost of purchasing server space, thus increasing the return on your investment.

In the long run, if you are planning to run a big e-commerce website which requires secure payments, KTCHost dedicated servers is the best options because it gives you all the resources at low cost and also enhances the security of your website.