Error after Install mod_headers and restart apache - php

sudo a2enmod headers
Enabling module headers.
To activate the new configuration, you need to run:
service apache2 restart
root#example:~# service apache2 restart
* Restarting web server apache2 [fail]
* The apache2 configtest failed.
Output of config test was:
AH00526: Syntax error on line 38 of /etc/apache2/apache2.conf:
Argument for 'Require all' must be 'granted' or 'denied'
Action 'configtest' failed.
The Apache error log may have more information.
Error Log
01:30:26.678410 2014] [core:alert] [pid 5711] [client myid:15424] /var/www/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration
[Tue Jul 08 01:30:39.256270 2014] [core:alert] [pid 5722] [client myid:31850] /var/www/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration
[Tue Jul 08 01:36:12.821198 2014] [core:alert] [pid 5710] [client myid:21182] /var/www/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration
[Tue Jul 08 01:48:08.278465 2014] [mpm_prefork:notice] [pid 5705] AH00169: caught SIGTERM, shutting down

If your apache configuration has below line
Require all granted # new config style (replaces both rules above)
change it to
Require all granted
and restart apache.

Related

PHPMyAdmin 500 Internal Server Error in Apache due to PHP Version || New Problem

Version:
OS lsb_release -a : Ubuntu 18.04.5 LTS
PHP php -v : 8.0.5 Apache
pache2 -v : 2.4.29 (Ubuntu)
mysql --version : mysql Ver 14.14
Distrib 5.7.32
Problem:
I'm trying to install LAMP Stack using following article. However, I was getting HTTP 500 Error while accessing phpmyadmin from browser.
And installed phpmyadmin using below command.
sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl
Tried:
So, I checked with Error Log tail -f /var/log/apache2/error.log and found that Phpmyadmin was running on depreciated version of PHP.
[Sun May 16 21:11:57.057418 2021] [core:notice] [pid 2711] AH00094: Command line: '/usr/sbin/apache2'
[Sun May 16 21:12:49.262658 2021] [mpm_prefork:notice] [pid 2711] AH00171: Graceful restart requested, doing restart
[Sun May 16 21:12:49.280421 2021] [alias:warn] [pid 2711] AH00671: The Alias directive in /etc/phpmyadmin/apache.conf at line 3 will probably never match because it overlaps an earlier Alias.
[Sun May 16 21:12:49.307986 2021] [mpm_prefork:notice] [pid 2711] AH00163: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations
[Sun May 16 21:12:49.308000 2021] [core:notice] [pid 2711] AH00094: Command line: '/usr/sbin/apache2'
[Sun May 16 21:24:43.439480 2021] [mpm_prefork:notice] [pid 2711] AH00169: caught SIGTERM, shutting down
PHP Warning: PHP Startup: Unable to load dynamic library 'json.so' (tried: /usr/lib/php/20200930/json.so (/usr/lib/php/20200930/json.so: cannot open shared object file: No such file or directory), /usr/lib/php/20200930/json.so.so (/usr/lib/php/20200930/json.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[Sun May 16 21:24:43.547262 2021] [mpm_prefork:notice] [pid 2888] AH00163: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations
[Sun May 16 21:24:43.547290 2021] [core:notice] [pid 2888] AH00094: Command line: '/usr/sbin/apache2'
[Sun May 16 21:24:47.635162 2021] [php:error] [pid 2895] [client 84.251.85.6:56332] PHP Fatal error: Array and string offset access syntax with curly braces is no longer supported in /usr/share/phpmyadmin/libraries/url_generating.lib.php on line 231
If you have installed php mysql and apache directly on your system. Uninstall them and install only lamp. By so doing there will be no conflict and you stop having internal server error due too deprecated php version.

500 errors do not appear in the apache2 error.log on Debian9

I am having trouble with apache2 error.log. The 500 errors are not appearing there (/var/log/apache2/error.log), I am just getting these lines every time I restart the apache2 service :
[Tue May 26 10:19:33.931998 2020] [mpm_prefork:notice] [pid 30119] AH00171: Graceful restart requested, doing restart
[Tue May 26 10:19:33.947081 2020] [so:warn] [pid 30119] AH01574: module ssl_module is already loaded, skipping
[Tue May 26 10:19:33.968226 2020] [mpm_prefork:notice] [pid 30119] AH00163: Apache/2.4.25 (Debian) OpenSSL/1.0.2u configured -- resuming normal operations
[Tue May 26 10:19:33.968246 2020] [core:notice] [pid 30119] AH00094: Command line: '/usr/sbin/apache2'
I put error_reporting = E_ALL, display_errors = On, display_startup_errors = On, log_errors = On in the /etc/php/7.4/apache2/php.ini AND /etc/php/7.4/cli/php.ini.
I don't even get the errors on the browser, I am just receiving a message in the inspector "500 Internal Servor Error".
What else should I configure to make them appear in the error.log?
Ok, I missed one thing, such the biggest thing.
I had to change the LogLevel from warn to debug in apache2.conf file (/etc/apache2/apache2.conf) and now it works !

PHP - Unable to load dynamic library '/usr/lib/php/20151012/php_curl.dll' - /usr/lib/php/20151012/php_curl.dll

I am having a strange error (system is Ubuntu 16.04):
[Mon Sep 04 13:07:17.219992 2017] [mpm_prefork:notice] [pid 27798] AH00169: caught SIGTERM, shutting down
[Mon Sep 04 13:07:17.302181 2017] [so:warn] [pid 27874] AH01574: module php7_module is already loaded, skipping
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_curl.dll' - /usr/lib/php/20151012/php_curl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[Mon Sep 04 13:07:17.322006 2017] [mpm_prefork:notice] [pid 27875] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Mon Sep 04 13:07:17.322026 2017] [core:notice] [pid 27875] AH00094: Command line: '/usr/sbin/apache2'
PHP version is 7.1.19. I installed curl (apt-get install php7.1-curl), in the php.ini I added extension=curl.co (and commented out extension=php_curl.dll), restarted the apache service, and the error is still there (I tried commenting out extension=curl.co but the error is still there).
This is an error I am getting on the page (Laravel setup):
Call to undefined function App\curl_init()
Everything is installed and config files are as required and I don't know what could be wrong here.
The /etc/php/7.1/mods-available/curl.ini file content should be:
extension=curl.so
Please notice the extension is .so, and not .co.
Then you can enable the module in your PHP by running:
$ sudo phpenmod curl
Finally, you may need to restart your Apache:
$ sudo systemctl restart apache2

Can't access php-fpm container from apache

I have installed the latest Nextcloud container on my Ubuntu machine.
It started successfully with the following command:
sudo docker run --name nextcloud --link mysql:mysql -p 9000:9000 -v /data/nextcloud:/var/www/html -d nextcloud:latest
The comand sudo docker logs nextcloud shows:
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Mon Mar 13 09:41:24.786941 2017] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.10 (Debian) PHP/5.6.30 configured -- resuming normal operations
[Mon Mar 13 09:41:24.787013 2017] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
I enabled mod_proxy and mod_proxy_fcgi on the Apache configuration of the host machine, so this is not running inside another docker container.
ProxyPreserveHost On
ProxyPass "/cld" "fcgi://127.0.0.1:9000"
ProxyPassReverse "/cld" "fcgi://127.0.0.1:9000"
When opening the URL I get en error 503 Service Unavailable.
The Apache error log is showing:
[Mon Mar 13 11:08:35.102072 2017] [proxy_fcgi:error] [pid 11783:tid 140492205455104] [client 2001:a61:186:d601:f898:e50c:c181:db75:52659] AH01067: Failed to read FastCGI header
[Mon Mar 13 11:08:35.102119 2017] [proxy_fcgi:error] [pid 11783:tid 140492205455104] (104)Connection reset by peer: [client 2001:a61:186:d601:f898:e50c:c181:db75:52659] AH01075: Error dispatching request to :
[Mon Mar 13 11:08:36.866618 2017] [proxy_fcgi:error] [pid 11783:tid 140492197062400] (104)Connection reset by peer: [client 2001:a61:186:d601:f898:e50c:c181:db75:52660] AH01075: Error dispatching request to : (sending empty stdin)
[Mon Mar 13 11:08:38.263875 2017] [proxy_fcgi:error] [pid 11783:tid 140492180276992] [client 2001:a61:186:d601:f898:e50c:c181:db75:52664] AH01067: Failed to read FastCGI header
[Mon Mar 13 11:08:38.263914 2017] [proxy_fcgi:error] [pid 11783:tid 140492180276992] (104)Connection reset by peer: [client 2001:a61:186:d601:f898:e50c:c181:db75:52664] AH01075: Error dispatching request to :
What have I missed?
I think that using nextcloud:latest, you are getting the image using Apache, not the one using fpm.
Try to use nextcloud:fpm with your proxy setup, or using the default image without proxy (ie accessing it directly).

Apache 2.2.14 + php_apc.dll crash

I can't get APC to work on Windows because Apache keeps crashing as soon as I run a php file. Is this issue know and is there a workaround?
Versions:
Apache 2.2.14
PHP 3.1
APC 3.1.3
The best route to solve this type of problem is to check your Apache log files and see what issues were raised. An example of these logs follows:
[Wed Jun 03 06:07:47 2009] [alert] [client 127.0.0.1] C:/wamp/www/WebsiteA/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
[Wed Jun 03 06:08:16 2009] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/kohana, referer: http://localhost/WebsiteB/website/

Categories