简体   繁体   English

如何在指定端口的命令行中启动apache2?

[英]How to start apache2 in command line specifying a port?

I would like to start Apache2 server in my Linux command line specifying a port. 我想在Linux命令行中指定端口来启动Apache2服务器。 A solution which don't need to edit php.ini would be nice, because the command should not request sudo. 无需编辑php.ini的解决方案会很好,因为该命令不应请求sudo。

I need to access to the server with this adress: 我需要使用以下地址访问服务器:

http://localhost:1234/

For the moment, it start at: 目前,它开始于:

http://localhost/

From PHP 5.4 you can run a localhost server from the command line using 在PHP 5.4中,您可以使用以下命令从命令行运行本地主机服务器

php -S localhost:1234

PHP Docs: http://php.net/manual/en/features.commandline.webserver.php PHP文件: http//php.net/manual/en/features.commandline.webserver.php

You may need to add php to your PATH. 您可能需要将php添加到您的PATH中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM