I have the following line uncommented in httpd.conf:
LoadModule php5_module libexec/apache2/libphp5.so
When I go to any php page, the file downloads instead of displaying in the browser. I verified that if I go to a html page, the page displays correctly so it for sure has to do with PHP.
Weird thing is that this was working fine ever since I started using this Mac computer but all of a sudden stopped working. The only thing that I can think of that I did is update Slack but that doesn't seem like it would have anything to do with this.
Also another weird thing is that my command line tool (drush) which uses the same php does work.
I can't think of what it can be.
I tried to use Homebrew to install another version of php but the problem remains.
This is in the apache error log when I run the apachectl restart command:
[Tue Jan 19 16:56:12.370590 2016] [mpm_prefork:notice] [pid 994] AH00169: caught SIGTERM, shutting down
[Tue Jan 19 16:56:12.600054 2016] [mpm_prefork:notice] [pid 1005] AH00163: Apache/2.4.16 (Unix) PHP/5.5.30 configured -- resuming normal operations
[Tue Jan 19 16:56:12.600123 2016] [core:notice] [pid 1005] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
I am not seeing any errors in my php error log or anything in the apache error log (otherwise what I specified above after running the command).
Please make sure that correct AddType for php is application/x-httpd-php
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Also make sure your php module is loaded
LoadModule php5_module modules/mod_php55.so
Related
I have a problem with a Laravel application. When serving the app, does not matter if its with >>php artisan serve<< or Apache, the application works at first, but then breaks with "The connection was reset". I looked at the apache logs, path is /var/log/apache2/error.log, there i see:
AH00169: caught SIGTERM, shutting down
AH00163: Apache/2.4.41 (Ubuntu) configured -- resuming normal operations
AH00094: Command line: '/usr/sbin/apache2'
AH00171: Graceful restart requested, doing restart
php artisan serve log.:
[Fri Jun 11 00:34:36 2021] 127.0.0.1:38974 Accepted
[Fri Jun 11 00:34:36 2021] 127.0.0.1:38974 Closing
Environment modified. Restarting server...
[Fri Jun 11 00:34:36 2021] PHP 7.4.3 Development Server (http://127.0.0.1:8000) started
I did edit php.ini, disabled opcache as so opcache.enable=0.
Also added below code at the start of .htaccess
php_flag xcache.cacher Off
php_flag xcache.size 0
php_flag xcache.stat Off
Any advice on where to get additional logs or what are possible causes. Thanks
i had the same problem.
try adding php_flag opcache.enable Off in your .htaccess in the public directory (like Alberto said in the comments)
Ok, after update macOS from High Sierra to Mojave, Apache with PHP stop working properly, so I did everything as is said in this guide - https://getgrav.org/blog/macos-mojave-apache-multiple-php-versions
but after that, still apache not working properly, sometimes working, sometimes not, and its says in browsers ERR_CONNECTION_REFUSED or other errors like 404 or 500.
In apache log is:
[Tue Oct 02 15:02:23.209423 2018] [mpm_prefork:notice] [pid 14579] AH00173: SIGHUP received. Attempting to restart
[Tue Oct 02 15:02:23.255957 2018] [mpm_prefork:notice] [pid 14579] AH00163: Apache/2.4.35 (Unix) PHP/7.2.10 configured -- resuming normal operations
[Tue Oct 02 15:02:23.256008 2018] [core:notice] [pid 14579] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd'
[Tue Oct 02 15:14:37.626645 2018] [mpm_prefork:notice] [pid 14579] AH00173: SIGHUP received. Attempting to restart
[Tue Oct 02 15:14:37.674603 2018] [mpm_prefork:notice] [pid 14579] AH00163: Apache/2.4.35 (Unix) PHP/7.2.10 configured -- resuming normal operations
[Tue Oct 02 15:14:37.674672 2018] [core:notice] [pid 14579] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd'
[Tue Oct 02 15:28:40.715060 2018] [mpm_prefork:notice] [pid 14579] AH00173: SIGHUP received. Attempting to restart
[Tue Oct 02 15:28:40.752117 2018] [ssl:warn] [pid 14579] AH01909: www.example.com:8443:0 server certificate does NOT include an ID which matches the server name
[Tue Oct 02 15:28:40.766009 2018] [mpm_prefork:notice] [pid 14579] AH00163: Apache/2.4.35 (Unix) OpenSSL/1.0.2p PHP/7.2.10 configured -- resuming normal operations
[Tue Oct 02 15:28:40.766052 2018] [core:notice] [pid 14579] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd'
I have faced similar issue with PHP 5.6 as it was running fine before Mojave upgrade. I did the following to resolve the issue successfully:
Run the command below
sudo nano /etc/apache2/httpd.conf
make sure the below modules are uncommented:
LoadModule authz_core_module libexec/apache2/mod_authz_core.so
LoadModule authz_host_module libexec/apache2/mod_authz_host.so
LoadModule userdir_module libexec/apache2/mod_userdir.so
LoadModule include_module libexec/apache2/mod_include.so
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
I have added the missing one in httpd.conf
Check the right php module for you (PHP 5.6 ot 7.x) and load the required module too by adding the line or commenting/uncommenting the lines
LoadModule php5_module libexec/apache2/libphp5.so
OR
LoadModule php7_module libexec/apache2/libphp7.so
Comment the one not needed by adding "#" to start of line
Run below commands for apapche restart and test
a. sudo apachectl restart
b. apachectl configtest
Check for any errors there
For PHP 5.6:
In case you were having the php 5 with brew already in system before upgarde and the above changes gives error as below
"httpd: Syntax error on line 180 of /private/etc/apache2/httpd.conf: Cannot load libexec/apache2/libphp5.so into server: dlopen(/usr/libexec/apache2/libphp5.so, 10): image not found"
Then search for libphp5.so in the system and if found copy it to "/usr/libexec/apache2/"
In my case command was
sudo cp ./local/Cellar/php#5.6/5.6.25_1/libexec/apache2/libphp5.so /usr/libexec/apache2/
This all made things working in my system
Further to adang's reply i also had to uncomment this line:
Include /private/etc/apache2/extra/httpd-userdir.conf
in order for it to know what user directories were available.
Within /private/etc/apache2/extra/httpd-userdir.conf
I had to uncomment this line:
Include /private/etc/apache2/users/*.conf
then:
sudo apachectl restart
I had the same issue after installing the Mac OS Mojave.
I have done the following steps and it worked with me:
brew update
then:
brew upgrade
I have edited /etc/apache2/httpd.conf by uncommenting the following line:
LoadModule php7_module libexec/apache2/libphp7.so
Open the terminal and restart the apache server:
sudo apachectl restart
you might find the post on this link helpful
I followed the instructions in the above answers and still got a 403 Forbidden when trying to access my /Users/myuser/Sites/ folder. To fix this I had to change the user in /etc/apache2/httpd.conf from _www to my own user.
To do this edit your httpd.conf file using your favorite editor /etc/apache2/httpd.conf. Look for:
User _www
replace with your user:
User myuser
then restart apache:
sudo apachectl restart
because the topic is the httpd.conf messed up after Mojave upgrade I got also this error during sudo apachectl configtest
Could not reliably determine the server's fully qualified domain name, using XXX. Set the 'ServerName' directive globally to suppress this message
I found out the #ServerName localhost:80 in the httpd.conf was comented out, uncommenting resolved my issue.
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
So I'm trying to get my LAMP stack to work in my Macbook. I've apache setup but PHP is not working. I've installed php55 with Brew and loaded the module in my httpd.conf file like this:
LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so
I've checked if the libphp5.so was at the location the module is pointing and it was there.
If I check my apache error.log I get the following message:
[Sat Apr 23 21:36:59.307093 2016] [ssl:warn] [pid 7231] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Sat Apr 23 21:36:59.358254 2016] [auth_digest:notice] [pid 7231] AH01757: generating secret for digest authentication ...
[Sat Apr 23 21:36:59.360623 2016] [mpm_prefork:notice] [pid 7231] AH00163: Apache/2.4.18 (Unix) LibreSSL/2.2.6 PHP/5.5.34 configured -- resuming normal operations
[Sat Apr 23 21:36:59.360661 2016] [core:notice] [pid 7231] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
I'm missing something but I'm not quite sure what at this point.
Did you also update your Apache config to recognize .php extensions?
AddType application/x-httpd-php .php
or
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
add the following line to your httpd.conf:
AddHandler application/x-httpd-php .php
after apache restart everything should work
I'm setting up an development environment on a Windows 8.1 machine.
I successfully installed Apache 2.2, and downloaded php-5.6.3-Win32-VC11-x86.
I added the following lines at the end of httpd.conf
PHPIniDir "C:/PHP5"
LoadModule php5_module "C:/PHP5/php5apache2_4.dll"
AddType application/x-httpd-php .php
AddHandler application/x-httpd-php .php
I also added
application/x-httpd-php .php
to the myme.types file
If I comment out PHPIniDir or LoadModule apache will start normally.
Also, all extensions are commented out on the PHP.ini file, and the extension directory is set as
extension_dir = "ext"
Any help will be hugely appreciated.
EDIT 1:
The only thing in error log is about server shutdow
[Sun Nov 23 14:56:07 2014] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Sun Nov 23 14:56:07 2014] [notice] Child 6192: Exit event signaled. Child process is ending.
[Sun Nov 23 14:56:08 2014] [notice] Child 6192: Released the start mutex
[Sun Nov 23 14:56:09 2014] [notice] Child 6192: All worker threads have exited.
[Sun Nov 23 14:56:09 2014] [notice] Child 6192: Child process is exiting
[Sun Nov 23 14:56:09 2014] [notice] Parent: Child process exited successfully.
Check your apache log file for errors! see what the
You mention apache 2.2, yet you are using a dll called php5apache2_4.dll.
This dll is according to the name specifically build for apache 2.4. This is likely to cause issues, the last php version which has a dll for apache 2.2 for windows on the php website is php 5.4.35.