INDIA WEB HOSTING FAQs

June 27, 2014

Execute PHP script from cron or command-line

Filed under: cPanel,PHP,Scripts,SSH,Web-Hosting — Tags: , , , — Unichost @ 10:55 am

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

March 9, 2012

PHP Warning – PHP Startup – Suhosin Extension does not officially support PHP 5.2

Filed under: cPanel,Dedicated Server,PHP,Security,Setup — Tags: , , , , — Unichost @ 9:10 am

PHP Warning: PHP Startup: Suhosin Extension
does not officially support PHP 5.2 and below anymore, because it is
discontinued. Use it at your own risk. in Unknown on line 0

Since the php upgrade, you might have noticed these type of errors in your server logs. Must be wondering a perfect solution for this.

Actually you should be able to use the latest build, however some older scripts or applications might get in trouble, unless they are ready for latest php version. You need not to worry any more, as you have jumped to right place for it. Just follow the below given steps and you will be at rest.

What to do?

Easy enough, downgrade suhosin from 0.9.33 to 0.9.31 :

# remove suhosin from easyapache php config
/usr/local/cpanel/scripts/phpextensionmgr uninstall PHPSuHosin

# download and install older suhosin
wget http://download.suhosin.org/suhosin-0.9.31.tgz
tar zxf suhosin-0.9.31.tgz
cd suhosin-0.9.31
phpize
./configure
make
make install

#open php.ini and add line loading suhosin
vi /usr/local/lib/php.ini

#Add following line into extensions section:
extension=”suhosin.so”

Save and close the file,  restart apache and you are done. You can also verify if everything is ok with the command php -v from the prompt.

Related: Web Server, Virtual Server, PHP Host, cPanel Host

 

March 10, 2010

Restart cPanel Service or stop cpanel whm on vps or dedicated server.

Filed under: cPanel,Web-Hosting,WHM — Tags: , , — Unichost @ 12:34 pm

Unable to access cPanel WHM?

Restart cPanel Service or stop cpanel whm on vps or dedicated server.

WHM cPanel is a industry standard most popular web-hosting control panel. CPSRVD is the service used to run a cPanel web server. On a web server cpsrvd is running at the background. Major tasks such as maintenance, security checks, and most importantly, it serve WebHost Manager (WHM) web page. If by any chance cpsrvd is stopped, it is almost impossible to get into WHM, your access will be blocked to login to WHM cPanel control panel.

If the cPanel service is down, you can’t perform any of the task trhough WHM to resolve the issue. In fact this service should get start automatically as per the documentation says, but there are chances it will not come up if there is a problem with the configuration. So, what’s the resolve? Get into the server via ssh. What if you don’t have that? Sorry, that’s the only option left with you, so you will need to get connected with the system admin/ vps or dedicated hosting provider / data center technicians to get the cPanel cpsrvd service restarted for you, or start the cpsrvd service if it is stopped.

If you have access to ssh, it’s good. You can perfrom one of the folloing command on your server. Login to server with root access. Then, run one of the following commands:

If you are sure that cPanel service is stopped… ?
To check the status…
#service cpanel status
cpsrvd (pid  7575) is running/stopped…
If stopped… to restart the cpanel service…
#service cpanel restart
OR
#/etc/init.d/cpanel restart
OR
#/etc/rc.d/init.d/cpanel restart

The command will stop the services first and then start the cpsrvd daemon again.
You should be able to login to cpanel/whm from your browser now.

Powered by WordPress