httpd wont start with added lines for php - php

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

Related

Need to update Xampp php 7.3 to 7.4. Shows Apache error

I need Xampp for Windows 32 bit with a php version of at least 7.4. I can only find a php version 7.3 which is too low. So I need to upgrade it.
I downloaded vc15 x86 threadsafe/zip from, php.net. I extracted it. Renamed xampp\php to xammp\php-old. I then copied php.ini-development to php.ini and made all the changes to php.ini as per this tutorial https://www.youtube.com/watch?v=ir_ZewB_PHY
I restarted Xampp but its giving the error message: Error: Apache shut down unexpectedly. This may be due to a blocked port, missing dependencies..."
I dont have Skype/ Team Viewer or Anydesk open.
I changed the port settings of the httpd.conf File to listen to port 8080 instead of port 80. In http-ssl.conf I changed listen 443 to listen 4433.
I restarted Xampp but I'm still having errors. The Apache (error.log) reflects there errors.
[Wed Aug 24 12:39:53.747228 2022] [ssl:warn] [pid 4220:tid 460] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Wed Aug 24 12:39:53.922456 2022] [core:warn] [pid 4220:tid 460] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Wed Aug 24 12:39:53.922456 2022] [ssl:warn] [pid 4220:tid 460] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
PHP Warning: 'vcruntime140.dll' 14.0 is not compatible with this PHP build linked with 14.16 in Unknown on line 0
[Wed Aug 24 12:39:53.938089 2022] [:emerg] [pid 4220:tid 460] AH00020: Configuration Failed, exiting
I really dont know how to solve this and support will be greatly appreciated. My os is Windows 10 32 bit. I was told my laptop cant be upgraded to 64 bit.
Many thanks in advance.
Edit 24 August 2022 !7h30 Johannesburg
I checked PHP module lines in my httpd-xamp.conf is correct.
LoadFile "C:/xampp/php/php7ts.dll"
LoadFile "C:/xampp/php/libpq.dll"
`LoadModule php7_module "C:/xampp/php/php7apache2_4.dll"
I ran httpd.exe -t from the windows command prompt it it shows that the syntax is OK.
I ran httpd.exe -v and it shows Server version: Apache/2.4.38 (Win32)

unable to start service of apache2

These are the follow output streamed when I give command to restart the service of apache
apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Tue 2017-08-08 11:14:56 IST; 42s ago
Docs: man:systemd-sysv-generator(8)
Process: 3568 ExecStart=/etc/init.d/apache2 start (code=exited, status=2)
Aug 08 11:14:56 Lab2-73 systemd[1]: Starting LSB: Apache2 web server...
Aug 08 11:14:56 Lab2-73 apache2[3568]: /etc/init.d/apache2: 46: .: Can't open /e
Aug 08 11:14:56 Lab2-73 apache2[3568]: /etc/init.d/apache2: 57: .: Can't open /e
Aug 08 11:14:56 Lab2-73 apache2[3568]: ERROR: APACHE_PID_FILE needs to be define
Aug 08 11:14:56 Lab2-73 systemd[1]: apache2.service: Control process exited, cod
Aug 08 11:14:56 Lab2-73 systemd[1]: Failed to start LSB: Apache2 web server.
Aug 08 11:14:56 Lab2-73 systemd[1]: apache2.service: Unit entered failed state.
Aug 08 11:14:56 Lab2-73 systemd[1]: apache2.service: Failed with result 'exit-co
Please check your configuration under /etc/init.d/apache2/. There migth be a misconfiguration. Have a look at this little guide.
If you cant find the mistake you can also reinstall apache2 but keep in mind that you will loose your whole configuration (depending on the actual configuration)

http://localhost/ is not available

I have downloaded xampp-win32-5.6.11-0-VC11-installer
I have Windows 8.1 Single Language (Also sure to be up to date)
XAMPP is in **C:\xampp**
I run the XAMPP Control Panel as a Adminstrator
I installed Apache, MySQL, and FileZilla as a Windows Service from the XAMPP Control Panel
I pressed start for Apache and MySQL and the both are running.
The problem is: http://localhost/ is not available AND http://localhost/phpmyadmin/ is not available
Neither is 127.0.0.1
[Sat Aug 08 10:31:12.646044 2018] [ssl:warn] [pid 4780:tid 476]
Ans1909: www.example.com:443:0 server certificate does NOT include an
ID which matches the server name
This the only warning I get. The rest is just normal notifications.
[Sat Aug 08 10:31:13.646094 2018] [mpm_winnt:notice] [pid 4780:tid
476] Ans00455: Apache/2.4.12 (Winc32) OpenSSL/1.0.1m PHP/5.6.11
configured -- resuming normal operations [Sat Aug 08 10:31:13.646094
2018] [mpm_winnt:notice] [pid 4780:tid 476] Ans00456: Apache Lounge
VC11 Server built: Mar 20 2018 12:12:41 [Sat Aug 08 10:31:13.646094
2018] [core:notice] [pid 4780:tid 476] Ans00094: Command line:
'C:\xampp\apache\bin\httpd.exe -d C:/xampp/apache' [Sat Aug 08
10:31:15.083677 2018] [mpm_winnt:notice] [pid 4780:tid 476] Ans00418:
Parent: Created child process 4312
10:56:50 [main] Initializing Control Panel 10:56:50 [main] Windows
Version: Windows 8 64-bit 10:56:50 [main] XAMPP Version: 5.6.11
10:56:50 [main] Control Panel Version: 3.2.1 [ Compiled: May 7th 2018
] 10:56:50 [main] Running with Administrator rights - good! 10:56:50
[main] XAMPP Installation Directory: "c:\xampp\" 10:56:50 [main]
Checking for prerequisites 10:56:50 [main] All prerequisites found
10:56:50 [main] Initializing Modules 10:56:50 [mysql] XAMPP MySQL
Service is already running on port 3306 10:56:50 [main] Starting
Check-Timer 10:56:50 [main] Control Panel Ready 10:56:56 [Apache]
Attempting to start Apache service... 10:57:00 [Apache] Status change
detected: running 13:12:03 [main] Executing "services.msc"
Nothing else to report.
Any help is welcome. I'm a XAMPP virgin so please be gentle.
It's a strange behavior, it's seems you have any strange thing in your vhost or on you hosts file, i can't remember where is exactly the hosts file in windows i suspect it can be in system32/drivers/etc ...
Check the file and if you find a line where your host localhost is pointing to antoher place just point it to 127.0.0.1
That should work

Magento black screen locale

Something really stupid is going on here.
I have several magento projects and they were all fine until now.
I get a blank page on every Magento project;
Also if I want to create a new magento project, on the second installation step, it gives a blank page.
XAMPP is giving me several errors (error_log)
[Fri Oct 25 10:05:50 2013] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Fri Oct 25 10:05:52 2013] [notice] Digest: generating secret for digest authentication ...
[Fri Oct 25 10:05:52 2013] [notice] Digest: done
[Fri Oct 25 10:05:53 2013] [notice] Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Fri Oct 25 10:16:03 2013] [notice] child pid 3039 exit signal Bus error (10)
[Fri Oct 25 10:16:04 2013] [notice] child pid 3041 exit signal Bus error (10)
[Fri Oct 25 10:25:57 2013] [notice] child pid 2787 exit signal Bus error (10)
[Fri Oct 25 10:25:58 2013] [notice] child pid 2715 exit signal Bus error (10)
I did reinstall XAMPP, but still the same errors.
Can anybody help me?
try following :
To get rid of the SSLSessionCache message in XAMPP
1) Open file \xampp\apache\conf\httpd.conf
2) Somewhere in the LoadModule area add the following line:
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
3) Save the file
4) Now open file \xampp\apache\conf\extra\httpd-ssl.conf
5) at line 70 add the line
SSLSessionCache "shmcb:logs/ssl_scache(512000)"
6) Save the file
7) Restart Apache
Ref : XAMPP - Session Cache is not configured [hint: SSLSessionCache]
Ok i had the same problem with Magento and I found that it's since I upgraded Mac OS X to 10.9.
I was using XAMPP 1.7.3 .
To solve that, you need to upgrade XAMPP to 1.8.3.
Everything works fine for me now.

PHP's configuration setting 'error_log' is not working

What am I doing wrong here?
I have error_log set in the .ini file along with error_reporting = E_ALL | E_STRICT.
What else am I missing? This usually gave it to me. I want this set in the .ini file and not in my scripts.
Another interesting thing that is happening is that when I purposefully try and throw an error in one of my scripts, Apache restarts over and over again.
This is my event log after one error. Look at the timestamp.
Wed Nov 04 19:34:23 2009] [notice] Apache/2.2.14 (Win32) PHP/5.3.0 configured -- resuming normal operations
[Wed Nov 04 19:34:23 2009] [notice] Server built: Sep 28 2009 22:41:08
[Wed Nov 04 19:34:23 2009] [notice] Parent: Created child process 1700
[Wed Nov 04 19:34:23 2009] [notice] Child 1700: Child process is running
[Wed Nov 04 19:34:23 2009] [notice] Child 3008: Released the start mutex
[Wed Nov 04 19:34:23 2009] [notice] Child 1700: Acquired the start mutex.
[Wed Nov 04 19:34:23 2009] [notice] Child 1700: Starting 64 worker threads.
[Wed Nov 04 19:34:23 2009] [notice] Child 1700: Starting thread to listen on port 80.
[Wed Nov 04 19:34:24 2009] [notice] Child 3008: All worker threads have exited.
[Wed Nov 04 19:34:24 2009] [notice] Child 3008: Child process is exiting
[Wed Nov 04 19:34:53 2009] [notice] Parent: child process exited with status 128 -- Restarting.
[Wed Nov 04 19:34:53 2009] [notice] Apache/2.2.14 (Win32) PHP/5.3.0 configured -- resuming normal operations
[Wed Nov 04 19:34:53 2009] [notice] Server built: Sep 28 2009 22:41:08
[Wed Nov 04 19:34:53 2009] [notice] Parent: Created child process 3656
[Wed Nov 04 19:34:53 2009] [notice] Child 3656: Child process is running
[Wed Nov 04 19:34:53 2009] [notice] Child 3656: Acquired the start mutex.
[Wed Nov 04 19:34:53 2009] [notice] Child 3656: Starting 64 worker threads.
[Wed Nov 04 19:34:53 2009] [notice] Child 3656: Starting thread to listen on port 80.
[Wed Nov 04 19:34:53 2009] [notice] Parent: child process exited with status 128 -- Restarting.
[Wed Nov 04 19:34:54 2009] [notice] Apache/2.2.14 (Win32) PHP/5.3.0 configured -- resuming normal operations
[Wed Nov 04 19:34:54 2009] [notice] Server built: Sep 28 2009 22:41:08
[Wed Nov 04 19:34:54 2009] [notice] Parent: Created child process 3980
[Wed Nov 04 19:34:54 2009] [notice] Child 3980: Child process is running
[Wed Nov 04 19:34:54 2009] [notice] Child 3980: Acquired the start mutex.
[Wed Nov 04 19:34:54 2009] [notice] Child 3980: Starting 64 worker threads.
[Wed Nov 04 19:34:54 2009] [notice] Child 3980: Starting thread to listen on port 80.
[Wed Nov 04 19:34:54 2009] [notice] Parent: child process exited with status 128 -- Restarting.
[Wed Nov 04 19:34:54 2009] [notice] Apache/2.2.14 (Win32) PHP/5.3.0 configured -- resuming normal operations
[Wed Nov 04 19:34:54 2009] [notice] Server built: Sep 28 2009 22:41:08
[Wed Nov 04 19:34:54 2009] [notice] Parent: Created child process 1600
[Wed Nov 04 19:34:54 2009] [notice] Child 1600: Child process is running
[Wed Nov 04 19:34:54 2009] [notice] Child 1600: Acquired the start mutex.
[Wed Nov 04 19:34:54 2009] [notice] Child 1600: Starting 64 worker threads.
[Wed Nov 04 19:34:54 2009] [notice] Child 1600: Starting thread to listen on port 80.
[Wed Nov 04 19:34:55 2009] [notice] Parent: child process exited with status 128 -- Restarting.
[Wed Nov 04 19:34:55 2009] [notice] Apache/2.2.14 (Win32) PHP/5.3.0 configured -- resuming normal operations
[Wed Nov 04 19:34:55 2009] [notice] Server built: Sep 28 2009 22:41:08
[Wed Nov 04 19:34:55 2009] [notice] Parent: Created child process 1068
[Wed Nov 04 19:34:55 2009] [notice] Child 1068: Child process is running
[Wed Nov 04 19:34:55 2009] [notice] Child 1068: Acquired the start mutex.
[Wed Nov 04 19:34:55 2009] [notice] Child 1068: Starting 64 worker threads.
[Wed Nov 04 19:34:55 2009] [notice] Child 1068: Starting thread to listen on port 80.
[Wed Nov 04 19:34:55 2009] [notice] Parent: child process exited with status 128 -- Restarting.
[Wed Nov 04 19:34:55 2009] [notice] Apache/2.2.14 (Win32) PHP/5.3.0 configured -- resuming normal operations
[Wed Nov 04 19:34:55 2009] [notice] Server built: Sep 28 2009 22:41:08
[Wed Nov 04 19:34:55 2009] [notice] Parent: Created child process 3220
[Wed Nov 04 19:34:56 2009] [notice] Child 3220: Child process is running
[Wed Nov 04 19:34:56 2009] [notice] Child 3220: Acquired the start mutex.
[Wed Nov 04 19:34:56 2009] [notice] Child 3220: Starting 64 worker threads.
[Wed Nov 04 19:34:56 2009] [notice] Child 3220: Starting thread to listen on port 80.
This has been asked 1000 times and I have browsed through the different posts before posting this, but I have not found an answer. As long as I have been programming with PHP, this have always been a nightmare to get working.
Check PHP-FPM is not explicitly setting error_log:
Make sure the file /etc/php-fpm.d/www.conf does not contain php_admin_value settings for error_log. Search for the following and comment them out using a semi-colon:
; NOTE: If these are set, ini_set('error_log', 'path') will have no effect
; inside your php code, and this will be forced to be the value always.
; php_admin_value[error_log] = /var/log/php-fpm/www-error.log
; php_admin_flag[log_errors] = on
Then restart php-fpm:
systemctl restart php-fpm
Check Apache .htaccess files are not setting the error_log value using
php_admin_value settings in the Apache configuration files cannot be overridden, so make sure you don’t have any php_admin_value for the error_log setting in the Apache configuration files. Also check for php_value settings just in case.
PHP Website - How to change configuration settings
Flimm's Troubleshooting Guide
Here is my troubleshooting guide to error_log() calls not working.
Look at your server's configuration to find out where the default error log file is.
This depends on which server you're using. To get you started, have
a look at Apache's ErrorLog option if you're using Apache or
Nginx's error_log option if you're using Nginx. Make sure it
is set to a file. If you're using a tool like Valet, note that it's
using server software like Nginx behind the scenes.
Check the permissions of your server's error log file. On Unix-like systems, it should be writeable by the correct user and group, and the permissions of the parent directory and all its ancestors need to be correct as well. Use chmod and chown.
Check the configuration of PHP in the .ini files. Specifically, check for log_errors = On and error_reporting = E_ALL | E_STRICT and error_log = /tmp/example/php_errors.log (see docs for log_errors, error_reporting and error_log configuration settings). To find the .ini file, look at the output of phpinfo();. If error_log is not set, by default it goes to the error log for the server, mentioned in the previous steps. If error_log is set to a file, it should already exist and be writeable, just like in previous steps. Remember to restart the server after configuration changes.
Check that PHP's settings aren't being changed by server configuration. Your server's configuration (even .htaccess) can change PHP configuration settings. In Apache, this is done using php_admin_value and php_admin_flag (docs). For instance, you may find in your .htaccess file this line: php_admin_flag[log_errors] = off. Remember to restart the server after configuration changes. At this point, you should be able to create a test file test.php with the contents <?php error_log("test");, restart your server, and open the URL in your browser, and you should be able to see test in your error log (either the server's, or the one specified by error_log = ). But keep reading.
Check that PHP's settings aren't being changed at run-time. The log_errors option can be changed at runtime by running ini_set('log_errors', 1);, and so can the other configuration options error_reporting and error_log. Also note there is a special error_reporting() PHP function which changes the configuration at run-time. Search your code-base for any invocations of ini_set or error_reporting. WordPress for example does run these depending on the value of WP_DEBUG.
Other things to look at: You may be having permission issues in SELinux (see this answer).
You also need to set log_errors = On in file php.ini.
In case anyone else is having trouble getting their local development environment to log errors, here's what fixed it for me:
On Windows, error_log must be set to the complete path to the log for error_log() to work (error_log = c:\apache\php_errors.log). However, if error_log = php_errors.log with no path, php will still be able to log startup errors such as
PHP Startup: Unable to load dynamic library 'ext\php_mysqli.dll' - The specified module could not be found
The problem I ran into was that the error log I had designated was write-protected. All my .htaccess settings were correct, but PHP just couldn't write to the error log, because it didn't have any permissions. This fixed it right up for me:
chmod 777 watermellon-app-errors.log
Obviously, you're going to want to change the .log part to whatever file you're using for a log.
If the error_log directive is set, the file will be used for recording PHP errors. When it is not set, errors will be logged to the Apache log. Take a look at error_log.
The error_log file and the directory it's in must be writable by the user that Apache is running under. If the file isn't being created, it's probably due to a permissions issue.
I don't know for sure why Apache would be crashing on you, but I'm guessing it's a permissions issue of some sort.
I don't understand why, but the error log is now working. Here is what I did.
I gave up and commented back out the error_log directive and closed the ini file. I ran the script with the parse error to see if Apache would still crash and I got the PHP error in the log file. This is freaky, because the ini file no longer has error_log enabled and my script is not using ini_set().
In my case, on a CentOS development server, after a full yum update, the permission on /var/log/http was changed to 700 and the user to 'root', so the user 'apache' wasn't able to enter or write into it.
It was still able to write into the existing file /var/log/httpd/error.log, but it wasn't able to create a new file, as I use date-suffixed log files.
Issuing the command
chown apache /var/log/httpd
solved the problem.
If you are using Fedora, SELinux (enabled by default) will prevent Apache / httpd from appending errors to your log file even when your file is specified in file php.ini and its containing directory has all permissions allowed.
You can see if this is happening by looking at your system log file in /var/log/messages
The ideal solution is to configure SELinux to allow access to the log file.
The quicker solution is to disable SELinux in /etc/selinux/config by setting SELINUX to disabled.
You'll need to reboot your system after doing this for the change to take effect.
For me, manually creating the file, /var/log/php_error.log, solved the issue:
In file php.ini, configure log to file
log_errors = On
error_log = /var/log/php_error.log
Restart Apache
sudo systemctl restart apache2
Create the log file, for example:
sudo touch /var/log/php_error.log
Give the correct rights (owner must be Apache)
sudo chown www-data:root /var/log/php_error.log
(And if not already set)
sudo chmod 0644 /var/log/php_error.log
Test this way, for example:
sudo vim /var/www/.../index.php
<html>
<body>
PHP file:
<?php
echo "Hello, World!";
trigger_error("User error in PHP", E_USER_ERROR);
?>
</body>
</html>
Check the error is written
sudo less /var/log/php_error.log
For further debugging:
phpinfo();
It shows the current error_log setting, next to the error_log value in phpinfo() and can be useful when a vhost isn't logging.
I ended up here after that setting got overridden from file php.ini and the vhost. I ended up logging to syslog.
As bradym said, check whether you have write permissions to the directory where you PHP error log is located for the Apache user. If you created a log file with written permissions it's not enough; the directory should have them too.
I had the same issue and fixed it by doing this:
chmod 0777 -R /var/log/apache2
apachectl restart
I think PHP runs as user www-data while access to /var/log/apache2 is limited to root. So, this fixes it.
The error_log = "C:\php\Log\error.log" line was not working for me either. The solution for me was that you shouldn't create the error.log yourself, because PHP will do it for you. See the PHP message board. I'm using PHP 5.2 on a Windows Server 2008 server.
This did the trick for me.
setsebool -P httpd_unified 1
Please note, this would be the preferred method below to try first:
semanage fcontext -a -t httpd_sys_rw_content_t 'errorLogNameHere.error.log
restorecon -v 'errorLogNameHere.error.log'
This answer was derived from the logs from executing this command line:
journalctl -xe
Further information on the system I was running on:
PHP 7.0 and CentOS 7
I am not sure if it's not obvious, but the issue was Apache's configuration to writing files. I did try chmod 777, chmod a+w on the logging directory, but this didn't work for me.

Categories