Red error msg / PHP CLI requirements failed while executing

Ask your questions regarding TimeTrex installation here.
Locked
guanaco
Posts: 38
Joined: Wed Feb 23, 2011 12:42 pm

Re: Red error msg / PHP CLI requirements failed while execut

Post by guanaco »

Good afternoon, I just tried to upgrade to the latest version... I am on Community 7.2.4 but encountered kind of the same problem while trying to upgrade.

Requirements failed with this messages:
Base URL: Warning: base_url in timetrex.ini.php is incorrect, perhaps it should be "/TimeTrex/interface/" instead.
PHP CLI Executable: Warning: PHP CLI (/usr/bin/php) does not exist or is not executable.
PHP CLI Requirements: Warning: PHP CLI requirements failed while executing
"/usr/bin/php /var/www/clients/client1/web1/web/TimeTrex//tools/unattended_upgrade.php --config /var/www/clients/client1/web1/web/TimeTrex/includes/../timetrex.ini.php --requirements_only"
Likely caused by having two PHP.INI files with different settings.

The URL I use to log in normally to timetrex is http://internal.domain/TimeTrex/interface/flex therefore my base_url is set to /TimeTrex/interface and it has been working correctly up to the moment of upgrade. My server is a Ubuntu Server 12.04. The file /usr/bin/php exists and works, as I said... my timetrex installation works normal with version 7.2.4 but when trying to upgrade gives this errors.

Any idea what might be the issue here?

EDIT: same thing happens if I change everything to timetrex instead of TimeTrex
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: Red error msg / PHP CLI requirements failed while execut

Post by shaunw »

PHP isn't able to read or execute this file: /usr/bin/php

What are the permissions set on it? What is the output of:

ls -l /usr/bin/php
guanaco
Posts: 38
Joined: Wed Feb 23, 2011 12:42 pm

Re: Red error msg / PHP CLI requirements failed while execut

Post by guanaco »

shaunw wrote:PHP isn't able to read or execute this file: /usr/bin/php

What are the permissions set on it? What is the output of:

ls -l /usr/bin/php
Thank you for your reply shaunw

root@server3:~# ls -l /usr/bin/php
lrwxrwxrwx 1 root root 21 Oct 11 13:36 /usr/bin/php -> /etc/alternatives/php

I can use php from command terminal without any issues.
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: Red error msg / PHP CLI requirements failed while execut

Post by shaunw »

Using it from the command line doesn't mean much, unless you are logged in as the same user your webserver runs as.

What is the output of:

ls -l /etc/alternatives/php

Its also possible that SELinux or AppArmour is blocking access too.
guanaco
Posts: 38
Joined: Wed Feb 23, 2011 12:42 pm

Re: Red error msg / PHP CLI requirements failed while execut

Post by guanaco »

shaunw wrote:Using it from the command line doesn't mean much, unless you are logged in as the same user your webserver runs as.

What is the output of:

ls -l /etc/alternatives/php

Its also possible that SELinux or AppArmour is blocking access too.
got it. I have used it using the same user as my webserver and works also (or so I guess).

Here is what you asked for:
root@server3:~# ls -l /etc/alternatives/php
lrwxrwxrwx 1 root root 13 Oct 11 13:36 /etc/alternatives/php -> /usr/bin/php5
root@server3:~# ls -l /usr/bin/php5
-rwxr-xr-x 1 root root 8100184 Feb 28 17:30 /usr/bin/php5
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Red error msg / PHP CLI requirements failed while executing

Post by shaunw »

I would check to see if you have SELinux or AppArmour installed, you have something preventing Apache's PHP instance from running that binary file.
guanaco
Posts: 38
Joined: Wed Feb 23, 2011 12:42 pm

Re: Red error msg / PHP CLI requirements failed while execut

Post by guanaco »

shaunw wrote:I would check to see if you have SELinux or AppArmour installed, you have something preventing Apache's PHP instance from running that binary file.
Sorry but I dont understand, if I log in as the web user and run the command "/usr/bin/php5 /var/www/clients/client1/web1/web/TimeTrex//tools/unattended_upgrade.php --config /var/www/clients/client1/web1/web/TimeTrex/includes/../timetrex.ini.php --requirements_only" it doesnt complain, it actually gives a PHP notice only:

Code: Select all

server3:~# /usr/bin/php /var/www/clients/client1/web1/web/TimeTrex//tools/unattended_upgrade.php --config /var/www/clients/client1/web1/web/TimeTrex/includes/../timetrex.ini.php --requirements_only
PHP Notice:  Undefined index: buffer_output in /var/www/clients/client1/web1/web/TimeTrex/includes/global.inc.php on line 393
This problem wasnt happening before, TimeTrex version 7.2.4 is running without problems but with the message on top saying "Requirements failed" and "there is a new version"
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: Red error msg / PHP CLI requirements failed while execut

