Project

General

Profile

[Solved] configuration PHP on lighttpd Mac OS with homebrew

Added by shamantao 12 months ago

Hello,
I'm newby.
Mac OS Sonoma 14.4.1

installed with homebrew

lightttpd 1.4.76
php 8.3.6
fcgi 2.4.2

I added

in modules.conf

server.modules = (
"mod_fastcgi",
)

and

include conf_dir + "/conf.d/fastcgi.conf"

in php.ini

cgi.fix_pathinfo=1

I ran
brew services start lighttpd -> no error
brew services start php -> no error

Test with Chrome, Firefox, Min, Brave (all up to date)
html OK
php KO
What did I miss ? Because When I go to a simple index.html with phpinfo, nothing appeared.
Also when I request directly a index.php -> 403

Let me know if you need more info to answer.
thanks


Replies (5)

RE: configuration PHP on lighttpd Mac OS with homebrew - Added by gstrauss 12 months ago

Let me know if you need more info to answer.

How to get support - please read

include conf_dir + "/conf.d/fastcgi.conf" is not a useful piece of information because the contents are not shown.

html OK
php KO
What did I miss ? Because When I go to a simple index.html with phpinfo, nothing appeared.
Also when I request directly a index.php -> 403

Things are not working for you, yet you think clever phrasing is going to be well-understood? If HTML is working, then why is index.html not working? You haven't communicated the difference well, and it is not constructive for me to guess. Please try to be clear and more specific.

RE: configuration PHP on lighttpd Mac OS with homebrew - Added by shamantao 12 months ago

What I ment with index.html is I inserted

<?php phpinfo; ?>

in index.html but the php lines are not read. All html instructions are ok.
I just try to understand how to configure php with a simple web server on local host to test simple web site (like grav, cmssimple, etc).
The documentation did not help me, because it's too complicated for my knowledge right now.
I hope i'm clear, my english could be limited.

RE: configuration PHP on lighttpd Mac OS with homebrew - Added by shamantao 12 months ago

Ok I found that the line :

fastcgi.map-extensions = ( ".html" => ".php" )

was not present in lighttpd.conf

And "bin-path" => "/opt/homebrew/Cellar/php/8.3.6/bin/php-cgi" in fastcgi.conf section fastcgi.server led to fcgi instead of php-cgi

Now it's all ok
Thank you

RE: configuration PHP on lighttpd Mac OS with homebrew - Added by gstrauss 12 months ago

Glad it is now working for you.

The lighttpd documentation for lighttpd mod_fastcgi describes configuration options for lighttpd mod_fastcgi and provides examples further down that page.


Please note that the reasons things were not working were 100% in the information you omitted in your initial post.

Even after being pointed to How to get support - please read, you did not use lighttpd -p to print your config.

Also note that the fastcgi.conf file which you posted does not configure mod_fastcgi. Lines in the template need to be uncommented to configure mod_fastcgi, as you presumably figured out.

    (1-5/5)