Skip to content
This repository has been archived by the owner on Dec 16, 2019. It is now read-only.

Module working in CLI but not in Apache? #154

Closed
rbfowler9lfc opened this issue Aug 17, 2013 · 11 comments
Closed

Module working in CLI but not in Apache? #154

rbfowler9lfc opened this issue Aug 17, 2013 · 11 comments

Comments

@rbfowler9lfc
Copy link

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?

@krakjoe
Copy link
Owner

krakjoe commented Aug 17, 2013

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 ...

@rbfowler9lfc
Copy link
Author

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"

@rbfowler9lfc
Copy link
Author

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.

@krakjoe
Copy link
Owner

krakjoe commented Aug 19, 2013

Excellent find, thanks for updating the bug ...

@krakjoe krakjoe closed this as completed Aug 23, 2013
@staabm
Copy link

staabm commented Jul 17, 2014

Shoudl this be documented somewhere?

@chintanvyas89
Copy link

I am facing same problem for linux.

@chintanvyas89
Copy link

Do we have any workaround or solution for this problem?

@simllll
Copy link

simllll commented Dec 9, 2014

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.
Best thing to start is to set up a file called "phpinfo.php" with in it, open it through your webserver and see if the correct php.ini is used and the "pthreads" extension is loaded&available.

@chintanvyas89
Copy link

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
Configuration File (php.ini) Path: /etc/php5/apache2/
Loaded Configuration File: (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)

My phpinfo(); output is in the screenshot.
for-pthreads

@simllll
Copy link

simllll commented Dec 9, 2014

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)

@chintanvyas89
Copy link

Thanks for the info 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants