Can EasyPHP Devserver Appache Listen to Multiple Ports?

349 views Asked by At

Installed EasyPHP Devserver on Windows 7.

EasyPHP Devserver Version 17.0 (pretty the latest)

EasyPHP Devserver Apache Version 2.4.25

You may skip direct to my conclusion below.

Here is my process of trials.

In the httpd.conf file, I added the second Listen port

Listen 127.0.0.1:80
Listen 127.0.0.1:8080

Then at the EasyPHP Devserver website console (http://127.0.0.1:1111) I restart the Apache. the httpd.conf file will be rewritten to the following, and Apache cannot start. (Where can I see the error log? Nothing written into EasyPHP Devserver\eds-binaries\httpserver\apache...\logs)

Listen 127.0.0.1:80
Listen 127.0.0.1:80

If I leave the httpd.conf file with only one Listen port

Listen 127.0.0.1:8080

Apache starts successful, but httpd.conf is also rewritten back to

Listen 127.0.0.1:80

And in the EasyPHP Devserver website console (http://127.0.0.1:1111) > Http Server Settings (the gear icon) > there is a drop down menu for us to select the Port: 80.

There are a few options, 80 8080, 8000, 8888, 8008. If I change here, and restart the Apache. the httpd.conf is updated according to this setting.

Conclusion

My conclusion is, no matter what I set in the httpd.conf file, the Listen 127.0.0.1:80 will be rewritten by the setting in the EasyPHP Devserver website console > Http Server Settings > Port. The real setting is controlled by the EasyPHP Devserver website console. The httpd.conf file Listen directive is not functionable.

Question

Here comes the question. In fact I only wish to configure Apache Listens to multiple port, 80 for production and 8080 for development. How can I do it?

2

There are 2 answers

0
fabien On

you have to comment line 66,67:

//$replacement = '${1}' . $server_port;
//$serverconffile = preg_replace('/^([\s|\t]*Listen.*\:[\s|\t]*)(.*)$/m', $replacement, $serverconffile);

the line update port number

1
midnite On

Nice. I find out a Brute-Force solution.

In EasyPHP-Devserver-17\eds-binaries\httpserver\apache...\eds-app-actions.php line 97, it is replacing the website console settings to the Apache httpd.conf. I just commented // file_put_contents (__DIR__ . '\conf\httpd.conf', $serverconffile); and Apache httpd.conf will not be overwritten anymore. Nice.

See? The is one of the best parts of open-source. We can always Brute-Force it.