Module working in CLI but not in Apache? #154
Comments
You will need to restart Apache, and ensure that Apache uses the same configuration file as the CLI ... maybe a windows user can give you more specific help ... |
Indeed. I forgot to mention that when I restart Apache service (it is installed as a service, btw), it displays two message boxes saying "PHP startup:" and nothing else, but finishes loading and works as expected w/other extensions except pthreads. php_error_log shows the following entry related to these events: "[16-Aug-2013 23:59:02 UTC] PHP Warning: PHP Startup: in Unknown on line 0" |
Well, I couldn't find detailed Windows installation information, and the posts/articles I found about it dealt only with adding the extension dll to php.ini, which makes pthreads work in CLI but not in a browser window. Adding LoadFile "C:/xampp/php/pthreadVC2.dll" to Apache's httpd.conf does it, finally. |
Excellent find, thanks for updating the bug ... |
Shoudl this be documented somewhere? |
I am facing same problem for linux. |
Do we have any workaround or solution for this problem? |
rbfowler9lfc found a solution for Windows. However this dll is not needed in a linux environment, so I guess it something else with your setup. |
thread safety is disabled in php.ini but i dont know why. I followed this instruction for installing the pthread http://php.net/manual/en/pthreads.installation.php#112868 Is there any specific config I should do for loading correct php.ini? Result of cli for php --ini |
Well, you simply have the wrong php version (thread safe required). either you do this via debian .. e.g. http://stackoverflow.com/questions/17443392/install-debian-package-with-change-configuration or you get the source code directly from php.net and build php yourself. Don't forget that you also need to build the apache2 mod_php and put it in the apache2 module directory (--with-apxs2). For more information I suggest you ask google, as this is actually the wrong place to discuss how to install php ;). Good luck though. One last hint: basically it's step 6 where you should try this command instead: ./configure --enable-debug --enable-maintainer-zts --enable-pthreads --with-apxs2=/path/to/apxs2/of/your/apache2/installation (or just try --with-apxs2..maybe it finds the path itself) |
Thanks for the info 👍 |
Using Apache 2.4.6 Win32 VC9, PHP 5.4.7 VC9 with thread safety enabled, I installed php_pthreads-0.44-5.4-ts-vc9-x86, placed php_pthreads.dll under \PHP\ext and pthreadVC2.dll under \PHP and added a extension=php_pthreads.dll in php.ini.
php -m lists pthreads being loaded correctly, and executing php scripts from CLI works fine. But executing the same script in Apache does not, results in "Fatal error: Class 'Thread' not found in \PHP[blah blah]\threadtest.php on line 4".
Am I missing something I need to do to Apache's configuration?
The text was updated successfully, but these errors were encountered: