I have multiple php versions installed on my Ubuntu 18.04 - php7.1 php5.6
When I'm using php7.1 apache restarts successfully.
But when I switch to php5.6 using this command:
sudo a2dismod php7.1 ; sudo a2enmod php5.6 ; sudo service apache2 restart
Apache gives me this error:
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
systemctl status apache2.service result:
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Sat 2018-10-27 13:19:32 +06; 7s ago
Process: 6458 ExecStart=/usr/sbin/apachectl start (code=exited, status=139)
Oct 27 13:19:32 protectedfor apachectl[6458]: AH00112: Warning:
DocumentRoot [/home/protectedfor/scj] does not exist
Oct 27 13:19:32 protectedfor apachectl[6458]: AH00112: Warning:
DocumentRoot [/var/www/worldclass/worldclass.kg] does not exist
Oct 27 13:19:32 protectedfor apachectl[6458]: [Sat Oct 27 13:19:32.683512 2018] [alias:warn] [pid 6469] AH00671: The Alias directive in /etc/apache2/apache2.conf at line
Oct 27 13:19:32 protectedfor apachectl[6458]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerNa
Oct 27 13:19:32 protectedfor apachectl[6458]: Segmentation fault (core dumped)
Oct 27 13:19:32 protectedfor apachectl[6458]: Action 'start' failed.
Oct 27 13:19:32 protectedfor apachectl[6458]: The Apache error log may have more information.
Oct 27 13:19:32 protectedfor systemd[1]: apache2.service: Control process exited, code=exited status=139
Oct 27 13:19:32 protectedfor systemd[1]: apache2.service: Failed with result 'exit-code'.
Oct 27 13:19:32 protectedfor systemd[1]: Failed to start The Apache HTTP Server.
Apache log:
[Sat Oct 27 12:43:02.172511 2018] [mpm_prefork:notice] [pid 6518] AH00169: caught SIGTERM, shutting down
[Sat Oct 27 12:43:10.498278 2018] [so:warn] [pid 5126] AH01574: module php7_module is already loaded, skipping
[Sat Oct 27 12:43:10.544626 2018] [mpm_prefork:notice] [pid 5137] AH00163: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations
[Sat Oct 27 12:43:10.544656 2018] [core:notice] [pid 5137] AH00094: Command line: '/usr/sbin/apache2'
[Sat Oct 27 12:43:28.243406 2018] [mpm_prefork:notice] [pid 5137] AH00169: caught SIGTERM, shutting down
Any advices really appreciated. Thanks!
Its not just disable the module. You have to set some defaults in order to make that work
Please try this
set from 7.x to 5.x
sudo a2dismod php7.1
sudo a2enmod php5.6
sudo update-alternatives --set php /usr/bin/php5.6
sudo update-alternatives --config php
sudo update-alternatives --set phar /usr/bin/phar5.6
sudo systemctl restart apache2
set from 5.x to 7.x
sudo a2enmod php7.1
sudo a2dismod php5.6
sudo update-alternatives --set php /usr/bin/php7.1
sudo systemctl restart apache2
Related
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.
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
I tried to restart my Apache2 Server with PHP with this command:
shell_exec("sudo service apache2 restart");
Apache stops but don't start...
Btw:
shell_exec("sudo service apache2 reload");
works for me... I use Debian on my Server
Apache2 Error Log:
[Sun May 17 19:55:18 2015] [notice] Graceful restart requested, doing restart
[Sun May 17 19:55:18 2015] [error] (9)Bad file descriptor: apr_socket_accept: (client socket)
[Sun May 17 19:55:18 2015] [notice] Apache/2.2.22 (Debian) PHP/5.4.39-0+deb7u2 mod_ssl/2.2.22 OpenSSL/1.0.1e configured -- resuming normal operations
[Sun May 17 20:03:46 2015] [notice] caught SIGTERM, shutting down
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.
I updated today my httpd and php version on Arch for ARM.
The current version is now:
apachectl -V
Server version: Apache/2.4.7 (Unix)
Server built: Mar 6 2014 17:04:51
Server's Module Magic Number: 20120211:27
Server loaded: APR 1.5.0, APR-UTIL 1.5.3
Compiled using: APR 1.5.0, APR-UTIL 1.5.3
Architecture: 32-bit
Server MPM: event
threaded: yes (fixed thread count)
forked: yes (variable process count)
I need also php for owncloud and other php project, because of that I added the lines:
LoadModule php5_module modules/libphp5.so
AddHandler php5-script php
Include conf/extra/php5_module.conf
to the file /etc/httpd/conf/httpd.conf.
Before the update this config works fine, after the update apache will not start anymore and it shows always the error:
Mar 07 03:43:59 alarm apachectl[1006]: [Fri Mar 07 03:43:59.408232 2014] [:crit] [pid 1008:tid 3070083072] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.
Mar 07 03:43:59 alarm apachectl[1006]: AH00013: Pre-configuration failed
Mar 07 03:43:59 alarm systemd[1]: httpd.service: control process exited, code=exited status=1
Mar 07 03:43:59 alarm systemd[1]: Failed to start Apache Web Server.
Mar 07 03:43:59 alarm systemd[1]: Unit httpd.service entered failed state.
Removing and reinstalling php does not help. How can I fix this problem?
To switch to prefork MPM on Apache/2.4.7 (like the previous version of Apache), do this in /etc/httpd/conf/httpd.conf:
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
#LoadModule mpm_event_module modules/mod_mpm_event.so
and after httpd restart, on my raspberry pi.
apache upgrade in 2.4.7 :
Mar 07 19:33:56 rasperus systemd[1]: Starting Apache Web Server...
Mar 07 19:33:56 rasperus apachectl[23469]: [Fri Mar 07 19:33:56.909344 2014] [:crit] [pid 23471:tid 3069247488] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.
Mar 07 19:33:56 rasperus apachectl[23469]: AH00013: Pre-configuration failed
Mar 07 19:33:56 rasperus systemd[1]: httpd.service: control process exited, code=exited status=1
Mar 07 19:33:56 rasperus systemd[1]: Failed to start Apache Web Server.
Mar 07 19:33:56 rasperus systemd[1]: Unit httpd.service entered failed state.
and after modification in httpd.conf :
Mar 07 19:45:11 rasperus systemd[1]: Starting Apache Web Server...
Mar 07 19:45:12 rasperus systemd[1]: PID file /run/httpd/httpd.pid not readable (yet?) after start.
Mar 07 19:45:12 rasperus systemd[1]: Started Apache Web Server.
Switch to the prefork MPM (in 2.4, you can change with just LoadModule) or switch your mod_php out to using one of the many fastcgi based options (php-fpm + mod_proxy_fcgi is a popular one).