joi, 16 octombrie 2014

Typo3 6.1 installed , but Extension Manager crashes my Apache

I've finally got Typo3 6.1 installed on my machine, but as soon as i went to the backend section 'Extension Manager' - Apache crashed with no helpful error message or so. 
The window popping up was about Apache HTTPD Server crashed with the following messages:

Problem signature:
Problem Event Name: APPCRASH
Application Name: httpd.exe
Application Version: 2.2.21.0
Application Timestamp: 4e6a3015
Fault Module Name: php5ts.dll
Fault Module Version: 5.3.26.0
Fault Module Timestamp: 51af7101
Exception Code: c00000fd
Exception Offset: 00181e69
OS Version: 6.0.6002.2.2.0.768.3
Locale ID: 1048
Additional Information 1: f1e8
Additional Information 2: d4eb7cf28a4f910486e91a11f70d294f
Additional Information 3: 15a9
Additional Information 4: 60b89fd8e863194dd520967f621c3aa4


After a few facepalms, i've learned that the problem was described in the INSTALL file of Typo3. It was a problem due to the small Thread Stack size allocated by Windows for apache's threads by default.
I had to add these lines in my httpd.conf:
<IfModule mpm_winnt_module>
  ThreadStackSize 18388608
</IfModule>
The above sets the Thread Stack Size for about 18 MB, the original 8 MB given as sample in Typo3's Install file, was not enough.

Don't forget to restart Apache after the edit.

Good luck!

PHP OpenSSL extension not working - though i have enabled php_openssl.dll in my php.ini


Even though i had OpenSSL installed, and even enabled php_openssl.dll in my PHP installation, i still received this error from a local script.
Please note that all the following steps need to be completed:

1. Installing OpenSSL. I've done this selecting an included option of Windows Git, it came together with Git.
2. However, the path to openssl.cnf and openssl.exe need to be known. One solution is to add the paths among the Windows Environment Variables. In my Windows Vista, from the Desktop, i have to right-click 'Computer', choose 'Properties' from the menu, click on Advanced System Settings, on the Advanced Tab, clicking the 'Environment Variables' button at the bottom of the opened window.
  - I added a new entry clicking on 'New' under 'System variables'. Entered at the name: OPENSSL_CONF and at the value: C:\Program Files\Git\ssl\openssl.cnf (choose the path corresponding to your openssl.cnf file)
  - Appended the openssl.exe path to my PATH System Variable. Found the variable PATH in the System Variables window, and appended to it: ;C:\Program Files\Git\bin (please note the semicolon and the path to openssl.exe - you must type the path corresponding to your particular installation)
3. Enable the extension openSSL in PHP.
  - Open php.ini, find the line:
    ;extension=php_openssl.dll
  - Uncomment the line by removing the semicolon at the beginning.
  - If this line does not exist, please check your Start->Settings->Control Panel->Programs & Features->PHP(x.x.x) - click on 'Change', again on 'Change' and see if this extension exists and is selected to be installed - at the third or fourth screen within the Change features of this PHP values. Check it and install it if necessary.
4. And finally, if PHP is installed as an Apache module (my configuration is PHP 5.3.6 as PHP module in Apache 2.2) - restart your web (apache) server.

miercuri, 28 mai 2014

Wkhtmltopdf on Windows: The input line is too long

Trying to run wkhtmltopdf from within PHP, on Windows.
While on Linux, the same command used to run perfectly, on Windows I've been getting:
The input line is too long

I've found some answers and this workaround worked for me too:
Placing my command within a temporary .bat file, executing it and removing it afterwards.
For example:
$myLongCMD = '"C:\program files (x86)\wkhtmltopdf\wkhtmltopdf.exe" -d 600 --margin-bottom 24 --margin-left 0 --margin-right 0 --margin-top 13  --orientation Landscape --page-size A4 "E:\www\tmp\1003832673.html" --footer-html "E:\www\tmp\1957525255.html" --footer-html "E:\www\tmp\2038722390.html" "E:\www\tmp\2082679417.html" --footer-html "E:\www\tmp\2038722390.html" "E:\www\tmp\output.pdf"';

$tmpf = 'D:\\www\\myfile.bat';
$tmpp = fopen($tmpf,'w');
fwrite($tmpp, $myLongCMD);
fclose($tmpp);

$descriptors = array(
    0 => array("pipe", "r"), // stdin
    1 => array("pipe", "w"),  // stdout
    2 => array('pipe', 'a') // stderr - Open this as 'Append' as stream_get_contents gets blocked infinitely and the process never ends just as Luceo (many thanks to him) mentions here: http://www.php.net/manual/en/function.proc-open.php
);


$proc=proc_open('"'.$tmpf.'"', $descriptors, $pipes);
fwrite($pipes[0],$input);
fclose($pipes[0]);
$stdout=stream_get_contents($pipes[1]);
fclose($pipes[1]);
$stderr=stream_get_contents($pipes[2]);
fclose($pipes[2]);
$rtn=proc_close($proc);

@unlink($tmpf);


System config:
PHP ver 5.3.9 , Apache 2.4.9, Windows 2008 x64