Запустить приложение php с помощью tomcat?
Можно ли запустить приложение PHP с помощью tomcat?
Прежде чем вы скажете мне просто использовать httpd, у меня уже есть приложение Java, работающее на моем веб-сервере на host/myapp . Теперь я хочу установить RoundCube на host / roundcube.
Один из них – PHP, а один – Java. Я постоянно вижу ссылки, говорящие, что это возможно, но никаких реальных указаний. Я не хочу размещать их на отдельных портах, мне нужны стандартные порты HTTP и HTTPS.
У кого-нибудь есть ресурсы для этого?
Да, возможно, будет . мы можем запустить PHP-код на сервере tomcat, используя собственный номер порта localhost: 8080
здесь я пишу какой-то шаг, который так полезен для вас.
Как установить или запустить PHP на Tomcat 6 в windows
скачать и распаковать PHP 5 в каталог, c:\php-5.2.6-Win32 – php-5.2.9-2-Win32.zip Скачать
загрузить PECL 5.2.5 Win32 двоичные файлы – PECL 5.2.5 Win32 Скачать
переименуйте php.ini-dist в php.ini в c:\php-5.2.6-Win32
Раскомментируйте или добавьте строку (удалите полуточку в начале) в php.ini ;extension=php_java.dll
скопируйте php5servlet.dll из PECL 5.2.5 в c:\php-5.2.6-Win32
скопируйте php_java.dll из PECL 5.2.5 в c:\php-5.2.6-Win32\ext
php_java.jar из PECL 5.2.5 в tomcat\lib
создайте директорию с именем «php» (или что-нибудь подобное) в tomcat\webapps
скопировать phpsrvlt.jar из PECL 5.2.5 в tomcat\webapps\php\WEB-INF\lib
Unjar или unzip phpsrvlt.jar для unzip использования winrar или winzip для использования в unjar: jar xfv phpsrvlt.jar
измените как net\php\reflect.properties и net\php\servlet.properties в library=php5servlet
Восстановите файл jar -> jar cvf php5srvlt.jar net / php / . PS: если файл jar не запускается, вам нужно добавить Путь к системным переменным для меня. Я добавил C:\Program Files\Java\jdk1.6.0\bin; to System variables/Path C:\Program Files\Java\jdk1.6.0\bin; to System variables/Path
создайте web.xml в tomcat\webapps\php\WEB-INF с этим контентом:
Добавьте путь PHP ( c:\php-5.2.6-Win32 ) к вашей системе или пути пользователя в среде Windows (Подсказка: щелкните правой кнопкой мыши и выберите «Свойства» на « Мой компьютер»
создать test.php для тестирования под tomcat\webapps\php like
Обычным является запуск Tomcat за Apache. В Apache вы можете направить определенные URL-адреса Tomcat, а Apache / PHP обрабатывать другие (включая статические изображения).
(В Unix сам Tomcat не может безопасно запускаться на порт 80, в то время как Apache может. Tomcat, будучи процессом Java, должен запускаться от имени root, в то время как Apache переключается на привилегии без полномочий root, как только порт 80 будет так что запуск Apache на порту 80 и перенаправление некоторых или всех запросов на Tomcat довольно распространен в Unix.)
Caucho Quercus может запускать PHP-код на jvm.
Немного поздно, но здесь идет.
Как насчет http://wiki.apache.org/tomcat/UsingPhp, если вы просто хотите запустить реальный php на tomcat.
Что касается работы tomcat на порту 80, всегда есть jsvc, просто google jsvc + tomcat.
Там этот мост PHP / Java . Это в основном работает PHP через FastCGI. Я не использовал его сам.
tomcat разработан как контейнер сервлетов JSP. Apache разработан веб-сервером PHP. Используйте apache как веб-сервер, отвечая на запрос PHP и отправляйте запрос сервлета JSP в контейнер tomcat. должна быть лучше реализована.
Если кто-то еще смотрит – у Quercus есть война, которая позволяет запускать PHP-скрипты в apache tomcat или glassfish. Для пошагового руководства посмотрите на эту статью
Apache Tomcat ®
Content
Apache Tomcat
The Apache Tomcat ® software is an open source implementation of the Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket technologies. The Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket specifications are developed under the Java Community Process.
The Apache Tomcat software is developed in an open and participatory environment and released under the Apache License version 2. The Apache Tomcat project is intended to be a collaboration of the best-of-breed developers from around the world. We invite you to participate in this open development project. To learn more about getting involved, click here.
Apache Tomcat software powers numerous large-scale, mission-critical web applications across a diverse range of industries and organizations. Some of these users and their stories are listed on the PoweredBy wiki page.
Apache Tomcat, Tomcat, Apache, the Apache feather, and the Apache Tomcat project logo are trademarks of the Apache Software Foundation.
2020-10-09 Tomcat 9.0.39 Released
The Apache Tomcat Project is proud to announce the release of version 9.0.39 of Apache Tomcat. The notable changes compared to 9.0.38 include:
- Refactor the handling of closed HTTP/2 streams to reduce the heap usage associated with used streams and to retain information for more streams in the priority tree.
- Allow using the utility executor for annotation scanning. Patch provided by Jatin Kamnani.
- Add a bloom filter to speed up archive lookup and improve deployment speed of applications with a large number of JARs. Patch provided by Jatin Kamnani.
Full details of these changes, and all the other changes, are available in the Tomcat 9 changelog.
2020-10-09 Tomcat 8.5.59 Released
The Apache Tomcat Project is proud to announce the release of version 8.5.59 of Apache Tomcat. Apache Tomcat 8.5.x replaces 8.0.x and includes new features pulled forward from Tomcat 9.0.x. The minimum Java version and implemented specification versions remain unchanged. The notable changes compared to 8.5.58 include:
- Refactor the handling of closed HTTP/2 streams to reduce the heap usage associated with used streams and to retain information for more streams in the priority tree.
- Deprecate the JDBCRealm.
- Ensure that none of the methods on a ServletContext instance always fail when running under a SecurityManager. Pull request provided by Kyle Stiemann.
Full details of these changes, and all the other changes, are available in the Tomcat 8.5 changelog.
2020-10-09 Tomcat 10.0.0-M9 Released
The Apache Tomcat Project is proud to announce the release of version 10.0.0-M9 of Apache Tomcat. This release is a milestone release and is targeted at Jakarta EE 9.
Users of Tomcat 10 onwards should be aware that, as a result of the move from Java EE to Jakarta EE as part of the transfer of Java EE to the Eclipse Foundation, the primary package for all implemented APIs has changed from javax.* to jakarta.* . This will almost certainly require code changes to enable applications to migrate from Tomcat 9 and earlier to Tomcat 10 and later. A migration tool is under development to aid this process.
The notable changes in this release are:
- Refactor the handling of closed HTTP/2 streams to reduce the heap usage associated with used streams and to retain information for more streams in the priority tree.
- Allow using the utility executor for annotation scanning. Patch provided by Jatin Kamnani.
- Add a bloom filter to speed up archive lookup and improve deployment speed of applications with a large number of JARs. Patch provided by Jatin Kamnani.
Full details of these changes, and all the other changes, are available in the Tomcat 10 (alpha) changelog.
2020-09-20 Tomcat 7.0.106 Released
The Apache Tomcat Project is proud to announce the release of version 7.0.106 of Apache Tomcat. This release contains a number of bug fixes and improvements compared to version 7.0.105.
- Add support for a read idle timeout and a write idle timeout to the WebSocket session via custom properties in the user properties instance associated with the session. Based on a pull request by sakshamverma.
- Update the packaged version of the Tomcat Native Library to 1.2.25
Full details of these changes, and all the other changes, are available in the Tomcat 7 changelog.
Note: End of life date for Apache Tomcat 7.0.x is announced. Read more.
2020-09-03 Tomcat Native 1.2.25 Released
The Apache Tomcat Project is proud to announce the release of version 1.2.25 of Tomcat Native. The notable changes since 1.2.24 include:
- Various improvements to the build process
- Add an option to allow the OCSP check to be bypassed
2020-03-06 Tomcat Connectors 1.2.48 Released
The Apache Tomcat Project is proud to announce the release of version 1.2.48 of Apache Tomcat Connectors. This version fixes a number of bugs found in previous releases.
2015-03-17 Apache Standard Taglib 1.2.5 Released
The Apache Tomcat Project is proud to announce the release of version 1.2.5 of the Standard Taglib. This tag library provides Apache’s implementation of the JSTL 1.2 specification.
Version 1.2.5 is a minor bug fix release reverting a change made in 1.2.1 where modified the HTTP method during POST operations, and fixing an issues that resulted in an AccessControlException during startup unless permission was granted to read the accessExternalEntity property.
Please see the Taglibs section for more details.
2013-11-11 Tomcat Maven Plugin 2.2 Released
The Apache Tomcat team is pleased to announce the release of Tomcat Maven Plugin 2.2. Changelog available here.
The Apache Tomcat Maven Plugin provides goals to manipulate WAR projects within the Apache Tomcat servlet container.
The binaries are available from Maven repositories. You should specify the version in your project’s plugin configuration:
Apache Tomcat 8
Windows service HOW-TO
Table of Contents
Tomcat service application
Tomcat8 is a service application for running Tomcat 8 as a Windows service.
Tomcat monitor application
Tomcat8w is a GUI application for monitoring and configuring Tomcat services.
The available command line options are:
//ES// | Edit service configuration | This is the default operation. It is called if the no option is provided but the executable is renamed to servicenameW.exe |
//MS// | Monitor service | Put the icon in the system tray |
Command line arguments
Each command line directive is in the form of //XX//ServiceName
The available command line options are:
//TS// | Run the service as console application | This is the default operation. It is called if the no option is provided. The ServiceName is the name of the executable without exe suffix, meaning Tomcat8 |
//RS// | Run the service | Called only from ServiceManager |
//SS// | Stop the service | |
//US// | Update service parameters | |
//IS// | Install service | |
//DS// | Delete service | Stops the service if running |
Command line parameters
Each command line parameter is prefixed with —. If the command line parameter is prefixed with ++ then it’s value will be appended to the existing option. If the environment variable with the same name as command line parameter but prefixed with PR_ exists it will take precedence. For example:
is equivalent to providing
as command line parameter.
ParameterName | Default | Description |
---|---|---|
—Description | Service name description (maximum 1024 characters) | |
—DisplayName | ServiceName | Service display name |
—Install | procrun.exe //RS//ServiceName | Install image |
—Startup | manual | Service startup mode can be either auto or manual |
—DependsOn | List of services that this service depend on. Dependent services are separated using either # or ; characters | |
—Environment | List of environment variables that will be provided to the service in the form key=value. They are separated using either # or ; characters. If you need to use either the # or ; character within a value then the entire value must be enclosed inside single quotes. | |
—User | User account used for running executable. It is used only for StartMode java or exe and enables running applications as service under account without LogonAsService privilege. | |
—Password | Password for user account set by —User parameter | |
—JavaHome | JAVA_HOME | Set a different JAVA_HOME than defined by JAVA_HOME environment variable |
—Jvm | auto | Use either auto (i.e. find the JVM from the Windows registry) or specify the full path to the jvm.dll. You can use the environment variable expansion here. |
—JvmOptions | -Xrs | List of options in the form of -D or -X that will be passed to the JVM. The options are separated using either # or ; characters. If you need to embed either # or ; characters, put them inside single quotes. (Not used in exe mode.) |
—JvmOptions9 | List of options in the form of -D or -X that will be passed to the JVM when running on Java 9 or later. The options are separated using either # or ; characters. If you need to embed either # or ; characters, put them inside single quotes. (Not used in exe mode.) | |
—Classpath | Set the Java classpath. (Not used in exe mode.) | |
—JvmMs | Initial memory pool size in MB. (Not used in exe mode.) | |
—JvmMx | Maximum memory pool size in MB. (Not used in exe mode.) | |
—JvmSs | Thread stack size in KB. (Not used in exe mode.) | |
—StartMode | One of jvm, Java or exe. The modes are:
| |
—StartImage | Executable that will be run. Only applies to exe mode. | |
—StartPath | Working path for the start image executable. | |
—StartClass | Main | Class that contains the startup method. Applies to the jvm and Java modes. (Not used in exe mode.) |
—StartMethod | main | Method name if differs then main |
—StartParams | List of parameters that will be passed to either StartImage or StartClass. Parameters are separated using either # or ; character. | |
—StopMode | One of jvm, Java or exe. See —StartMode for further details. | |
—StopImage | Executable that will be run on Stop service signal. Only applies to exe mode. | |
—StopPath | Working path for the stop image executable. Does not apply to jvm mode. | |
—StopClass | Main | Class that will be used on Stop service signal. Applies to the jvm and Java modes. |
—StopMethod | main | Method name if differs then main |
—StopParams | List of parameters that will be passed to either StopImage or StopClass. Parameters are separated using either # or ; character. | |
—StopTimeout | No Timeout | Defines the timeout in seconds that procrun waits for service to exit gracefully. |
—LogPath | %SystemRoot%\System32\LogFiles\Apache | Defines the path for logging. Creates the directory if necessary. |
—LogPrefix | commons-daemon | Defines the service log filename prefix. The log file is created in the LogPath directory with .YEAR-MONTH-DAY.log suffix |
—LogLevel | Info | Defines the logging level and can be either Error, Info, Warn or Debug. (Case insensitive). |
—StdOutput | Redirected stdout filename. If named auto then file is created inside LogPath with the name service-stdout.YEAR-MONTH-DAY.log. | |
—StdError | Redirected stderr filename. If named auto then file is created inside LogPath with the name service-stderr.YEAR-MONTH-DAY.log. | |
—PidFile | Defines the file name for storing the running process id. Actual file is created in the LogPath directory |
Installing services
The safest way to manually install the service is to use the provided service.bat script. Administrator privileges are required to run this script. If necessary, you can use the /user switch to specify a user to use for the installation of the service.
NOTE: On Windows Vista or any later operating system with User Account Control (UAC) enabled you will be asked for additional privileges when ‘Tomcat8.exe’ is launched by the script.
If you want to pass additional options to service installer as PR_* environment variables, you have to either configure them globally in OS, or launch the program that sets them with elevated privileges (e.g. right-click on cmd.exe and select «Run as administrator»; on Windows 8 (or later) or Windows Server 2012 (or later), you can open an elevated command prompt for the current directory from the Explorer by clicking on the «File» menu bar). See issue 56143 for details.
There is a 2nd optional parameter that lets you specify the name of the service, as displayed in Windows services.
If using tomcat8.exe, you need to use the //IS// parameter.