473,799 Members | 3,298 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_GE NERAL) 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***@glassgian t.com
http://www.glassgiant.com
Jul 17 '05 #1
3 5698
Shawn Wilson <sh***@glassgia nt.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***@glassgia nt.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***@glassgian t.com
http://www.glassgiant.com
Jul 17 '05 #3
Shawn Wilson wrote:

Jon Kraft wrote:

Shawn Wilson <sh***@glassgia nt.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***@glassgia nt.com>";
$subject = "Website functions not working.";
$headers = "From: Server <sh***@glassgia nt.com>\nX-Priority: 1";
$message = "Some functions are not working. Please check out immediately.\n\ n";

$functionlist = array(
"imagecreatefro mjpeg",
"imagecreatefro mpng",
"imagecreat e",
"imagecopyresiz ed",
"imagecopy" ,
"imagejpeg" ,
"imagepng",
"imagecreatetru ecolor",
"fopen",
"mysql_quer y",
"filesize",
"mysql_conn ect"
);

sort ($functionlist) ;

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

foreach($functi onlist as $var) {
if (function_exist s($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($notwor ks) > 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***@glassgian t.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
3564
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: AddType application/x-php .htm Action application/x-php /bin:/usr/bin/php
1
15621
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 latter... Same question for the build date. Is it the build date for PHP or the build date for the system? Thanks.
6
9532
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 it: http://us3.php.net/manual/en/configuration.php
3
2218
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 work they way I would expect "dd/mm/yy" "dd/mm/ccyy" "mm/dd/ccyy"
9
2441
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, strings for logging, and structures for data points. I want to use one function to read data from this block and one function to write data, for example: sram_read(OBJECT_IDENTIFIER) would return a pointer to the appriate object and
9
1580
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 Column1 Row1 Table2 Column1 Row1 ~ 20 Table1 Column1 Row2 ~ 3
3
3484
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 the same user credentials (two different UID/PWDs tried) returning existing data without a problem (i.e. it's not a SQL security problem). With code like
5
9003
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 and rate information Table houses Clinician name, location and number of units for each type of service rendered on each day. The two tables are connected by field Please see the code below SELECT .Clinician, .Location, .Date,...
4
4141
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 that this is a joke (like most of the PHP language in my experience so far) - but seriously, does anyone know why on earth a diagnostic tool like phpinfo() displays values that are different from that obtained via a script call?
0
9546
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10490
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10030
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9078
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5590
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4146
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.