NodeHost Helpdesk & Docs
Go to website
Code examples to use in many places.
Use PHP to host multiple domains with different HTML content
For starters you need to setup your .htaccess file (in root directory)! Inside root directory create a file called index.php and put this inside of it:
Get real user IP in Wordpress behind NGINX using PHP
Open your WP config file and just place this block at the start of it just before the line you see below ..
Log PHP errors without showing data to visitors
So if you want to see custom errors, but don't want to let your visitors see it, you have a great option called error_log();. With Error log you can write to the default server error logs and see the errors on the NodeHost dashboard at any time. This works on all php versions since PHP 4. Why do I need to use this? If you want to monitor for user errors like failed login attempts, or even database connection errors, database query results that are finding nothing you can write custom mess
Making a PHP script run in the background
This little code at the top of your file will let it run in the background until done, even if the user closes the page once it shows. It will also show this plain message instantly and nothing else. If you add ?show=true to the end of the URL this script won't run so you can see the regular output.
Checking PayPal payments made via PayPal button in PHP
Want to accept PayPal payments in PHP and also verify the payment and run actions after purchase is compleat automatically in PHP? Lets get started, we will be showing the full code at the bottom so you can easily get going out of the box. Setup a PayPal button Login to PayPal and under the tools tab visit all tools and open PayPal buttons. Now we just simply create a new button with the type Buy Now and enter all the details you want. The Third step is the part that sets wha
Calculate how long a PHP script takes to run
Now this one is simple, everything is already in place in PHP, first just add this line before the code you want to measure. Then after your code just use this block and it will output the time in seconds it took to run the code between the 2 blocks.
Redirect non WWW urls to WWW using just .htaccess
This is a simple rule for .htaccess to redirect all non www urls to www. Cloudflare If you're using Cloudflare this can be achieved with a page rule. For URL enter domain.tld/* For settings choose "Forwarding URL" and pick 301 For the forwarding URL put https://www.domain.tld/$1
How to calculate real CPU usage in a PHP script
Simple function you need to add to begin is the following. This will let us compute the results. Now we just add the following before the code we want to get real CPU usage on. Now just after all your code add the following, feel free to edit as needed
How to redirect HTTP to HTTPS using .htaccess
You can automatically redirect visitors to the secured (HTTPS) version of your site to make sure your communications are encrypted by using the following rules in a .htaccess file.
How to redirect subdomain to folder using .htaccess
NodeHost handles subdomains and domains on the same site as the same. However you still might need to handle subdomains as subdirectories of your main domain. Luckily, this can be easily done with some .htaccess. Add subdomain.domain.com as alias to domain.com Create following .htaccess file in the domain.com/public_html/ directory Create subd