?
Solved

php config

Posted on 2007-07-23
12
Medium Priority
?
208 Views
Last Modified: 2013-12-13
hi,

i want to configure php4 and php5 to run on my webserver. but how can i make it to let each one read from their own php.ini file, because the ini file in c:\windows differs for php4 and 5
0
Comment
Question by:eaweb
  • 8
  • 3
12 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 19547819
you cannot, it's php ;-)
you either can use your web server's config file with php_admin (if supported), or use the programatic way to set the configuration with ini_set()
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 19547822
The simplest way is via a registry setting. You won't have this at the moment.

Here is my php_ini.reg file ...

=======php-ini.reg=======
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\PHP]
"IniFilePath"="C:\\PHP_INI"

[HKEY_LOCAL_MACHINE\SOFTWARE\PHP\5]
"IniFilePath"="C:\\PHP_INI\\PHP5"

[HKEY_LOCAL_MACHINE\SOFTWARE\PHP\6]
"IniFilePath"="C:\\PHP_INI\\PHP6"
=======php-ini.reg=======



My ini files reside in C:\PHP_INI for PHP4
C:\PHP_INI\PHP5 for PHP5
and
C:\PHP_INI\PHP6 for PHP6

In addition I have ...

C:\PHP_INI\php.ini
C:\PHP_INI\PHP5\php-cgi.ini
C:\PHP_INI\PHP5\php-cli.ini
C:\PHP_INI\PHP5\php-fcgi.ini
C:\PHP_INI\PHP5\php-isapi.ini
C:\PHP_INI\PHP6\php-cgi.ini
C:\PHP_INI\PHP6\php-cli.ini
C:\PHP_INI\PHP6\php-fcgi.ini
C:\PHP_INI\PHP6\php-isapi.ini

As I have different settings for CLI vs ISAPI

0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 19547865
PHP4 only supported the 1 setting.

PHP5+ support this setting.

You can even include version specific INI files ...

HKLM\SOFTWARE\PHP\5.2.4-dev
HKLM\SOFTWARE\PHP\5.2.4
HKLM\SOFTWARE\PHP\5.2
HKLM\SOFTWARE\PHP\5

also are available.

Basically any version number that exists for PHP can have its own INI files.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 51

Expert Comment

by:ahoffmann
ID: 19547874
nice setup RQuadling ..
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 19547884
Initially, I wanted the INI file names to have the version info in addition to the SAPI info, but I was overruled. Having said that, this mechanism is easy to administer with a plain text .reg file.
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 19547911
Thanks. I did a lot of battling on this. The *ix boys really didn't understand the issue for windows users.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 19553918
> The *ix boys ..
dooh, I feel addressed ;-)
> .. understand the issue for windows users.
hmm, 'cause they don't have such issues, can't imagine them and even hadn't them the last 30 years or so ;-)
*SCNR*
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 19554081
Ha. The answer I was constantly getting was that I should just recompile my own version of PHP. At the time, no one was particularly interested in simultaneously running different versions of PHP.

And the lack of a free compiler for windows (at the time), prohibited many from doing just that.

Now that MS VC++ Express Edition exists, it seems that we are now moving towards a level playing field with regards to dabblers (like me) being able to submit patches after having tested them. We could always have submitted patches, but couldn't test them.

0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 19564271
Anything else needed, eaweb?
0
 

Author Comment

by:eaweb
ID: 19564641
yes, just getiing back from some days off.

your solution was great. but one more thing; do you know how to configure php 4 and 5 ini files on quick 'n easy webser of pablo software solutions?
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 19564690
The ini files are NOT controlled by the webserver.

The relationship will be ...

webserver (Apache, Sambar, IIS, etc)
loads
PHP (php.exe, php5isapi.dll, mod-php, etc)
loads
ini file (php.ini, php-cgi.ini, php-isapi.ini, etc).

0
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 2000 total points
ID: 19564725
It seems QnE only supports PHP cgi.

So, having .php4 files ran by C:\PHP4\php.exe and using the registry keys and using C:\PHP_INI\php.ini
and .php files ran by C:\PHP5\php.exe and using the registry keys and using C:\PHP_INI\PHP5\php.ini

should do.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
This holiday season, we’re giving away the gift of knowledge—tech knowledge, that is. Keep reading to see what hacks, tips, and trends we have wrapped and waiting for you under the tree.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month17 days, 6 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question