Categories
cPanel PHP Scripts SSH Web-Hosting

Execute PHP script from cron or command-line

Execute PHP script from cron or command-line

One of the method for running PHP scripts from a cron job is run the script using php from the crontab. You will need to call the php script from your crontab as given below.
To execute somescript.php every 1 hour you will need to edit and add below given line in your crontab file:
00 * * * * /usr/local/bin/php /home/someuser/somescript.php

If you are looking for command-line interpreter, then it can be done with the following command. It shows how to run a script using the PHP command-line interpreter:

/usr/local/bin/php -q /home/someuser/public_html/somescript.php
The -q option is for quiet mode, to prevent headers being displayed.

Make a note of code in your PHP script, it may only run correctly if called from a mentioned path. For example, if the script uses relative paths to include files, it will only run if it is called from the specified directory. The following command shows how to run a PHP script from a specific path:

cd /home/username/public_html/; /usr/local/bin/php -q script.php

Related: Dedicated Server, Virtual Server, Web Server Hosting

Categories
CSF Dedicated Server Firewall Security SSH VPS Hosting Web-Hosting

syslogd klogd warning in firewall

If you are getting this WARNING message, what you need to do?

Syslogd appears to be running, but not klogd which logs kernel firewall messages to syslog. You should ensure that klogd is running.

How do you enable klogd?

Fire a command:
#whereis klogd
Then simply run klogd with full path:
klogd

Related: Dedicated Servers, VPS Hosting

Categories
Dedicated Server Security Setup VPS Hosting Web-Hosting Windows Hosting

Remote server requires Network Level Authentication (NLA)

How to enable RDP access on server requires Network Level Authentication (NLA)

With Remote Desktop (RDP) when connecting to a Windows Server (XP-SP3 or 2003/2008) with newer remote host, you might get an error saying that “The remote computer requires Network Level Authentication (NLA), which your local pc/laptop/desktop computer doesn’t support.”

To enable the RDP access on server requires Network Level Authentication (NLA) you need to follow below given steps [be careful with registry editor, it’s helpful to backup your registry first, you have been warned]:

  1. Install Service Pack 3 [if XP]
  2. Click Start->Run, type regedit and then press enter
  3. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
  4. Double click on “Security Packages”, to modify the values, leave all existing values, and just add “tspkg” at the end of the list, click OK to save your changes.
  5. Now, navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders
  6. Double click on “SecurityProviders”, and in the dialog box, add “credssp.dll” at the end, be sure that if the list that is present currently is separated by commas, that you add a comma to the value immediately before the “credssp.dll”. Click OK to update.
  7. Close the registry editor and now restart your computer for changes to take the effect.
  8. Try to RDP to your remote server.

Still, finding it difficult, not to worry, get in touch with one of our technical help expert to assist you further.

Related: Windows Server, Remote Desktop, RDP, Server 2008, Windows XP SP3, Windows VPS

Categories
Dedicated Server PHP Scripts Security Virtual Private Server Web-Hosting www

Captcha image is not working – Fatal error?

Captcha image is not working – Fatal error?

You have the GD image library installed and otherwise working.
Still unable to get captcha with the captcha plugin.

You are not sure what’s the problem as it works on one of your other sites.  When you try to include the captcha on your website or contact form it generates an error message like…
Call to undefined function imagettftext() OR
Fatal error: Call to undefined function imagettftext() in /home/user/public_html/appfolder/plugins/captcha/captcha.php on line 99  OR
Fatal error: Call to undefined function imagefttext() in /home/user/public_html/lib/captcha/captcha.php on line 329 OR
‘–enable-gd-native-ttf’

Problem could be, because the standard PHP “imagefttext()” function does not work on your server.
It can caused by the fact that there is no –enable-gd-native-ttf key installed on your server as the Cart uses GD Library for displaying the verification image.

Please note that PHP must be configured with the following keys:
–with-gd –enable-gd-native-ttf  Contact your host to make the change!

Any idea why or how it can be fixed?

imagettftext() is part of the GD image functions library, which is not always part of PHP (the code CMS/Cart runs on).
You need to contact your host and ask them to install the PHP GD library. It’s really simple for them to do and is fairly common, so if they give you a hard time about it, I would seriously consider switching to better and friendly host – UnicHost :).

Related: Web Server, PHP Hosting, LAMP Server, cPanel Hosting

Categories
Dedicated Server Virtual Private Server Web-Hosting

Clear-ssh-command-history-in-ssh-cache-from-server

When I login to SSH and push the up arrow, the previous commands are shown. How do I clear or delete that log?

Clear the history for current login or current user.
#history -c

First find the history file for particular user.
Delete .bash_history file, will be recreated again next time.
#locate .bash_history
#rm .bash_history

It is not a best practice to totally disable the ssh command history on any dedicated server or vps server. It’s a quick reference to user’s past actions on server.