Post by shaunw »

Based on that notice it would appear that something strange has happened to your timetrex.ini.php file, can you attach it here so we can look at it?

Either way though, if you see this message:
PHP CLI Executable: Warning: PHP CLI (/usr/bin/php) does not exist or is not executable.
It means exactly that, PHP can't execute "/usr/bin/php", the most common cause is permissions or it being denied by your operating system.

SELinux and AppArmor are security mechanisms that offer fine grained control over what can and cannot be executed, so if you have one of those installed its likely causing your problem. If you google either of those you should find more information regarding them and how to find out if they are installed and/or disable them.
guanaco
Posts: 38
Joined: Wed Feb 23, 2011 12:42 pm

Re: Red error msg / PHP CLI requirements failed while execut

Post by guanaco »

shaunw wrote:Based on that notice it would appear that something strange has happened to your timetrex.ini.php file, can you attach it here so we can look at it?

Either way though, if you see this message:
PHP CLI Executable: Warning: PHP CLI (/usr/bin/php) does not exist or is not executable.
It means exactly that, PHP can't execute "/usr/bin/php", the most common cause is permissions or it being denied by your operating system.

SELinux and AppArmor are security mechanisms that offer fine grained control over what can and cannot be executed, so if you have one of those installed its likely causing your problem. If you google either of those you should find more information regarding them and how to find out if they are installed and/or disable them.
I tried, just try, to install SELinux and AppArmor with apt-get install selinux and apt-get install apparmor and both commands ask me to confirm installation which I believe tells me that they are not installed. I will continue to check in google to see if something else might be blocking php which I dont think is the problem as I use several scripts that include php commands from terminal.

Here is my timetres.ini.php file:

Code: Select all

;
;
; TimeTrex Configuration File
; *Linux* Example
;
;

;
; System paths. NO TRAILING SLASHES!
;
[path]
;URL to TimeTrex web root directory. ie: http://your.domain.com/<*BASE_URL*>
;DO NOT INCLUDE http://your.domain.com, just the directory AFTER your domain
base_url = /TimeTrex/interface

;
;log directory
;
;Linux
log = /var/www/bensonsv.com/web/TimeTrex/log

;
;Misc storage, for attachments/images
;
;Linux
storage = /var/www/bensonsv.com/web/TimeTrex/storage

;
;Full path and name to the PHP CLI Binary
;
;Linux
php_cli = /usr/bin/php



;
; Database connection settings. These can be set from the installer.
;
[database]
type = postgres8
;type = postgres8

host = 10.10.0.171
database_name = timetrex
user = timetrex
password = *******


;
; Email delivery settings.
;
[mail]
;Least setup, deliver email through TimeTrex's email relay via SOAP (HTTP port 80)
delivery_method = soap

;Deliver email through local sendmail command specified in php.ini
;delivery_method = mail

;Deliver email through remote SMTP server with the following settings.
;delivery_method = smtp
;smtp_host=smtp.gmail.com
;smtp_port=587
;smtp_username=timetrex@gmail.com
;smtp_password=testpass123


;
; Cache settings
;
[cache]
enable = FALSE
;Linux
dir = /var/www/bensonsv.com/web/TimeTrex/tmp



[debug]
;Set to false if you're debugging
production = TRUE

enable = FALSE
enable_display = FALSE
Buffer_output = FALSE
enable_log = FALSE
verbosity = 10



[other]
; Force all clients to use SSL.
force_ssl = FALSE
installer_enabled = TRUE
primary_company_id = 1
hostname = localhost 

default_interface = flex

;WARNING: DO NOT CHANGE THIS AFTER YOU HAVE INSTALLED TIMETREX.
;If you do it will cause all your passwords to become invalid,
;and you may lose access to some encrypted data.
salt = 24272848e62b63bcd2aaa6ba82d3c3ce
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: Red error msg / PHP CLI requirements failed while execut

Post by shaunw »

In your timetrex.ini.php file,
Buffer_output = FALSE
Is invalid and should be:
buffer_output = FALSE
Instead, (notice all lower case).

That was likely the cause of the PHP notice from an earlier post.
guanaco
Posts: 38
Joined: Wed Feb 23, 2011 12:42 pm

Re: Red error msg / PHP CLI requirements failed while execut

Post by guanaco »

shaunw wrote:In your timetrex.ini.php file,
Buffer_output = FALSE
Is invalid and should be:
buffer_output = FALSE
Instead, (notice all lower case).

That was likely the cause of the PHP notice from an earlier post.
Hi shaunw, thanks for your time on this. I changed the buffer letter and that error went away but Im still having the issues with the installer. I am unable to upgradeto the latest version. I dont have SELinux or AppArmor installed.

