Checking filetime from external server - php

I'm trying to check when the file on external server was edited last time.
The function filemtime() doesn't work and throws an exception.
Warning: filemtime() [function.filemtime]: stat failed for
http://examplesite.com/export/export.php?username=***&passwd=***&fileType=xml
I think the problem is in the link, because it's not a direct link to the file but to a php script. Does anybody knows how to get around it and get filetime without downloading that file?

Related

PHP WHY Warning: filemtime(): stat failed for

Warning: filemtime(): stat failed for includes\img\defaultimg.jpg in
I read and researched but found nothing useful
in the php manual only says this:
If PHP's integer type is only 32 bits on your system, filemtime() will fail on files over 2GB with the warning "stat failed". All stat()-related commands will exhibit the same behavior.
but is just a jpg 900k
this is my code works fine in xammp, but not in production
$dirimg="includes/img/"; //this one also throws warning
$filename = "".$dirimg."".$resultsb['Img'].".jpg"; //the path
if(file_exists ($filename)){ // exists?
$timeimg=filemtime($filename);
$srci="".$dirimg."".$resultsb['Img'].".jpg?=".$timeimg."";
}else{$timeimg=filemtime("includes\img\defaultimg.jpg"); //another path, the file does exists
$srci="includes\img\defaultimg.jpg?=".$timeimg.""; } //
both throw the same warning in the respective path, the file exits btw
the image can be seen,
but i need to know
when it is modified so the browser refreshes it
It was the slashes hahaha , the server is in Linux
So, they have to be like this "includes/img/defaultimg.jpg?="
instead of "includes\img\defaultimg.jpg?="
LOL

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.

how to correctly include a file in php for cronjobs and for normal execution

So I have a script that updates all currency rates for my webshop.
I am trying to have it run using a cronjob but when it's executed through a cronjob I get this error:
PHP Warning: require(.../.../core/dbcon.php): failed to open stream: No such file or directory in /var/www/domain.com/wholesale/system/labs/cur.php on line 2
PHP Fatal error: require(): Failed opening required '.../.../core/dbcon.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/domain.com/wholesale/system/labs/cur.php on line 2
I've also tried using the full link to include it but that seems to not work when running it manually and will also not work in cronjobs.
In the php file itself this is what I use to include it:
require(".../.../core/dbcon.php");
And when I manually run it, it returns all the currencies right, and updates them in the database.
How would I correctly require the file so it can execute using a cronjob and manually as well.
Try require("./../../core/dbcon.php");
or use absolute paths.
UPDATE
Answer has been updated - see comments below for more info.

PHP copy() throwing error

I'm processing a large number of zips and can't track down an error.
The problem is that after the import script runs for a while it suddenly stops with an error at a random zip file. If I try to re-run the script for only that single file, it works (so I exclude that the zip is faulty).
The process is like this: Open zip archive, read content, copy images from the zip, close archive.
I have two questions:
1. Why doesn't PHP simply return false instead of throwing the following error:
PHP Error[2]: copy(zip:///path/to/file/319759.zip#nwh1131_1.jpg): failed to open stream: operation failed
Any ideas what the cause can be? Maybe something with the filesystem? (Server is running on Debian 7 wheezy)
Thanks

All php files showing as 500 Internal Server Error

Problem: Any php file we attempt to access on our website shows up as a 500 internal server error. I'm not sure if this is related but I have had a look in the error logs and the below error appears:
[08-Nov-2013 12:41:51 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/htscanner.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20090626/htscanner.so:
cannot open shared object file: No such file or directory in Unknown on line 0
Attempt: Some of the things I have tried to do is delete the over size error log and renamed the htaccess file to see if that was causing the problem.
Page: You can see the problem at this page: http://science.org.au/support-us/donate-now.html (Half way down in the iframe)
Question: Does anyone have any ideas on how to fix this? Things to try?
Did you try this?
edit the file /etc/php5/cli/php.ini:
and remove the lines:
[htscanner] Extension = “htscanner.so”
config_file = “.htaccess”
default_docroot = “/var/www”
You should pay more attention to what your error log says. According to it, you should either install htscanner.so PHP extension, or remove reference to it from your php.ini.

Categories