How can I read and write php 5.6 error log? - php

I'm using Ubuntu 20.04.4 LTS, Apache/2.4.41, PHP 5.6.40-57.
When I call
error_log ('Page is not writable for save called)', 3, "/var/log/apache2/php_error.log");
there is nothing in /var/log/apache2/php_error.log.
php_error.log file is exist, and it is 777.
When I open /var/log/apache2/error.log, this error log was added.
PHP Warning: error_log(/var/log/apache2/error.log):
failed to open stream: \xed\x97\x88\xea\xb0\x80 \xea\xb1\xb0\xeb\xb6\x80 in /var/www/html/moniwiki/wiki.php on line 1258, referer: https:/
/myhome.ddns.net:9443/moniwiki/wiki.php?015B
why php_error.log is empty?
how am I able to change these \xed.. character to normal character?
what is \xed... and is there any website to decode these characters?

Related

php-fpm - enabling it causes Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

I am running into an error while attempting to enable php-fpm so that I can have multiple versions of php running on several different domains on one Apache Ubuntu 20 server.
I initially followed these directions: https://www.digitalocean.com/community/tutorials/how-to-run-multiple-php-versions-on-one-server-using-apache-and-php-fpm-on-ubuntu-18-04
But it didn't seem to use php-fpm as seen by phpinfo(); Instead, it was still running php (the regular one).
Then I found these instructions: https://techexpert.tips/apache/apache-php-fpm-installation-ubuntu-linux/
This seemed to work (in theory) by disabling regular php.
But now even phpinfo(); doesn't work, which is in a file called 'info.php'. It contains contains only:
<?php
phpinfo();
?>
I get:
"
Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required '/home/traini61/public_html/guacamole.org/wordfence-waf.php' (include_path='.:/usr/share/php') in Unknown on line 0
"
I don't understand the error. I tried disabling the 'wordfence' plugin referenced in the error then tried again but it failed in exactly the same way. I've had to run the 2nd set of directions backwards to restore the website.
Also, is there a simpler commandline program that can provide a text-GUI to more easily administer which versions of PHP are assigned to a specific domain in an apache multi-domain configuration?

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.

PHP Installed in IIS, but showing error while running codeigniter

I have installed PHP and MySQL on IIS Server. It's giving this error.
Warning: include(D:***\application\views\errors\html\error_php.php): Failed to open stream: No such file or directory in D:\CANONICA\system\core\Exceptions.php on line 268
Warning: include(): Failed opening 'D:***\application\views\errors\html\error_php.php' for inclusion (include_path='.;C:\php\pear') in D:\CANONICA\system\core\Exceptions.php on line 268
Tried enabling all extensions also.
Installed PHP version 8.0
Database Getting connected and getting inserted also, but the above warnings are showing at the top of the page.
Tried with the empty controller, then also showing the same. anybody of you knows this to sort out?
If setting the permission in IIS publisher, then it will work.
When we are setting the domain inside IIS, grant all required permissions. then this error will not show.

Drupal throwing blank update.php file

I'm updating drupalfrom 7.32 to 7.33
I followed the steps here for updating drupal 7:
https://www.drupal.org/node/1223018
I also followed the step that mentioned to set $update_free_access to TRUE (temporarily) while updating.
But, when I visit mysite.com/update.php it is still throwing a completely blank page.
I also verified in settings.php that:
the file had the database configuration values
Verified that actual data still existed in this database.
What gives? Are there any other solutions to fix this ? (Without having to do a complete clean install)
UPDATE
Errors in error.log are:
PHP Fatal error: Unknown: Failed opening required
PHP Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
Thanks!
This was an permissions error. I had, had all files not on 755.
I had files having octets of 600 to 777 and they needed to be changed to 755 with:
sudo chmod 755
I followed "KeithM"'s advice on directory permissions here: https://drupal.stackexchange.com/questions/26131/correct-permission-for-site-default-and-files-folders

PHP difference between terminal and browser

There is Neo4J installed on my Ubuntu and I'm running a test code. It's perfectly working when the code runs on terminal such as:
root#ekin-Inspiron-1090:/var/www# php neo.php
home: demolished
name: Arthur Dent
But when it comes to run on browser like localhost/neo.php, it gives fatal error and stops working.
Warning: require(phar://neo4jphp.phar): failed to open stream: operation failed in /var/www/neo.php on line 4 Fatal error: require(): Failed opening required 'phar://neo4jphp.phar' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/neo.php on line 4
I don't think it's really something with Neo4J or its PHP driver. What should be the reason?
edit: by the way, there are two php.ini files; i think one for apache and one for command line. I checked both of them and phar extension paths are the same. Also there are no include_path settings in both of them.
It's an authorization error. Apache runs under its own user, so you need to give apache user to access www folder.

Categories