Page 1 of 1
Loading extension issues on WinXP, Apache2, PHP4 &a
Posted: Fri Jul 30, 2004 4:45 pm
by JAM
I had to convince a friend of mine that it could be done, but well...
Installed Apache2.
Copied the PHP4 & 5 into respective folders, currently using the modules folder of Apache for this.
Installed Apache2 as services using
Code: Select all
apache -k install -n "PHP4" -D PHP4 -f "C:\Program Files\Apache Group\Apache2\conf\httpd.conf"
apache -k install -n "PHP5" -D PHP5 -f "C:\Program Files\Apache Group\Apache2\conf\httpd.conf"
...making it possible for me to use one .conf for two setup's.
Tweaked the httpd.conf so that the above services reads the correct line(s) in the .conf using the -D flag.
Code: Select all
<ifdefine PHP4>
LoadModule php4_module modules/PHP/sapi/php4apache2.dll
</ifdefine>
<ifdefine PHP5>
LoadModule php5_module modules/PHP5/php5apache2.dll
</ifdefine>
(along with different IP:port, logs in the same way).
So far, so good. The server loads both versions of PHP upon starting them. But, the extensions i commented out in the httpd.conf does not load. I'm not getting any errors (neither visually nor in the Event Viewer). the functions to the various extensions doesn't work (nor show up using phpinfo()).
Anyone that can share some light on the matter/have had the same issues?
Posted: Fri Jul 30, 2004 8:36 pm
by evilmonkey
Don't you have to uncomment them in php.ini not httpd.conf? (I assume they'er PHP extensions, not apache extensions)
Posted: Sat Jul 31, 2004 3:19 pm
by JAM
Yup, uncommented the extensions I want/need in the php.ini. I think i know the issue, but I'm not sure if there is a way to work around it on the win32 platform...
Code: Select all
// phpinfo(); shows:
Configuration File (php.ini) Path C:\WINDOWS
Currently, I'm not using a php.ini in the windows directory, as i intend to use two different ones in their respective PHP folder... Is there some way to tell php (and/or apache) that the php.ini is residing somewhere else?
moving the PHP5 php.ini to the windows directory works half way as the PHP5 server loads all extensions, but of course the PHP4 one tries to load the wrong dll's, made for the next generation. Gah!
Posted: Wed Aug 04, 2004 1:02 pm
by JAM
It's solved. However, not as I thought was possible, but it's good enough... (I later found out that a similiar technique is used by
WAMP5. Talk about reinventing the wheel?)
Apart from what's described in the original post, I also had to use a swap.bat file, that stopped apache, copied respective php.ini to %SYSTEMDIR%, restart apache...
Everything broke because php.ini had to be in %SYSTEMDIR% or no extensions would load (?). A workaround can be made, but that would take editing and recompiling the source of PHP... Fun fun...
Posted: Wed Aug 04, 2004 1:05 pm
by feyd
when trying to run concurrent versions, did you tell apache to name the service differently? I've thought about it, can't quite try it yet, still having issues with installing subversion...

Posted: Wed Aug 04, 2004 1:22 pm
by JAM
Well...
Code: Select all
apache -k install -n "PHP4" -D PHP4 -f "C:\Program Files\Apache Group\Apache2\conf\httpd.conf"
The -n directive names the service as pleased. This makes it possible to run the same .exe but as two different servers, PHP4 and PHP5 on either. But...
* You only can use one server/ip:port
* As you intend to use different PHP versions (that uses different module dll's), you need the -D flag, that you later can control basicly whatever using <ifdefine> in the httpd.conf.
* php.ini's placement can't be controlled, so extensions wouldn't load. Personally, then why use PHP?
So i went for the "one at a time" solution. A batch-file stopping apache/mysql, replacing php.ini, restart services. In this case, the -n flag was useless, but the -D was essential...
More?
Sidenote:
I did so many things that day and i cant remember the order, the time-line or if I did something that I just don't know so dont go to deep.

I don't use this at home either, but i think I can get all files my pal if wanted...
Posted: Wed Aug 04, 2004 1:25 pm
by feyd
heh, totally forgot about that.. duh... man, I am tapped out from a site launch this week.
Posted: Wed Aug 04, 2004 1:28 pm
by JAM
Stop hitting that refresh button will yah! Oh man I hate when I don't find the time to edit my posts...

Posted: Wed Aug 04, 2004 1:32 pm
by feyd
Posted: Wed Aug 04, 2004 2:06 pm
by redmonkey
It has been a while since I have done any work with PHP on a win32 platform so I could wrong, but I seem to remember that the first place PHP looks for it's php.ini (on win32) is the directory in which PHP is called from.
So perhaps putting a php.ini file in /PHP/sapi/ and one in /PHP5/ may be a better/cleaner solution. Like I say, it's been a while so good be wrong.
Posted: Thu Aug 05, 2004 4:44 pm
by JAM
I've read that too somewhere!
However I think (note that I'm not sure) that I tried that several times, various locations, without success...
Posted: Thu Aug 05, 2004 5:28 pm
by feyd
after reading the install text file that came in the zip package for win32, it says php.ini is looked for in the main directory or apache (first), then system directory... and I actually tested it, and it works. So placing the php.ini file at "C:\Program Files\Apache Group\Apache2\php.ini" or whatever your main apache install's in..