473,395 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

phpinfo returning 2 different build dates

Hi,

My host keeps messing things up and not telling me. I am trying to write a cron
job that will test to make sure the "unusual" functions I use work and, if not,
email me. I want it to send me the build date as well. The weird thing is, my
cron script (using phpinfo) gives me a different build date than phpinfo() in an
"admin tool" section of my website.

The cron script is sitting in the root of my home directory (non web
accessable). The admin tool is sitting in a password-protected (BASIC AUTH)
section of the site.

----------------------

CRON SCRIPT SNIPPET:
ob_start();
phpinfo();
$string = ob_get_contents();
ob_end_clean();

echo "\n\n" . $string . "\n\n";

----------------------

ADMIN TOOL SNIPPET:
phpinfo();

----------------------

CRON SCRIPT RESULT SNIPPET:
PHP Version => 4.3.3

System => Linux mydomain.com X.XX.XX-XX.X #1 Mon Aug 18 14:56:30 EDT 2003 i686
Build Date => Oct 21 2003 02:52:32

----------------------

ADMIN TOOL RESULT SNIPPET (copied from HTML):
PHP Version 4.3.3

System
Linux mydomain.com X.XX.XX-XX.X #1 Mon Aug 18 14:56:30 EDT 2003 i686
Build Date
Oct 18 2003 21:23:42

----------------------

I have tried both with phpinfo(INFO_GENERAL) as well - same result.
Does anyone have any idea why this is happening and how to fix it? Both scripts
are owned by the same user, and have the same permissions. Since I'm testing, I
currently execute the cron script through SSH with: php -q ./filename.php. I
execute the admin tool by accessing it through a browser.

Thanks in advance,
Shawn
--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 17 '05 #1
3 5677
Shawn Wilson <sh***@glassgiant.com> wrote:
email me. I want it to send me the build date as well. The weird thing
is, my cron script (using phpinfo) gives me a different build date than
phpinfo() in an "admin tool" section of my website.


Hi Shawn,

The command "php" and the php module for the web server are two different
things, unless PHP is run as CGI.

BTW, your php script could be shortened to a call to php:

/path/to/php -i

Outputs the same as phpinfo().

HTH;
JOn
Jul 17 '05 #2
Jon Kraft wrote:

Shawn Wilson <sh***@glassgiant.com> wrote:
email me. I want it to send me the build date as well. The weird thing
is, my cron script (using phpinfo) gives me a different build date than
phpinfo() in an "admin tool" section of my website.


Hi Shawn,

The command "php" and the php module for the web server are two different
things, unless PHP is run as CGI.

BTW, your php script could be shortened to a call to php:

/path/to/php -i

Outputs the same as phpinfo().


Ah, I should have known that. I guess I'll have to set up a cron script to
fopen() a webpage that uses phpinfo() to display the build date, as it's the PHP
module's build date I'm interested in, unless anyone knows of a less "cludgy"
solution =D

Thanks for your help,
Shawn
--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 17 '05 #3
Shawn Wilson wrote:

Jon Kraft wrote:

Shawn Wilson <sh***@glassgiant.com> wrote:
email me. I want it to send me the build date as well. The weird thing
is, my cron script (using phpinfo) gives me a different build date than
phpinfo() in an "admin tool" section of my website.


Hi Shawn,

The command "php" and the php module for the web server are two different
things, unless PHP is run as CGI.

BTW, your php script could be shortened to a call to php:

/path/to/php -i

Outputs the same as phpinfo().


Ah, I should have known that. I guess I'll have to set up a cron script to
fopen() a webpage that uses phpinfo() to display the build date, as it's the PHP
module's build date I'm interested in, unless anyone knows of a less "cludgy"
solution =D


In case anyone is looking for the a solution to the same problem, my script
follows:

<?PHP

$email = "Shawn Wilson <sh***@glassgiant.com>";
$subject = "Website functions not working.";
$headers = "From: Server <sh***@glassgiant.com>\nX-Priority: 1";
$message = "Some functions are not working. Please check out immediately.\n\n";

$functionlist = array(
"imagecreatefromjpeg",
"imagecreatefrompng",
"imagecreate",
"imagecopyresized",
"imagecopy",
"imagejpeg",
"imagepng",
"imagecreatetruecolor",
"fopen",
"mysql_query",
"filesize",
"mysql_connect"
);

sort ($functionlist);

$works = "";
$notworks = "";
$builddate = "";

foreach($functionlist as $var) {
if (function_exists($var))
$works .= "Function \"$var\" works.\n";
else
$notworks .= "Function \"$var\" does not work.\n";
}

ob_start();
phpinfo();
$string = ob_get_contents();
ob_end_clean();

$string = explode("\n", $string);

foreach($string as $var) {
$var = strip_tags($var);
if (preg_match("/^Build Date\s+([A-Za-z]+ [0-9]+ [0-9]+
[0-9]+:[0-9]+:[0-9]+).+$/", $var)) {
$var = preg_replace("/^Build Date\s+([A-Za-z]+ [0-9]+ [0-9]+
[0-9]+:[0-9]+:[0-9]+)[^0-9]?.*$/", "\$1", $
var);
$builddate = $var;
break;
}
}

if (strlen($notworks) > 0)
mail($email, $subject, $message . $notworks . "\n" . $works . "\n\nBuild
Date: $builddate", $headers);
echo "DONE";
?>

I've got a cron job that calls this script through http every hour. I'm sure
there's a more efficient regex, but this was a quickie. I might add my host's
tech support address to the To: header.

Shawn
--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: lawrence | last post by:
I wanted to use the AddType directive in an .htaccess file. So I used phpinfo() to get the path info for PHP. I found this line: PATH /bin:/usr/bin So I tried this, but it did not work:...
1
by: nom_du_pere | last post by:
The phpinfo function lists the system ... But is it the system that PHP was compiled on OR the system that PHP is executing on? I took a sneak peek at the source code and I am leaning toward the...
6
by: Win | last post by:
Not really an important question, but does anyone happen to know how to modify the path displayed in the section from phpinfo()? I was referred to the following URL, but that doesn't seem to do...
3
by: Don Grover | last post by:
Hi I have to return dates formated in different ways in an asp page from sql server. What function can I use or how can I return dates formated like so I tried DATEPART ie.. but that does not...
9
by: CptDondo | last post by:
I am working on an embedded platform which has a block of battery-backed RAM. I need to store various types of data in this block of memory - for example, bitmapped data for control registers,...
9
by: Blarneystone | last post by:
Hi, I am using VB.NET and trying to pull data from two different tables in the database. I am using what I think is standard code. But the data I am pulling is like the following: Table1...
3
by: downwitch | last post by:
Hi, I'm having trouble getting data in ADO.Net recordsets. (VS 2005, SQL Server 2005). All my rowsets come back empty--whether sourced from queries or stored procs--despite ODBC connections with...
5
by: jennwilson | last post by:
Using Access 2000 - I have a query that is suppose to return the records from table within specified time range and find matching data from another table . Table houses Clinician name, location...
4
by: Ronald Raygun | last post by:
I have just discovered that the value reported for $_SERVER by phpinfo is different from the value I obtain when I run the following: <?php echo $_SERVER ?> My natural assumption is to assume...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.