shell_exec(sudo service apache2 restart) only stops the server - php

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

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.

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).

XAMPP on windows. Apache Shutdown Unexpectedly. Apache not starting

This is a common issue where the port is already in use by other applications. But I have corrected the issue from skype where it was using port 80 and 443. But I am not sure what else application might be preventing apache from running.
Here is the error log
Error: Apache shutdown unexpectedly.
This may be due to a blocked port, missing dependencies,
improper privileges, a crash or a shutdown by another method.
Press the Logs button to view error logs and check.
the Windows Event Viewer for more clues.
IF you need more help,
copy and post this entire log window in the forum
I have checked the error log file. It would be nice if anyone would kindly explain me the issue. I am new in using xampp
[Mon Jan 11 15:41:31.711045 2016] [ssl:warn] [pid 6344:tid 768] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jan 11 15:41:33.542795 2016] [ssl:warn] [pid 6344:tid 768] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jan 11 15:41:37.708844 2016] [mpm_winnt:notice] [pid 6344:tid 768] AH00455: Apache/2.4.17 (Win32) OpenSSL/1.0.2d PHP/5.6.15 configured -- resuming normal operations
[Mon Jan 11 15:41:37.709343 2016] [mpm_winnt:notice] [pid 6344:tid 768] AH00456: Apache Lounge VC11 Server built: Oct 13 2015 10:54:13
[Mon Jan 11 15:41:37.709343 2016] [core:notice] [pid 6344:tid 768] AH00094: Command line: 'D:\\xampp\\apache\\bin\\httpd.exe -d D:/xampp/apache'
[Mon Jan 11 15:41:37.963876 2016] [mpm_winnt:notice] [pid 6344:tid 768] AH00418: Parent: Created child process 5008
[Mon Jan 11 15:41:44.877326 2016] [ssl:warn] [pid 5008:tid 688] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jan 11 15:41:46.246564 2016] [ssl:warn] [pid 5008:tid 688] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jan 11 15:41:46.644423 2016] [mpm_winnt:notice] [pid 5008:tid 688] AH00354: Child: Starting 150 worker threads.
Well if you read the messages from Apache it is quite obvious you have tried to activate SSL and there is a problem with what you have done.
I think this part of the error message from XAMPP is most relevant a crash or a shutdown by another method.
Assuming you did this by uncommenting the Include conf/extra/httpd-ssl.conf line in httpd.conf then just comment that line out again and then try and fix your SSL config.
As suggested by the error message, look at the Windows Event Viewer. Apache writes there as well as its log file. SOmetimes the errors shown in Event Viewer are very descriptive and will identify a line number in a config file where the error exists
RE Your comment :
I had previous installation of xamp on my system. I had deleted the source folder of xampp and reinstalled xampp
Its possible that as you did not uninstall the old version of XAMPP something from the old version is still registered with your system and that is what is causing this odd situation.
I would uninstall this XAMPP (properly) and then check if you still have an Apache and/or MYSQL service registered, look using the services snapin.
If they are still there you can remove them like this (sc delete ) :-
Start command window using "Run as Administrator"
sc delete MYSQL
sc delete Apache
Make sure you have backed up any databases, although it may already be to late for this.
Then you can re-install the version of XAMPP you want to use.

WampServer Apache not starting

I've installed WampServer so many times, and everytime i face this problem.
The wamp tray icon is orange :
and i get this errors in the Apache Error Log :
[Sun May 31 07:29:32.246382 2015] [mpm_winnt:notice] [pid 2972:tid 376] AH00455: Apache/2.4.9 (Win32) PHP/5.5.12 configured -- resuming normal operations
[Sun May 31 07:29:32.246382 2015] [mpm_winnt:notice] [pid 2972:tid 376] AH00456: Apache Lounge VC11 Server built: Mar 16 2014 12:13:13
[Sun May 31 07:29:32.246382 2015] [core:notice] [pid 2972:tid 376] AH00094: Command line: 'f:\wamp\bin\apache\apache2.4.9\bin\httpd.exe -d F:/wamp/bin/apache/apache2.4.9'
[Sun May 31 07:29:32.527182 2015] [mpm_winnt:notice] [pid 2972:tid 376] AH00418: Parent: Created child process 2700
[Sun May 31 07:29:59.421630 2015] [mpm_winnt:crit] [pid 2972:tid 376] AH00419: master_main: create child process failed. Exiting.
When i test the port 80 it says :
Checked the System Environment Variables for errors and understood nothing there :
What Causes this problem?
Please check that you have the Visual C++ Redistributable for Visual Studio 2012 Update 4 installed on this computer.
Apache 2.4.9 requires this library to be installed.
Click the download button and then select either the X86(32bit) or X64(64bit) link to match the version of WAMPServer(32 or 64) that you installed.
If you are running on a 64bit Windows, its a good idea to download and install both the 64 and 32 bit libraries, as something somewhere you use in the future will also require the library.

caught SIGTERM error PHP FAST-CGI APACHE Ubuntu14.4

I installed PHP 5.2.17 as per the following tutorial
http://zgadzaj.com/how-to-install-php-53-and-52-together-on-ubuntu-1204
apt-get installed PHP5.5 and apache 2.4.7
PHPINFO reports that the php version of the set host is still 5.5.9
when I restart apache2 service, I get the following in error.log.
[Thu Mar 19 14:18:53.648697 2015] [mpm_prefork:notice] [pid 23518] AH00169: caught SIGTERM, shutting down
[Thu Mar 19 14:18:54.741836 2015] [:notice] [pid 5543] FastCGI: process manager initialized (pid 5543)
[Thu Mar 19 14:18:54.754243 2015] [mpm_prefork:notice] [pid 5541] AH00163: Apache/2.4.7 (Ubuntu) mod_fastcgi/mod_fastcgi-SNAP-0910052141 PHP/5.5.9-1ubuntu4.6 configured -- resuming normal operations
[Thu Mar 19 14:18:54.754317 2015] [core:notice] [pid 5541] AH00094: Command line: '/usr/sbin/apache2'
Removing php5.5 solved the problem.
The problem probably was a conflict between the two PHP versions, using same fastcgi implementation.

Categories