FASTCGI / PHP server error - php

We are having trouble getting FastCGI and PHP5 to work. We get an error in our logs:
FastCGI: server "/usr/lib/cgi-bin/php5-fcgi" stderr: PHP message: PHP Fatal error: Uncaught --> Smarty: unable to write file
We have already tried to change write permissions on those specific folders with no result.
It is for one specific folder (CACHE FOLDER)
e.g this file
/cache/smarty/compile/86/ee/23/wrt57cdc48b1834e9_69135182
How can we reset or set up PHP FastCGI so it can write the file ?
Setup is normal LAMP stack with PHP 5.6.
We can load php files in general elsewhere.(Other folders, e.g from root)

Related

PHP Error "Unknown: failed to open stream... in Unknown on line 0..." when editing php files

I get a strange php error:
2022-03-14 10:52:19: (mod_fastcgi.c.421) FastCGI-stderr: PHP message:
PHP Warning: Unknown: failed to open stream:
No such file or directory in Unknown on line 0
PHP message: PHP Fatal error: Unknown: Failed opening required
'var/www/vhosts/webdev/sites/test/hello.php'
(include_path='.') in Unknown on line 0
Long explanation:
I create a file hello.php in my webroot, having the content:
<?php echo("hello"); ?>
I run this file in a browser, all is fine, it shows "hello"
Now I edit this file so the content now is:
<?php echo("hello"); echo("world"); ?>
I run this edited file in a browser => The error is shown
I reload the page (F5 or ctrl-R) => all is working fine now
In other words:
Whenever I edit a php file and try to run it in a browser, I get this error message. After reloading the page it works!
That is the real strange thing, after reloading everything is working fine!!!
My config
a local raspberry pi running raspbian
webserver: lighttpd (standard install from repo)
php7.3-fpm (standard install from repo)
all file permissions in my web dev folder are 775, all files are www-data:www-data owned
NO selinux running (like in other answers suggested)
the php.ini is pretty much untouched, some options:
auto_prepend_file =
auto_append_file =
include_path = "."
there are no other hidden config files in the folder
With html files there are no problems. So it must be a php-fpm problem.
I am out of ideas now. It might be a very easy fix, but I am not a Pro.
Any ideas how to fix this?
In the error log, the path doesn't start with a slash "/"
var/www/vhosts/webdev/sites/test/hello.php
which indicates a misconfiguration in lighttpd/fastcgi configuration
Fixing the path should make everything work correctly.

Clean wordpress instalation first load problem php7.4

I just downloaded wordpress, copied it to ISPConfig vhost, with php7.4-fpm and got this error when I want to first load WP and configure DB connection.
[proxy_fcgi:error] [pid 14720] [client 62.109.143.214:39852] AH01071:
Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to
undefined function wp_guess_url() in
/var/www/clients/client1/web31/web/wp-load.php:56\nStack trace:\n#0
/var/www/clients/client1/web31/web/wp-blog-header.php(13):
require_once()\n#1 /var/www/clients/client1/web31/web/index.php(17):
require('/var/www/client...')\n#2 {main}\n thrown in
/var/www/clients/client1/web31/web/wp-load.php on line 56'
PHP7.4-FPM is working I tested it on another site where I already have WordPress and it is working.
Seems like my linux has corrupted or bugged "Ark" (Archiving Tool) and it was not able to extract all datas.
I downloaded WordPress with wget on server and copied to webroot and it works now. Thanks #cobrerahector for tip.

"Failed to start the session: already started by PHP" error using a CMS

