- PHP не работает на ubuntu
- Не работает php в apache2 ubuntu?
- How to fix Apache 2 not executing PHP files
- Networking: Must-read coverage
- Modify the .conf file
- Enable/disable modules
- Restart Apache 2
- A simple fix
- Subscribe to the TechRepublic Premium Exclusives Newsletter
- Also See
- Account Information
- Share with Your Friends
- Account Information
- Contact Jack Wallen
- Editor’s Picks
- TechRepublic Premium Editorial Calendar: IT Policies, Checklists, Hiring Kits and Research for Download
- Microsoft’s First Generative AI Certificate Is Available for Free
- How Generative AI is a Game Changer for Cloud Security
- The 8 Best International Payroll Services for 2023
- ChatGPT Cheat Sheet: Complete Guide for 2023
- 6 Best monday.com Competitors and Alternatives for 2023
- Subscribe to the TechRepublic Premium Exclusives Newsletter
- TechRepublic Premium
- Conflict of Interest Disclosure Policy
- Intrusion Detection Policy
- Feature Comparison: CRM Software and Services
- eLearning and Continuing Education Policy
PHP не работает на ubuntu
Не понимаю почему? но не работает php купил сервер на Линуксе установил все нужные плагины или как там это называется и начал редактировать в Apache2 html вставляю люой php код а он не работает стоит php5, не могу понять в чём причина. Может кто сталкивался, помогите или если есть желающие вот скайп: <вырезано>помогите, а то вообще ещё не разобрался в этом всём.вырезано>
Не работает скачанная библиотека (*.php, Ubuntu)
Здравствуйте! Настроил у себя виртуальный хостинг (настроен LAMP на OS Ubuntu). Запустил тестовый.
Не работает PHP код. Файлы .php не обрабатываются, хотя, если занести в html, всё работает.
не могу разобраться с проблемой. установила денвер, вроде все работает, но как только начала.
Как заменить PHP 7 на PHP 5.6 в Ubuntu 16.04? Установлена как модуль Apache 2.4
Переехал на новый VPS а на нем по умолчанию стоит 7 PHP. Я хочу поставить 5.6 чтобы не морочить.
Apache+Ubuntu не работает/работает не корректно
Переустановил апачи иии оно не работает. Установка прошла без ошибок, но на старт, рестарт, стоп.
не, все равно не работает. вот http://31.186.250.187/ может что-то даст. устанавливаю финю чтобы на сайте отображалось сколько игроков играет на сервер и т.д. http://www.phpclasses.org/pack. erver.html вот отсюда, не работает и всё.
PHP 5.6.11-1ubuntu3.1 (cli) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
а после php -r ‘echo 1, PHP_EOL;’ вывелось число 1.
Что я хотел сказать? Это то что оно установлено, все дела. Но когда я редактирую файл var/www/html/index.html то код php добавляется уже на готовую страницу в виде текста а не функции. И ничего не работает не понимаю по чему?
Значит, PHP работает, не грешите.
По дефолту обрабатываются как php-файлы те, которые с «.php» в конце имени, а те, которые с «.html» в конце — обрабатываются как html (удивительно, не правда ли?). Либо переименуйте, либо настройте с помощью AddHandler (лучше первое, имхо). А вообще, почитайте тему PHP код не выполняется / не работает / выводится в браузер / пустая белая страница
Не работает php в apache2 ubuntu?
Всем привет, установил апачи на линукс, запустил там html файлы, все работало, потом закинул туда php скрипты, но они не отображаются, тупо отображается страница 403 Forbidden, а при попытке перейти на другу php страницу он скачивает этот файл. Пробовал переустанавливать php на vds ubuntu, не помогло. Кто знает как решить эту проблеме?
Простой 11 комментариев
Последним компонентом вашего стека LAMP на Ubuntu 20.04 является PHP .
сергей кузьмин, Что это значит?
Как исправить ошибку в конце?
Pro_Hacker, зачем вы поставили апач если у вас уже стоит nginx? ясень хрень что nginx не даст апачу забрать 80 порт
текстом (а не картинкой) опубликуйте вывод
sudo systemctl status apache2
или
sudo service apache2 status
и что там в error.log куда вам прелагают посмотреть
судя по жалобе на занятый порт вам надо сначала остановить уже работующий апач а потом запускать новый
* apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: Drop-In: /lib/systemd/system/apache2.service.d `-apache2-systemd.conf Active: failed (Result: exit-code) since Thu 2022-10-27 19:54:35 MSK; 31min a Oct 27 19:54:35 1081859-cg28294.tmweb.ru apachectl[3881]: AH00112: Warning: Docu Oct 27 19:54:35 1081859-cg28294.tmweb.ru apachectl[3881]: (98)Address already in Oct 27 19:54:35 1081859-cg28294.tmweb.ru apachectl[3881]: (98)Address already in Oct 27 19:54:35 1081859-cg28294.tmweb.ru apachectl[3881]: no listening sockets a Oct 27 19:54:35 1081859-cg28294.tmweb.ru apachectl[3881]: AH00015: Unable to ope Oct 27 19:54:35 1081859-cg28294.tmweb.ru apachectl[3881]: Action 'start' failed. Oct 27 19:54:35 1081859-cg28294.tmweb.ru apachectl[3881]: The Apache error log m Oct 27 19:54:35 1081859-cg28294.tmweb.ru systemd[1]: apache2.service: Control pr Oct 27 19:54:35 1081859-cg28294.tmweb.ru systemd[1]: apache2.service: Failed wit Oct 27 19:54:35 1081859-cg28294.tmweb.ru systemd[1]: Failed to start The Apache lines 1-16/16 (END)
How to fix Apache 2 not executing PHP files
If your Apache 2 web server is failing to execute PHP files, learn how to quickly remedy this issue.
We may be compensated by vendors who appear on this page through methods such as affiliate links or sponsored partnerships. This may influence how and where their products appear on our site, but vendors cannot pay to influence the content of our reviews. For more info, visit our Terms of Use page.
How many times have you set up a web server with Apache 2 only to find out that when you attempt to view a page with a .php extension, the page either attempts to save onto the local drive or it displays the PHP code in the browser? This is bad on multiple levels. First off, your website isn’t functioning properly; even worse is the idea that someone could get a first-hand glimpse of your code, which is not only a frustration, but a possible security issue.
Networking: Must-read coverage
- Gartner releases 4 trends that will impact cloud, data centers and infrastructure in 2023
- Support for these Microsoft enterprise products ends in 2023
- Dell Technologies World 2023: Q&A on how Dell sees security at the edge
- Best VPNs for small business in 2023
Considering this is an easy fix, there’s no reason to avoid working with PHP and Apache 2. But how do you fix it? Let me show you. Note: I demonstrate this process on Ubuntu Server 16.04, running the latest releases of Apache 2 and PHP.
Modify the .conf file
The first thing we must do is modify the main Apache 2 configuration file. To do this, open a terminal window and issue the command:
sudo nano /etc/apache2/apache2.conf
With apache2.conf open, all you have to do is add the following to the bottom of the file:
SetHandler application/x-httpd-php
â
Save and close apache2.conf.
Enable/disable modules
In order to get PHP to function properly, you have to disable the mpm_event module and enable the mpm_prefork and php7 modules. To do this, go back to your terminal window and issue the command:
sudo a2dismod mpm_event && sudo a2enmod mpm_prefork && sudo a2enmod php7.0
Restart Apache 2
You’re ready to restart Apache 2. Because we’ve disabled/enabled modules, we have to do a full restart of Apache 2 (instead of a reloading of the configuration files). To restart Apache, go back to the terminal window and issue the command:
sudo service apache2 restart
You should now be able to point a browser to a PHP file and watch it execute properly, as opposed to saving to your local drive or displaying code in your browser.
That’s it–Apache 2 should be functioning exactly as you need.
A simple fix
I warned you this would be a simple fix. Apache 2 is a very admin-friendly web server to configure and manage. Although one would think executing PHP would be an out-of-the box feature, it’s a very easy issue to resolve.
Subscribe to the TechRepublic Premium Exclusives Newsletter
Save time with the latest TechRepublic Premium downloads, including original research, customizable IT policy templates, ready-made lunch-and-learn presentations, IT hiring tools, ROI calculators, and more. Exclusively for you!
Delivered Tuesdays and Thursdays
Also See
- How to secure your Apache 2 server in four steps (TechRepublic)
- How to tune Apache in seconds with apache2buddy.pl (TechRepublic)
- How to enable server-side encryption in Nextcloud (TechRepublic)
- How to enable two-factor authentication on Nextcloud 10 (TechRepublic)
- How to install a LAMP server on openSUSE (TechRepublic)
- How to add virtual hosts to NGINX (TechRepublic)
- How to install a LAMP stack on CentOS (TechRepublic)
- When to use NGINX instead of Apache (ZDNet)
Account Information
Share with Your Friends
Jack Wallen is an award-winning writer for TechRepublic, The New Stack, and Linux New Media. He’s covered a variety of topics for over twenty years and is an avid promoter of open source. For more news about Jack Wallen, visit his website jackwallen.com.
Account Information
Contact Jack Wallen
Editor’s Picks
TechRepublic Premium Editorial Calendar: IT Policies, Checklists, Hiring Kits and Research for Download
TechRepublic Premium content helps you solve your toughest IT issues and jump-start your career or next project.
Published: July 3, 2023, 4:30 AM EDT Modified: July 3, 2023, 11:34 AM EDT Read More See more TechRepublic Premium
Microsoft’s First Generative AI Certificate Is Available for Free
Published: June 30, 2023, 5:16 PM EDT Modified: July 5, 2023, 4:00 PM EDT Read More See more Artificial Intelligence
How Generative AI is a Game Changer for Cloud Security
Generative AI will be a game changer in cloud security, especially in common pain points like preventing threats, reducing toil from repetitive tasks, and bridging the cybersecurity talent gap.
Published: June 29, 2023, 12:34 PM EDT Modified: June 30, 2023, 3:40 PM EDT Read More See more Cloud Security
The 8 Best International Payroll Services for 2023
Does your business need a payroll provider that offers international payroll services? Use our buyer’s guide to review the best solutions, from ADP to Oyster.
Published: July 10, 2023, 7:28 AM EDT Modified: July 14, 2023, 6:44 PM EDT Read More See more Payroll
ChatGPT Cheat Sheet: Complete Guide for 2023
Get up and running with ChatGPT with this comprehensive cheat sheet. Learn everything from how to sign up for free to enterprise use cases, and start using ChatGPT quickly and effectively.
Published: July 21, 2023, 11:50 AM EDT Modified: July 21, 2023, 1:41 PM EDT Read More See more Artificial Intelligence
6 Best monday.com Competitors and Alternatives for 2023
Looking for an alternative to monday.com? Our comprehensive list covers the best monday alternatives, their key features, pricing, pros, cons and more.
Published: July 6, 2023, 1:00 AM EDT Modified: July 6, 2023, 4:01 PM EDT Read More See more Project Management
Subscribe to the TechRepublic Premium Exclusives Newsletter
Save time with the latest TechRepublic Premium downloads, including original research, customizable IT policy templates, ready-made lunch-and-learn presentations, IT hiring tools, ROI calculators, and more. Exclusively for you! Delivered Tuesdays and Thursdays
TechRepublic Premium
Conflict of Interest Disclosure Policy
This Conflict of Interest Disclosure Policy from TechRepublic Premium establishes the ground rules that will allow a hired consultant to work on another project for another party. Company permission for such a situation is discretionary by the company and is dependent on meeting the requirements of this policy. From the policy: To use the Company’s . Published: July 20, 2023, 4:00 PM EDT Modified: July 21, 2023, 9:00 AM EDT Read More See more TechRepublic Premium
Intrusion Detection Policy
All modern enterprises must accept the fact that at some point their systems or networks will very likely experience an unauthorized intrusion of some kind. This is the state of the world’s current security environment and for the most part enterprises, especially well-managed ones, have come to terms with this fate while also doing their . Published: July 20, 2023, 4:00 PM EDT Modified: July 21, 2023, 9:00 AM EDT Read More See more TechRepublic Premium
Feature Comparison: CRM Software and Services
Choosing the right customer relationship management software or service for your business requires strategy, thoughtful consideration and more than a little research. These guidelines and the accompanying tool, from TechRepublic Premium, will give you a customizable framework to find the best CRM solution for your needs. From the guide: Before starting to evaluate CRM systems . Published: July 19, 2023, 4:00 PM EDT Modified: July 20, 2023, 8:00 AM EDT Read More See more TechRepublic Premium
eLearning and Continuing Education Policy
Regardless of its industry or business, an enterprise can only reach the level of success that is achievable by the people that exist within that enterprise. Strategic plans, marketing campaigns, new product designs, technological innovations, etc., are all dependent on skilled people. If your enterprise views labor as a cost to be controlled rather than . Published: July 19, 2023, 4:00 PM EDT Modified: July 20, 2023, 8:00 AM EDT Read More See more TechRepublic Premium