Archive

Archive for the ‘PHP’ Category

Tuning PHP for Symfony (CentOS 5.4)

May 6, 2010 admin No comments
# vi /etc/php.ini

Replace

...
upload_max_filesize = 200M
...
memory_limit = 1024M
max_execution_time = 900
...
short_open_tag = Off
...
post_max_size = 80M
# /etc/init.d/httpd restart
Categories: PHP, Symfony Tags:

How to install PHP APC (CentOS 5.4 & Plesk 9.3 bei hosteurope.de)

May 5, 2010 admin No comments
# yum install php-pear
# yum install php-devel
# yum install httpd-devel
# pecl install apc
# echo "extension=apc.so" > /etc/php.d/apc.ini
# /etc/init.d/httpd restart

Verify it using the following command

# php -i | grep apc
Categories: CentOS, PHP Tags:

ORA-00018 or ORA-12516 or ORA-12571 (Symfony & PDO & PHP)

March 1, 2010 admin No comments
PropelException: Unable to open PDO connection [wrapped: SQLSTATE[01002]: OCISessionBegin: ORA-00604: error occurred at recursive SQL level 1
ORA-00018: maximum number of sessions exceeded
 (ext\pdo_oci\oci_driver.c:632)]
PropelException: Unable to open PDO connection [wrapped: SQLSTATE[HY000]: pdo_oci_handle_factory: ORA-12516: TNS:listener could not find available handler with matching protocol stack (ext\pdo_oci\oci_driver.c:581)]
PropelException: Unable to open PDO connection [wrapped: SQLSTATE[HY000]: OCISessionBegin: ORA-12571: TNS:packet writer failure (ext\pdo_oci\oci_driver.c:632)]
cd $ORACLE_HOME
su oracle -c "./bin/sqlplus \"/as sysdba\""
show parameter session
show parameter processes
alter system set processes=200 scope=spfile;
shutdown immediate
startup
show parameter session
show parameter processes
Categories: Oracle, PHP, Symfony, Troubleshooting Tags:

PHP & PEAR SAOP

February 17, 2010 admin No comments
# pear install -f --alldeps SOAP

soapservice.php

<?php
require_once 'PEAR.php';
require_once 'SOAP/Server.php';
require_once 'SOAP/Disco.php';
require_once 'SOAP/Value.php';
require_once 'SOAP/Fault.php'; 

$skiptrace =& PEAR::getStaticProperty('PEAR_Error', 'skiptrace');
$skiptrace = true; 

class Service {
	var $__dispatch_map = array(); 

	function Service()
	{
		$this->__dispatch_map['now'] = array(
			'in' => array('format' => 'string'),
			'out' => array('time' => 'dateTime'));
	}
	function now($format)
	{
		if($format == '')
		{
			return new SOAP_Fault("Falscher Paramerter!","0815","Client");
		}

		return new SOAP_Value('time','dateTime',date($format));
	}
} 

$server = new SOAP_Server();
$service = new Service();
$server->addObjectMap($service, 'urn:soapservice'); 

if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD']=='POST')
{
	$server->service($HTTP_RAW_POST_DATA);
}
else
{
	// Create the DISCO server
	$disco = new SOAP_DISCO_Server($server,'soapservice');
	header('Content-type: text/xml');
	if (isset($_SERVER['QUERY_STRING']) && strcasecmp($_SERVER['QUERY_STRING'],'wsdl') == 0)
	{
		echo $disco->getWSDL();
	}
	else
	{
		echo $disco->getDISCO();
	}
}
?>

http://localhost/soapservice.php?wsdl

<?xml version="1.0" ?>
<definitions name="soapservice"
	targetNamespace="urn:soapservice"
	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
	xmlns:tns="urn:soapservice"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
	xmlns="http://schemas.xmlsoap.org/wsdl/">

	<types xmlns="http://schemas.xmlsoap.org/wsdl/" />
	<message name="nowRequest">
<part name="format" type="xsd:string" />
	</message>
	<message name="nowResponse">
<part name="time" type="xsd:dateTime" />
	</message>