As I mentioned before I have several scripts runing with the same user than my webserver using the command /usr/bin/php without a problem, even cron jobs running.

Please let me know if I should check anything else.
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: Red error msg / PHP CLI requirements failed while execut

Post by shaunw »

Can you attach your php.ini file here?
guanaco
Posts: 38
Joined: Wed Feb 23, 2011 12:42 pm

Re: Red error msg / PHP CLI requirements failed while execut

Post by guanaco »

shaunw wrote:Can you attach your php.ini file here?
Since it is kind of long, I have copied the file into a webserver. Can you check it at http://200.10.30.47/php.ini ?
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: Red error msg / PHP CLI requirements failed while execut

Post by shaunw »

What was the exact path of the original file?
guanaco
Posts: 38
Joined: Wed Feb 23, 2011 12:42 pm

Re: Red error msg / PHP CLI requirements failed while execut

Post by guanaco »

shaunw wrote:What was the exact path of the original file?
/etc/php5/cgi/php.ini
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: Red error msg / PHP CLI requirements failed while execut

Post by shaunw »

Unfortunately I'm at a loss as to what the issue is.

Basically this is all that TimeTrex is trying to run:

Code: Select all

<?php
if ( is_executable( '/usr/bin/php' ) ) {
  echo "Works!\n";
} else {
  echo "Does not work!\n";
}
?>
Which is not working on your system.

If you google PHP is_executable returning false, you will see many pages with many different solutions, most of which we have already tried, but there may a few that we haven't yet. All the issues are related to your PHP or operating system configuration though, well outside the scope of TimeTrex itself.
guanaco
Posts: 38
Joined: Wed Feb 23, 2011 12:42 pm

Re: Red error msg / PHP CLI requirements failed while execut

Post by guanaco »

shaunw wrote:Unfortunately I'm at a loss as to what the issue is.

Basically this is all that TimeTrex is trying to run:

Code: Select all

<?php
if ( is_executable( '/usr/bin/php' ) ) {
  echo "Works!\n";
} else {
  echo "Does not work!\n";
}
?>
Which is not working on your system.

If you google PHP is_executable returning false, you will see many pages with many different solutions, most of which we have already tried, but there may a few that we haven't yet. All the issues are related to your PHP or operating system configuration though, well outside the scope of TimeTrex itself.
I created a file test.php with the code you just gave me and run it from terminal using "php test.php" and the result was "Works!"

Code: Select all

web1@server3:~/web$ vim test.php
web1@server3:~/web$ php test.php 
Works!
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: Red error msg / PHP CLI requirements failed while execut

Post by shaunw »

Try running it from your web server as well.
guanaco
Posts: 38
Joined: Wed Feb 23, 2011 12:42 pm

Re: Red error msg / PHP CLI requirements failed while execut

Post by guanaco »

shaunw wrote:Try running it from your web server as well.
you are right... it says "Doesnt work"... I dont understand how this happened. I have 5 servers (all Ubuntu 12.04) and the other 4 of them gives me "Works!" but not the one that has TimeTrex on it. I dont understand....
guanaco
Posts: 38
Joined: Wed Feb 23, 2011 12:42 pm

Re: Red error msg / PHP CLI requirements failed while execut

Post by guanaco »

Hey shaunw, I found the problem that was preventing the php to be executed: open_basedir restriction in effect. I fixed it. Problem is I still have other two error messages:

Code: Select all

Base URL: 	Warning: base_url in timetrex.ini.php is incorrect, perhaps it should be "/TimeTrex/interface/" instead.
PHP CLI Executable: 	OK
PHP CLI Requirements: 	Warning: PHP CLI requirements failed while executing
"/usr/bin/php /var/www/clients/client1/web1/web/TimeTrex//tools/unattended_upgrade.php --config /var/www/clients/client1/web1/web/TimeTrex/includes/../timetrex.ini.php --requirements_only"
Likely caused by having two PHP.INI files with different settings. 
Any idea?
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: Red error msg / PHP CLI requirements failed while execut

Post by shaunw »

Does your CGI environment use chroot by chance?

As another datapoint you may want to try it with mod_php built into Apache rather mod_cgi, to see if that makes any difference.
guanaco
Posts: 38
Joined: Wed Feb 23, 2011 12:42 pm

Re: Red error msg / PHP CLI requirements failed while execut

Post by guanaco »

shaunw wrote:Does your CGI environment use chroot by chance?

As another datapoint you may want to try it with mod_php built into Apache rather mod_cgi, to see if that makes any difference.
I tried changing PHP from Fast-CGI to Mod-PHP as you suggested but same result. Other thing I dont understand is the base_url error... is where TimeTrex is installed and without the ending /
Locked