Hello World
Hello world, 7.5 years later huh? Still kicking it! Holding on tight! Don’t let go! :O)
Hello world, 7.5 years later huh? Still kicking it! Holding on tight! Don’t let go! :O)
I kept getting very aggravating timeout issues when trying to reintegrate a branch back into the trunk of one of our large subversion repositories. Tuned apache’s httpd.conf with the following and the problems disappeared.
#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 60000
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection).
#
KeepAlive On
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
#
MaxKeepAliveRequests 0
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 60000
Ripped blatently from here so that I might not ever lose this information again!
PHP NuSOAP Document/Literal Web Service Server
If you are using regular Pear SOAP, it doesn’t work in document/literal. I tried. So I turned to NuSOAP, which unfortunately has very little in the way of documented examples, especially in document/literal. I am including the server that worked for me (discovered largely through trial and error), as well as a test client. This is designed to mirror Pear SOAP as much as possible (since I was converting from one to the other). Note: document/literal in NuSOAP does not verify data types, so int, string, boolean, etc. are all converted to strings between the client and server.
Server:
require_once("nusoap/nusoap.php");
$server = new soap_server;
$server->configureWSDL('servicename', 'urn:servicename','','document');
myRegister($server,'DoSomething',
array('in' => array('Name' => 'xsd:string',
'Age' => 'xsd:int'),
'out' => array('Pass' => 'xsd:boolean')
));
//if in safe mode, raw post data not set:
if (!isset($HTTP_RAW_POST_DATA)) $HTTP_RAW_POST_DATA = implode("\r\n", file('php://input'));
$server->service($HTTP_RAW_POST_DATA);
function myRegister(&$server,$methodname,$params)
{
$server->register($methodname,$params["in"],$params["out"],
'urn:servicename', // namespace
$server->wsdl->endpoint.'#'.$methodname, // soapaction
'document', // style
'literal', // use
'N/A' // documentation
);
}
function DoSomething($Name,$Age)
{
$result=false;
if ($Name=="mleiv" && $Age==35) $result=true;
return array('Pass'=>$result);
}
Client:
require_once("nusoap/nusoap.php");
$ns="urn:servicename";
$client = new soapclient('http://localhost/wherever/SOAPServer.php?wsdl','wsdl');
if ($client->getError())
{
print "<h2>Soap Constructor Error:</h2><pre>".
$client->getError()."</pre>";
}
$params=array("Name"=>"mleiv","Age"=>35);
$result = $client->call("DoSomething",array("parameters"=>$params),$ns);
if ($client->fault) //soap_fault
{
print "<h2>Soap Fault:</h2><pre>(".$client->fault->faultcode.") ".
$client->fault->faultstring."</pre>";
}
elseif ($client->getError())
{
print "<h2>Soap Error:</h2><pre>".$client->getError()."</pre>";
}
else
{
print "<h2>Result:</h2><pre>".$result["Pass"]."</pre>";
}
print '<h2>Details:</h2><hr />'.
'<h3>Request</h3><pre>' .
htmlspecialchars($client->request, ENT_QUOTES) . '</pre>'.
'<h3>Response</h3><pre>' .
htmlspecialchars($client->response, ENT_QUOTES) . '</pre>'.
'<h3>Debug</h3><pre>' .
htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
I have been pulling what little hair I have out for the past hour trying to figure out a very peculiar thing that was happening to me in php. I was doing some math and a function that I know was supposed to return 0 was returning 1.8189894035459E . If you called the function outside of a loop it worked fine, but is you called it in a while loop for instance, it would return this crazy value. All I had to do was to typecast the result of the integer addition to an (int) and the problem went away. Hope this might help someone in the future save some hair.
Step-by-step installation and configuration rsync server on CentOS
From transamrit.net & http://am3n.profusehost.net/index.php?id=70
Make sure xinetd and rsync is available, if not type
# yum -y install rsync xinetd
Add xinetd service to system
# chkconfig --add xinetd
Make sure xinetd running on init 3 and 5
# chkconfig --list xinetd
Enable rsync
# vi /etc/xinetd.d/rsync
Change disable = yes into disable = no
Create username and password for rsync client to use
# vi /etc/rsyncd.secrets
adminname:hispassword
Create configuration and shares for rsync daemon
# vi /etc/rsyncd.conf
———————-
max connections = 2
log file = /var/log/rsync.log
timeout = 300
[shares]
comment = shared data stored here
path = /home/adminname/shares
read only = false
list = yes
uid = adminname
gid = adminname
auth users = adminname
secrets file = /etc/rsyncd.secrets
hosts allow = 10.10.105.0/24
———————-
Secure /etc/rsyncd.*
# chown root.root /etc/rsyncd.*
# chmod 600 /etc/rsyncd.*
Restart xinetd
# service xinetd restart
Make sure rsync now running
# chkconfig --list
Perhaps you also want to enable port 873 tcp and udp on your firewall so other can connect to your server.
mysqldump -u[uname] -p[password] [table] | mysql -u[uname] -p[password] –host=[ip address] -C [table]
I.E.: mysqldump -umy_user_name -pmy_secret_password foo_table | mysql -umy_2nd_user_name -pmy_2nd_secret_password –host=1.1.1.1 -C foo_table
(whole command should be on one line of course.) 🙂
I need to compile php for Windows so that the ftp_ssl_connect function would be available. This is how I did it. All of this is as of today, May 19, 2008. Windows XP Pro SP2.
If everything went well, you should now have php.exe in the folder C:\work\Release_TS\ which has ftp_ssl_connect functionality.
Great post here:
http://movabletripe.com/archive/recursively-chmod-directories-only/
# recursively chmod directories only
find . -type d -exec chmod 775 {} \;
# recursively chmod files only
find . -type f -exec chmod 664 {} \;
All I had to do was comment out the loopback only restriction and php’s mail() fuction started working great!
vi /etc/mail/sendmail.mc
look for:
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
change it to this:
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
remake the sendmail.cf file
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
restart sendmail:
service sendmail restart
🙂