LAMP How To – Open Source At Work

Only Passion Matters

Entries for the ‘Blog’ Category

php curl proxy settings

It can be daunting to get proxy to work in curl. If it is not working for you, try changing the auth to ntlm.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, ‘http://yoururl.com’);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_PROXY , “your_proxy_ip:proxy_port”);
curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_NTLM);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt($ch,CURLOPT_PROXYUSERPWD,”user:pass”);
curl_exec ($ch);
if(curl_errno($ch))
{
echo ‘Curl error: ‘ . curl_error($ch);
exit;
}
curl_close ($ch);

synchronising system clock manually

if there is a need to synchronise the system clock manually, it can be a straight forward thing

service ntpd stop
ntpdate 0.rhel.pool.ntp.org
service ntpd start

some of the files of interest:

/etc/sysconfig/clock
/usr/share/zoneinfo

Getting or reverting back to an old version in svn

people might think svn revert is the answer but it is actually not. To check out an old version of svn,
svn co -r xxx url
where -r is whatever version to checkout. To update the existing version to an old version
svn update -r xxx url

Installing phpunit

this is very simple, firstly install pear
http://www.azhowto.com/2009/08/14/php-manual-install-of-pear/
then from the pear manual, ie http://www.phpunit.de/manual/3.4/en/installation.html

pear channel-discover pear.phpunit.de
pear channel-discover pear.symfony-project.com
pear install –alldeps phpunit/PHPUnit

getting the latest phpunit will need php 5.2 and above. To get php 5.2,
see http://www.azhowto.com/2009/08/07/getting-new-packages-from-centos-dev-repo/

Starting and stopping vmware in linux command line

One advantage of using command line is that you can start and stop the VM without logging into the web console. I am using vmware server 2.0. I believe it should work the same for future versions.
To start and stop certain instance, say ares,

vmrun -T server -h ‘https://10.2.115.21:8333/sdk’ -u root -p ‘yourpass’ start “[standard] [...]