0% found this document useful (0 votes)
20 views2 pages

CATATAN 3 Apache PHP

The document discusses configuring an Apache server to run two different versions of PHP concurrently by setting up virtual hosts. It provides code snippets for modifying the Apache configuration files httpd.conf and httpd-vhosts.conf to set the PHP paths and load specific php.ini files to run different PHP versions on different ports and domains.

Uploaded by

k4ngm4ster
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views2 pages

CATATAN 3 Apache PHP

The document discusses configuring an Apache server to run two different versions of PHP concurrently by setting up virtual hosts. It provides code snippets for modifying the Apache configuration files httpd.conf and httpd-vhosts.conf to set the PHP paths and load specific php.ini files to run different PHP versions on different ports and domains.

Uploaded by

k4ngm4ster
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

========================================

5 Apache, 2 Version of PHP (concurently)


========================================

FcgidInitialEnv PATH
"F:\localserver\php\7.3.0;C:/WINDOWS/system32;C:/WINDOWS;C:/WINDOWS/System32/Wbem;"
FcgidInitialEnv SystemRoot "C:/Windows"
FcgidInitialEnv SystemDrive "C:"
FcgidInitialEnv TEMP "C:/WINDOWS/Temp"
FcgidInitialEnv TMP "C:/WINDOWS/Temp"
FcgidInitialEnv windir "C:/WINDOWS"
FcgidIOTimeout 64
FcgidConnectTimeout 16
FcgidMaxRequestsPerProcess 1000
FcgidMaxProcesses 50
FcgidMaxRequestLen 8131072
# Location of php.ini
FcgidInitialEnv PHPRC "F:\localserver\php\7.3.0"
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000
<Files ~ "\.php$">
AddHandler fcgid-script .php
FcgidWrapper "F:/localserver/php/7.3.0/php-cgi.exe" .php
Options +ExecCGI
</Files>

In the above code snippet, we are just creating a default configuration of our
apache server.
Currently, we are setting up the PHP version 7.3 as our default PHP version.

6. You may change the PHP path as per your requirement such as
“F:\localserver\php\7.3.0” or “F:\localserver\php\7.2.13”.

7. Add httpd-default.conf in the httpd.conf. Open httpd.conf and apply the


changes as given below.

# Include conf/extra/httpd-default.conf
to
Include conf/extra/httpd-default.conf

8. Create a new file phpinfo.php at F:\localserver\Apache24\htdocs with the


following content.

<?php
echo phpinfo();
?>

**********************************
Setup Virtual Host for PHP Version
**********************************

1. at C:\Windows\System32\drivers\etc UPDATE host file

127.0.0.1 localhost:90

2. Update the httpd.conf, Open the file and uncomment:


# Include conf/extra/httpd-vhosts.conf
to
Include conf/extra/httpd-vhosts.conf

3. Also, add port no to start listening ===> Listen 90

4. edit the F:\localserver\Apache24\conf\extra\httpd-vhosts.conf file and ADD


the following content:

<VirtualHost *:90>
ServerAdmin [email protected]
DocumentRoot "F:/localserver/Apache24/htdocs"
ServerName localhost:90
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common

# Use below statement to load the specific version of php configuration


FcgidInitialEnv PHPRC "F:/localserver/php/7.2.13/php.ini"

<Directory "F:/localserver/Apache24/htdocs">
<Files ~ "\.php$">
AddHandler fcgid-script .php
FcgidWrapper "F:/localserver/php/7.2.13/php-cgi.exe" .php
Options +ExecCGI
</Files>
</Directory>
</VirtualHost>

In the above code snippet, We are using “FcgidInitialEnv PHPRC” statement


to load the specific PHP config (php.ini) file.

5. Install Service: httpd.exe -k install -n Apache24_php74

6. Start Service: httpd.exe -k start -n Apache24_php74

AH00558: httpd.exe:
Could not reliably determine the server's fully qualified domain name,
using fe80::6576:7baa:d865:812a. Set the 'ServerName' directive globally to
suppress this message

You might also like