I installed a CMS, named Prestashop: it runs under a specific domain, and with a specific VirtualHost configuration on Apache, on a server with other PHP applications.
When I try to login in, as administrator user, I receive the following error (this is the Apache error log):
[Wed Jan 18 00:09:16.059190 2017] [:error] [pid 31253] [client xx.xx.xx.xx:63129] PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Failed to start the session: already started by PHP.' in /opt/wp/apps/prestashop/app/cache/prod/classes.php:108\nStack trace:\n#0 /opt/wp/apps/prestashop/app/cache/prod/classes.php(483): Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start()\n#1 /opt/wp/apps/prestashop/vendor/symfony/symfony/src/Symfony/Component/Security/Csrf/TokenStorage/SessionTokenStorage.php(90): Symfony\Component\HttpFoundation\Session\Session->start()\n#2 /opt/wp/apps/prestashop/vendor/symfony/symfony/src/Symfony/Component/Security/Csrf/CsrfTokenManager.php(54): Symfony\Component\Security\Csrf\TokenStorage\SessionTokenStorage->hasToken('ANONYMOUS_USER')\n#3 /opt/wp/apps/prestashop/app/cache/prod/classes.php(8196): Symfony\Component\Security\Csrf\CsrfTokenManager->getToken('ANONYMOUS_USER')\n#4 /opt/wp/apps/prestashop/classes/Link.php(722): PrestaShopBundle\Service\Routing\Router->generate('admin_product_c...')\n#5 /opt/wordpre in /opt/wp/apps/prestashop/app/bootstrap.php.cache on line 3216, referer: http://www.xxxxx.xx/adminXXX/index.php?controller=AdminLogin&token=181fa270d47386a8d523bdea6213932c&redirect=AdminDashboard'
PHP session auto_start parameter is set to 0 in php.ini.
I don't understand how can I solve this problem. It can be depends on an Apache or PHP configuration?
Thanks a lot.
I Just got the same issue with my Symfony 3.2 app, i was upgrading my web server from php 5.5.12 to php 5.6.31 when it happened. After upgrading again to php 7.0.23 everything go back to normal.

ISPConfig 3 - mod_fcgid: error reading data from FastCGI server

I recently restored a server backup and now I get the following error trying to access any website (including the ISPConfig admin interface):
mod_fcgid: error reading data from FastCGI server
End of script output before headers: index.php
I have tried to set
opcache.enable = 0
in php.ini which seems to have worked for some, but I still get the same results.
I am using ISPCOnfig 3 on Centos 7 with php 5.4.16 and Apache/2.4.6

Configure Laravel project on a DSO handler server

I have a Laravel 5.0 project that I want to test on servers that supports different php handler like:-
1. suPHP (Single user PHP)
2. FCGI (FastCGI)
3. CGI (Common Gateway Interface)
4. DSO (Dynamic Shared Object)
In case of first three the project works fine.
And also I tried to move the project out of public.
But when ever I try to run the project on a DSO server it fails.
There is just:-
1. Mozila -> blank screen
2. Chrome -> 500 error
The server I have is a VPS Linux server.
And I was just changing the php handlers.
For the first three case the php handler API is CGI
and For the DSO its Apache
Please let me know what would be the appropriate solution.
This is my error log
[Fri Nov 06 11:46:20.789176 2015] [:error] [pid 1111] [client 111.111.111.111:11111] PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/home/site-name/public_html/project-name/code/storage/logs/laravel-2015-11-06.log" could not be opened: failed to open stream: Permission denied' in /home/site-name/public_html/project-name/code/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:87\nStack trace:\n#0 /home/site-name/public_html/project-name/code/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php(88): Monolog\\Handler\\StreamHandler->write(Array)\n#1 /home/site-name/public_html/project-name/code/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\\Handler\\RotatingFileHandler->write(Array)\n#2 /home/site-name/public_html/project-name/code/vendor/monolog/monolog/src/Monolog/Logger.php(289): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)\n#3 /home/site-name/public_html/project-name/code/vendor/monolog/monolog/src/Monolog/Logger.php in /home/site-name/public_html/project-name/code/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 87
Thank You
its just today I found the solution.
On a DSO server the file or folder permission should be set to 777 on the server.
And the exact path that gets affected due to this is Laravel-project/storage folder should have the 777 file permission. And also all the folders and files within it and more within.

Categories