I've been agonizing over this issue for the past day now. I've setup lighty on my server and it serves static files fine but keeps giving me 403 on php files.
I've gone through every tutorial, wiki and forum that I can find on the subject and nothing helped.
I've chown lighttpd:lighttpd the php files and chmod to 644 and 755. I really need some help here.
Here is a link to my *.conf files:
http://174.122.151.65/lighttpd/
BTW, I'm running on a centOS box.
Thanks.
It looks like you are missing the fastcgi.server section of your lighttpd.conf file
fastcgi.server = ( ".php" =>
( "localhost" =>
(
"socket" => "/var/run/lighttpd/php-fastcgi.socket",
"bin-path" => "/usr/bin/php-cgi"
)
)
)
If that doesn't work, try:
sudo lighty-enable-mod fastcgi
sudo lighty-enable-mod fastcgi-php
Worked for me.
Related
Apart from logging to the wrong file (the error log defined for that vhost defined last),
lighty does not let me use PHP 7. What am I missing?
cgi.fix_pathinfo is enabled in /etc/php/7.0/fpm/php.ini.
How can I make sure you're using the FastCGI-enabled version? What else should I look for?
version info (shrinked to the necessary)
> lsb_release -a
Description: Ubuntu 16.04.1 LTS
Codename: xenial
> lighttpd -v
lighttpd/1.4.35 (ssl) - a light and fast webserver
Build-Date: Apr 18 2016 15:36:10
> php -v
PHP 7.0.8-0ubuntu0.16.04.3 (cli) ( NTS )
> php-cgi -v
PHP 5.6.23-1+deprecated+dontuse+deb.sury.org~trusty+1 (cgi-fcgi)
> php-fpm7.0 -v
PHP 7.0.8-0ubuntu0.16.04.3 (fpm-fcgi)
lighty config file excerpt
> head -41 /etc/lighttpd/lighttpd.conf | tail -9
fastcgi.server = ( ".php" => ((
"bin-path" => "/usr/bin/php-cgi",
"socket" => "/tmp/php.socket",
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "16",
"PHP_FCGI_MAX_REQUESTS" => "1000"
),
"broken-scriptfilename" => "enable"
)))
tryouts
If I change the socket to an invalid path, restarting lighttpd works fine; but the server is unreachable. (bind failed for: (invalid path) in the error log); so this seems like the correct config file.
Modifying /etc/lighttpd/conf-available/15-fastcgi-php.conf in the same way has no effect at all.
Changing the socket to "/var/run/php/php7.0-fpm.sock" has no effect either (php_info() still says PHP 5.6 after restarting lighty).
After changing bin-path to /usr/sbin/php-fpm7.0 , I still get no error when restarting lighttpd, but the web server is unreachable.
error log excerpt
> tail /var/log/lighttpd/error.log
(no output)
> tail /var/log/lighttpd/somevhost/error.log
2016-10-10 16:48:02: (log.c.164) server started
2016-10-10 16:48:02: (mod_fastcgi.c.1112) the fastcgi-backend /usr/sbin/php-fpm7-0 failed to start:
2016-10-10 16:48:02: (mod_fastcgi.c.1116) child exited with status 2 /usr/sbin/php-fpm7-0
2016-10-10 16:48:02: (mod_fastcgi.c.1119) If you're trying to run your app as a FastCGI backend, make sure you're using the FastCGI-enabled version.
If this is PHP on Gentoo, add 'fastcgi' to the USE flags.
2016-10-10 16:48:02: (mod_fastcgi.c.1406) [ERROR]: spawning fcgi failed.
2016-10-10 16:48:02: (server.c.1022) Configuration of plugins failed. Going down.
update
I just uninstalled php5 hoping this would resolve the issues; but that didnĀ“t help either. Instead, I seem to have no way to get php5 back.
Tried a search engine?
https://www.google.com/?gws_rd=ssl#q=lighttpd+ubuntu+php+7
The first hit:
https://www.howtoforge.com/tutorial/installing-lighttpd-with-php7-php-fpm-and-mysql-on-ubuntu-16.04-lts/
suggests
## Start an FastCGI server for php (needs the php7.0-cgi package)
fastcgi.server += ( ".php" =>
((
"socket" => "/var/run/php/php7.0-fpm.sock",
"broken-scriptfilename" => "enable"
))
)
to go along with php.ini cgi.fix_pathinfo=1
You can follow the instructions on the page above to have Ubuntu run php7.0-fpm as a service, or you can configure lighttpd to start up the fastcgi.server backend by setting "bin-path" in the fastcgi.server definition, but do not do both.
I downloaded YiiShop extension from here
Then I followed the instruction:
1.Make a folder in my webapp named modules, then extracted the extension there
2.Do some configuration in webapp/protected/config/main.php
'modules' => array(
...
'shop' => array('debug' => 'true'),
...
),
3.I tried to run it as instructed, webapp/shop/install, but it turns error:
Alias "shop.ShopModule" is invalid. Make sure it points to an existing PHP file and the file is readable.
Any ideas how to fix this?
Thanks.
may be a permission error..
What operating system you are using?
If linux then try this command in terminal -
sudo chmod 777 -R /path_to_root_dir/project_name
warning : do not use this command in your file system!
I had a LAMP application running wordpress and I deleted the whole directory and replaced with new files - php based.
Now, when I go to view my server running CentOS - it just shows a 500 Internal Server error.
I've tried:
restarting server
restarting apache service itself
both completed successfully, but this didn't fix anything. Now, I do not know where to go from here.
apache logs # /usr/local/apache/logs/error_log on apache:
[Tue Apr 22 11:12:15 2014] [error] [] SoftException in Application.cpp:357: UID of script "index.php" is smaller than min_uid
I found the fix myself, this wasn't an error with Mysql at all, but rather a permissions issue with the index.php file I had.
The error, which I found in /usr/local/apache/logs/error_log was:
:is smaller than min_uid Premature end of script headers: index.php
To fix, I did this:
ls -l in the directory causing the issue (mine was public_html)
You should see the index file (e.g. index.php) that should be causing the issue. It is due to a root user having the only permission to the file and not your CPanel (or system) username. (note this system/cpanel name)
Run the following within the errorneous directory(Note: this command must be run within all subdirectories of the primary errorneous directory.):
sudo chown yoursystemuserhere:yoursystemgroupuserhere index.php
or to apply to the whole directory (thanks to #Prix):
sudo chown -R user:group /folder
You're all set.
Further literature here: http://www.inmotionhosting.com/support/website/general-server-setup/uid-smaller-than-min-uid
I hope this helps someone else in the future.
I had similar symptoms on my cPanel VPS - I was able to use easyApache to recompile Apache and PHP which fixed the problem for me.
(I realise my problem was slightly different to yours, but it may be helpful for people in the future who have the same problem I had).
chown -R user.usergroup /path_to_the_directory
Will resolve this. It is basically permission issues.
just install wordpress latest version make sure you have atleast php version 5.3 and above also look global register variable if it off or just delete htacess file from server and see what will happens
generally 500 internal server gives when file permission is missing so you should delete htacess file
Reproduceable problem description:
When installing HipHop / HHVM via the official way [1][2], and then running the built-in server [3] from /var/www via
cd /var/www
sudo hhvm -m server
it will render a custom "404 File Not Found" message to the browser, regardless of /var/www's contents when moving to the server's root:
http://111.111.111.111/
However, HipHop will run perfectly when a filename is given, like
http://111.111.111.111/index.php
Filling the index.php with phpinfo() will also show "hiphop" as feedback, indicating that this PHP file is correctly parsed by HipHop.
Question:
How to let HipHop's server run index.php (etc.) by default when navigating to the server's root, like Nginx and Apache do ?
Update:
Seems to be a common issue: [4], [5]
According to the documentation, the config.hdf file has a DefaultDocument directive. Set that.
For HHVM 3.0 you specify it in a ini config file with this:
hhvm.server.default_document = index.php
I made a custom PHP module with C++ and Swig. It works from the command line, but not with my webserver:
php index.php
php-cgi index.php
Both of those work fine.
I'm using lighttpd and php. I didn't configure these in any special way. I just installed them using sudo apt-get install.
Unfortunately if I make a webpage I get this:
Fatal error: Call to undefined function minikey_to_wif() in /var/www/index.php on line 6
Calling function_exists("minikey_to_wif") returns False too.
The phpinfo() does not show my module called minikey, and shows the same configuration path as the file I edited (/etc/php5/cgi/php.ini):
extension=/path/to/php-ext/minikey/minikey.so
I also tried copying it to where the other PHP extensions seem to be installed (/usr/lib/php5/20090626+lfs/) but that didn't work either.
I've been stopping, and starting lighttpd countless times. Each time, when I run ps aux | grep php, there are no results. I've also rebooted a few times to no effect. I have no idea what's up.
OK found the answer.
The extension relied on a library which was installed in a non-standard location. Normally I set LD_LIBRARY_PATH in ~/.bashrc. But when the web server ran the extension, it didn't have that environment variable.
Fix was to create a file in /etc/ld.so.conf.d/genjix.conf with /home/genjix/usr/lib and run ldconfig as root.
Try running phpinfo() using lighty. Make sure that its pointing to the correct php.ini.
If you think this is the problem you can launch php using the -c switch from inside lighttpd.conf with "bin-path" => "/path/to/php-cgi -c /path/to/php.ini":
e.g.
fastcgi.server = (
".php" => (
(
"bin-path" => "/path/to/php-cgi -c /path/to/php.ini",
"socket" => "/tmp/php.socket",
"max-procs" => 4,
"idle-timeout" => 30,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "4",
"PHP_FCGI_MAX_REQUESTS" => "1000"
)
)
)
)