Comments (25)
Unlike other popular web servers, Merecat does not allow serving content outside its server directory. It's a security thing.
So the data-directory
setting in your config must be a sub-directory to /var/www
. One way around this is to use bind mounts on Linux, i.e., bind mount /htdocs/php_test
to /var/www/php_test
Also, for this to work you need to run the still unreleased (unstable) master branch. It's a work in progress, sorry.
from merecat.
yes, my proyect or test proyect it's a subdirectory, /var/www/htdocs/php_test
, the script phpinfo.php
or /var/www/htdocs/php_test/phpinfo.php
it's open, but Merecat with php-cgi do not execute the script, just show source code of script, sorry 😔, my english it's bad
from merecat.
Aha, OK I'll look into it. See if I can find some time later today, otherwise it'll be tomorrow. Don't worry about your English, we'll manage :)
In the meantime, have you seen my write-up of how to use regular CGIs? 👉 https://troglobit.com/2019/08/Basic-CGI-in-C-with-Merecat-httpd/
from merecat.
OK, I've reproduced your problem. Looking into it
from merecat.
Found it! :-)
Turned out to be a regression introduced fairly recently. Sorry about the problems it caused you! :-(
from merecat.
yes php now works but only if merecat is executed in the current directory, if the "directory" variable is configured, php stops working, if it is not configured php works again
from merecat.
Sorry about that. The data-directory
directive isn't really supposed to be used when you're not also chrooting. I've just pushed another patch for this to master, making sure to compose the resulting path to the server root even when not chrooting.
from merecat.
@RicardoG08 Does everything work now, or do you have any lingering problems and want me to reopen this issue?
from merecat.
php works fine if chroot = false
, I thought this variable should be true
if directory
is proposed
from merecat.
Nope, chroot is an actual dedicated confined area, like the man page chroot(1) says. In a chroot you cannot access anything outside of it, like /usr/bin/php-cgi or even the C library in /usr/lib. Thank you for responding, I'll make sure to clarify these things in the documentation!
from merecat.
very well, I really like Merecat, I am using it for my PHP practices, it is easy to configure compared to other http / https web servers, I will keep testing the software, and I will report bugs or any problems I find, it is the only way I can help the project
from merecat.
Thank you so much! All contributions are welcome :-)
I want to add more simple (!) unit tests. Those are just scripts that usually employ curl. Take a look at how I added a basic CGI test here -> 6a0735f. Wanted to add a php test as well, but I'm not that well versed in php, and I don't have any example PHP CGI in the repo. But I guess a simple phpinfo test would be really useful.
from merecat.
hello again, how long has it been ..., i have continued testing merecat since then, haven't you considered adding support for different extensions for indexes? for example index.php natively?
from merecat.
Great to hear back from you!
Did you mean like this, which is already in merecat.h
?
/* CONFIGURE: A list of index filenames to check. The files are searched
** for in this order.
*/
#define INDEX_NAMES "index.shtml", "index.shtm", "index.stm", \
"index.cgi", "index.php", \
"index.html", "index.htm", \
"index.xhtml", "index.xht", \
"Default.htm"
from merecat.
yes, I have it exactly the same, but it does not detect the index.php unless I tell it explicitly from the browser url
from merecat.
Well that's a bug (separate from this one, so we should open a new one), unless you have one of the other ones also in the root directory?
from merecat.
my root directory is "/ var / www" with a "data-directory = / htdocs", which contains the folders "/ a", "/ b" and "/ c", the folders "a" and "b" they contain an index.html and it works fine, but folder "c" has an index.php, it doesn't run automatically unless I specify it in the browser url
from merecat.
OK, that's certainly not how it's supposed to work. It should check for all the INDEX_NAMES
in a directory. Could you please open a separate bug report for this?
from merecat.
Thank you <3
from merecat.
Merecat not support Query strings in PHP??
from merecat.
I don't even know what that is, but the full environment and arguments to the CGI should be passed to php, if that's what you mean?
from merecat.
yes, exactly, but for example, Mercat returns error 403 for a valid url like the following:
http://192.168.1.1/htdocs/foro/fudforum/install.php?1463445063
from merecat.
Aha, well that's yet another bug (and more for me to do, unless someone pitches in). Please report a separate issue.
from merecat.
sorry if I'm not helpful in terms of programming
:'c, when I discovered Merecat I really liked the ease of having http / https server ready to use, I am a student and I am focusing or specializing in the administration of GNU / Linux servers and backend programming.
from merecat.
I understand, that's OK. Free/Open Source Software needs all sorts of talent to help out :)
from merecat.
Related Issues (20)
- Setting environment variable for CGI HOT 3
- phpmyadmin in merecat? HOT 4
- Support for proxy-pass
- index.php does not run in subfolders HOT 2
- PHP with method GET does not work HOT 2
- http logging doesn't seem complete, even w/ -l debug HOT 3
- HTTP header line endings HOT 2
- Condition check resulted in Merecat web server being skipped
- build time issues with php support HOT 1
- Re-add thttpd-style logging? HOT 1
- make dist; make check fails: fatal: making test-suite.log: failed to create php.trs HOT 4
- Skip doc installation HOT 3
- mbedtls support? HOT 1
- 2 processes start? HOT 1
- Allow cross origin header HOT 4
- Could not run CGI via merecat.conf HOT 1
- Bug in background HOT 1
- access.log HOT 3
- Performance issues ? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from merecat.