[SOLVED] Loading extension issues on WinXP, Apache2, PHP4 &a

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Loading extension issues on WinXP, Apache2, PHP4 &a

Post 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?
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Post by evilmonkey »

Don't you have to uncomment them in php.ini not httpd.conf? (I assume they'er PHP extensions, not apache extensions)
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post 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!
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post 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...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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... :?
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post 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...
Last edited by JAM on Wed Aug 04, 2004 1:26 pm, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

heh, totally forgot about that.. duh... man, I am tapped out from a site launch this week.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Stop hitting that refresh button will yah! Oh man I hate when I don't find the time to edit my posts... ;)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

:D :oops: sorry, jumping back and forth between 3 different things getting it all working.. :P
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post 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.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post 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...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

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