- PHP перестал интепретироваться на Apache, что могло стать причинной?
- Не работает 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
- Feature Comparison: CRM Software and Services
- eLearning and Continuing Education Policy
- Job Description: SAP Developer
- Quick Glossary: 5G Technology
PHP перестал интепретироваться на Apache, что могло стать причинной?
Являюсь пользователем системы ubuntu 14.04, стоит apache 2.4. и php 5.5.9.1
Дело установки было еще летом. Работало все нормально. В последние два дня. Единственное что кардинально изменялось в системе, так это попытка установок Krita и Pinta, значимого ничего больше вроде как не было. Никаких настроек новых локальных серверов не выполнял.
Просто за один день вместо отработки интерпретатора при запросе на любом домене к файлу php, Chrome теперь предлагает их скачать оО.
Дело я подозреваю что скорее всего в Apache, так как при загрузке сайтов на nginx php работает вроде так как и должен.
Сам Apache запускается без ошибок. В логах при обращение к сайту записывается
[Fri Oct 23 16:49:20.046612 2015] [authz_core:debug] [pid 9386] mod_authz_core.c(802): [client 127.0.0.1:55545] AH01626: authorization result of : granted
Но это судя по файлу было всегда, и с этим уведомлением все работало всегда и все нормально было.
В var/log/apache2 пишется такое:
[Fri Oct 23 14:19:32.167175 2015] [mpm_prefork:notice] [pid 17003] AH00163: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations [Fri Oct 23 14:19:32.193444 2015] [core:notice] [pid 17003] AH00094: Command line: '/usr/sbin/apache2' [Fri Oct 23 14:49:57.661341 2015] [mpm_prefork:notice] [pid 17003] AH00169: caught SIGTERM, shutting down [Fri Oct 23 14:56:17.755882 2015] [mpm_prefork:notice] [pid 3268] AH00163: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
Но опять же подобное повторяется и в те дни когда все было ок.
Помогите, куда копать? Что смотреть? Что показывать?
Не работает 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 17, 2023, 11:00 AM EDT Modified: July 20, 2023, 4:30 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
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 . Provided By TechRepublic Premium Published: Jul 2023 Modified: Jul 2023 Read More
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 . Provided By TechRepublic Premium Published: Jul 2023 Modified: Jul 2023 Read More
Job Description: SAP Developer
SAP developers are currently in high demand. This job description from TechRepublic Premium provides an overview of SAP, and discusses the responsibilities and qualifications that the position requires. From the job description: SAP developers will create, code or maintain all programs run on SAP systems, ensuring that all new SAP programs are integrated with other . Provided By TechRepublic Premium Published: Jul 2023 Modified: Jul 2023 Read More
Quick Glossary: 5G Technology
Throughout history, each new technological advance has precipitated the next, in a continuous loop of faster, better and more powerful technology. This principle has been the cornerstone for the IT industry since its inception. For mobile telecommunications, the latest great technological advance in this cycle has been given the moniker fifth-generation wireless. Businesses that can .