<portType name="soapservicePort">
		<operation name="now">
			<input message="tns:nowRequest" />
			<output message="tns:nowResponse" />
		</operation>
	</portType>
	<binding name="soapserviceBinding" type="tns:soapservicePort">
		<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
		<operation name="now">
			<soap:operation soapAction="urn:soapservice#Service#now" />
			<input>
				<soap:body use="encoded" namespace="urn:soapservice" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
			</input>
			<output>
				<soap:body use="encoded" namespace="urn:soapservice" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
			</output>
		</operation>
	</binding>
	<service name="soapserviceService">
		<documentation />
<port name="soapservicePort" binding="tns:soapserviceBinding">
			<soap:address location="http://localhost:8182/soapservice.php" />
		</port>
	</service>
</definitions>

VB SOAP Samples
Download VB Source

Option Explicit

Private Sub cmdGo_Click()
        Dim SOAPSerializer As MSSOAPLib30.SoapSerializer30
        Dim SOAPConnector As MSSOAPLib30.SoapConnector30
        Dim SOAPReader As MSSOAPLib30.SoapReader30

        Set SOAPConnector = New MSSOAPLib30.HttpConnector30

        On Error Resume Next
        Err.Clear

        SOAPConnector.Property("EndPointURL") = txtUrl.Text '"http://localhost/soapservice.php"
        SOAPConnector.Connect

        ' Set Method Call
        SOAPConnector.Property("SoapAction") = "urn:soapservice"
        SOAPConnector.BeginMessage

        Set SOAPSerializer = New MSSOAPLib30.SoapSerializer30
        SOAPSerializer.Init SOAPConnector.InputStream

        SOAPSerializer.StartEnvelope
        SOAPSerializer.StartBody

        SOAPSerializer.StartElement "now", "urn:soapservice"
        SOAPSerializer.StartElement "Format"
        SOAPSerializer.WriteString txtFormat.Text ' "Y-m-d"
        SOAPSerializer.EndElement
        SOAPSerializer.EndElement

        SOAPSerializer.EndBody
        SOAPSerializer.EndEnvelope

        ' Tell the serializer that we are finished providing all message
        SOAPSerializer.Finished
        SOAPConnector.EndMessage

        If Err.Number = 0 Then
                Set SOAPReader = New MSSOAPLib30.SoapReader30
                SOAPReader.Load SOAPConnector.OutputStream
                If Not SOAPReader.Fault Is Nothing Then
                        txtResult.Text = SOAPReader.FaultString.Text
                        txtResult.BackColor = &HC0C0FF
                Else
                        txtResult.Text = SOAPReader.RpcResult.Text
                        txtResult.BackColor = &HC0FFC0
                End If
        Else
                txtResult.Text = Err.Number
                txtResult.BackColor = &HFF&
        End If
End Sub

MS Download Page SOAP Toolkit 3.0
VB SOAP Samples

Categories: PHP, SOAP Tags:

ModSecurity AuditLog: HTTP/1.1 500 SOAP Fault (PEAR::SOAP & Mod_Security 2.5.11)

February 4, 2010 admin No comments
...
$server = new SOAP_Server();
$service = new Service();
$server->_options['http_status_fault'] = '200 SOAP Fault'; // old status '500 SOAP Fault';
...

Links:

Categories: PHP, SOAP, Troubleshooting Tags:

How to install ImageMagick (CentOS 5.4 & Plesk 9.3 bei hosteurope.de)

February 3, 2010 admin No comments
# yum install gcc
# yum install ImageMagick
# yum install ImageMagick-devel
# yum install php-pear
# yum install php-devel
# pecl install imagick
# echo "extension=imagick.so" > /etc/php.d/imagick.ini
# /etc/init.d/httpd restart
# yum install ImageM* netpbm gd gd-* libjpeg libexif gcc coreutils make
# cd /usr/local/src
# wget http://pecl.php.net/get/imagick-2.2.2.tgz
# tar zxvf ./imagick-2.2.2.tgz
# cd imagick-2.2.2
# phpize
# ./configure
# make
# make test
# make install

Verify it using the following command

# php -i | grep imagick
# rpm -qa | grep ImageMagick
# identify -version
Categories: CentOS, PHP Tags: