I am trying to use system or exec function to execute a date command, my safe mode is off but still it is giving me the following error
sh: /date: No such file or directory
code used
=============
<?php
echo system('date');
?>
Please let me know the solution if this is a bugSounds like the webserver user running your PHP scripts does not have a path environment setting pointing to whatever directory the date command is in on your host. You may have to give it the full path, something like:
echo system('/usr/bin/date');
Of course, you could do the above entirely within PHP using the date or strftime functions.you could do the above entirely within PHP using the date or strftime functions.
agreed since either will return the time on the webserverSounds like the webserver user running your PHP scripts does not have a path environment setting pointing to whatever directory the date command is in on your host. You may have to give it the full path, something like:
echo system('/usr/bin/date');
Of course, you could do the above entirely within PHP using the date or strftime functions.
I have tried using this code also but still the issue persist, and i am going Note that I'm just guessing where the date program would be on your host. It might be something like /usr/sbin/date, /etc/bin/date, and so on.
sh: /date: No such file or directory
code used
=============
<?php
echo system('date');
?>
Please let me know the solution if this is a bugSounds like the webserver user running your PHP scripts does not have a path environment setting pointing to whatever directory the date command is in on your host. You may have to give it the full path, something like:
echo system('/usr/bin/date');
Of course, you could do the above entirely within PHP using the date or strftime functions.you could do the above entirely within PHP using the date or strftime functions.
agreed since either will return the time on the webserverSounds like the webserver user running your PHP scripts does not have a path environment setting pointing to whatever directory the date command is in on your host. You may have to give it the full path, something like:
echo system('/usr/bin/date');
Of course, you could do the above entirely within PHP using the date or strftime functions.
I have tried using this code also but still the issue persist, and i am going Note that I'm just guessing where the date program would be on your host. It might be something like /usr/sbin/date, /etc/bin/date, and so on.