Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

[resolved] CentOS 7 Installation problem

Like many others, I am having issues getting the initial setup running on CentOS 7.  I have read many discussion with similar issues, but have not seen a solution for CentOS 7.  I have seen folks give up or down grade to another version of CentOS. 

I have another LAMP based virtual host running this exact server without an issue.

Setup:

     CentOS 7
     SELinux Disabled.
     osticket 1.9.14
 

#sestatus ; rpm -qa | grep -iP 'http|^php|^maria'
SELinux status:                 disabled
httpd-2.4.6-40.el7.centos.1.x86_64
perl-HTTP-Tiny-0.033-3.el7.noarch
php-pdo-5.4.16-36.1.el7_2.1.x86_64
php-process-5.4.16-36.1.el7_2.1.x86_64
mariadb-libs-5.5.47-1.el7_2.x86_64
httpd-tools-2.4.6-40.el7.centos.1.x86_64
php-cli-5.4.16-36.1.el7_2.1.x86_64
php-5.4.16-36.1.el7_2.1.x86_64
mariadb-5.5.47-1.el7_2.x86_64
mariadb-server-5.5.47-1.el7_2.x86_64
php-mysql-5.4.16-36.1.el7_2.1.x86_64
php-xml-5.4.16-36.1.el7_2.1.x86_64
php-pear-1.9.4-21.el7.noarch
php-common-5.4.16-36.1.el7_2.1.x86_64

Main Apache Config File:
ServerRoot "/etc/httpd"
Listen 80
Include conf.modules.d/*.conf
User apache
Group apache
ServerAdmin root@localhost
<Directory />
    AllowOverride none
    Require all denied
</Directory>
DocumentRoot "/var/www/html"
<Directory "/var/www">
    AllowOverride None
    Require all granted
</Directory>
<Directory "/var/www/html">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>
<Files ".ht*">
    Require all denied
</Files>
ErrorLog "logs/error_log"
LogLevel warn
<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common
    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>
    CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
</IfModule>
<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>
<IfModule mime_module>
    TypesConfig /etc/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
</IfModule>
AddDefaultCharset UTF-8
<IfModule mime_magic_module>
    MIMEMagicFile conf/magic
</IfModule>
EnableSendfile on
IncludeOptional conf.d/*.conf


apache vhost config
<VirtualHost *:80>
    ServerName helpdesk.my.domain
    ServerAlias helpdesk
    ServerAdmin webmaster@my.domain
    UseCanonicalName On
    DirectoryIndex index.html index.php
    DocumentRoot /var/www/osticket/upload
    <Directory /var/www/osticket/upload>
       Options All
       AllowOverride All
       Order allow,deny
       Allow from all
    </Directory>
    <Directory /var/www/osticket/upload/setup>
      Order allow,deny
      Allow from 108.48.202.114
      Allow from 172.16.0.0/24
    </Directory>
</VirtualHost>

drwxr-xr-x 13 apache apache 4096 Aug  5 12:08 /var/www/osticket/upload/

==> error_log <==
[Fri Aug 05 14:58:45.030553 2016] [:error] [pid 26884] [client 172.16.0.102:54290] PHP Warning:  Unknown: failed to open stream: Permission denied in Unknown on line 0
[Fri Aug 05 14:58:45.030646 2016] [:error] [pid 26884] [client 172.16.0.102:54290] PHP Fatal error:  Unknown: Failed opening required '/var/www/osticket/upload/setup/index.php' (include_path='.:/usr/share/pear:/usr/share/php') in Unknown on line 0

==> access_log <==
172.16.0.102 - - [05/Aug/2016:14:58:45 -0400] "GET /setup/ HTTP/1.1" 500 - "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0"

ls -ld /usr/share/pear /usr/share/php
drwxr-xr-x  8 root root 4096 Aug  5 12:37 /usr/share/pear
drwxr-xr-x. 2 root root 4096 May 12 09:49 /usr/share/php

Comments

  • edited August 2016
    "Permission denied"
    "PHP Fatal error:  Unknown: Failed opening required '/var/www/osticket/upload/setup/index.php'"

    One of the following:
    • SELinux or mod_security is running and preventing the access (or after you changed them you didn't restart Apache).
    • Your HTTP config is preventing the file from being accessed.  Check your .htaccess files, and http.conf (and include files).
    • your files are not accessible by the username that your Apache is running as.  Check your owner/group settings.

    This might point you in the right direction also:

    http://unix.stackexchange.com/questions/181177/apache-httpd-cannot-parse-php-on-centos-7

  • Thank you for the quick response.  However I have read and seen the suggestions you have sent in previous posts.  My initial post states:

    SELinux is off.
    I am running a stock http config. Most importantly I have another php5 application that works correctly.  The URL you reference is good but is not relevant given my other php5 applications work correctly.

    I do not have a .htaccess file
    I provided information that the directories are owned by the web server.

    I am not trying to be argumentative.  My point is I (think I) checked all the above suggestions before posting my request.  I attempted to demonstrate with the data that I checked this information (and maybe missed something) in my original post.  I neglected to include the following stock/standard include files which demonstrate that the information suggested in the URL you provided has been accomplished.

    # grep -vP "^\s*$|^\s*#" conf.modules.d/00-mpm.conf conf.modules.d/10-php.conf conf.d/php*
    conf.modules.d/00-mpm.conf:LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
    conf.modules.d/10-php.conf:<IfModule prefork.c>
    conf.modules.d/10-php.conf:  LoadModule php5_module modules/libphp5.so
    conf.modules.d/10-php.conf:</IfModule>
    conf.d/php-cgi.conf:ScriptAlias /local-bin /usr/bin
    conf.d/php-cgi.conf:AddHandler application/x-httpd-php5 php
    conf.d/php-cgi.conf:AddHandler php5-script .php
    conf.d/php-cgi.conf:Action application/x-httpd-php5 /local-bin/php-cgi
    conf.d/php.conf:<FilesMatch \.php$>
    conf.d/php.conf:    SetHandler application/x-httpd-php
    conf.d/php.conf:</FilesMatch>
    conf.d/php.conf:AddType text/html .php
    conf.d/php.conf:DirectoryIndex index.php
    conf.d/php.conf:php_value session.save_handler "files"
    conf.d/php.conf:php_value session.save_path    "/var/lib/php/session"

    # ls -l /var/lib/php/
    drwxrwx---. 2 root apache 4096 May 12 09:49 session

    # find /var/www/osticket/ ! -user apache -group apache
    (No results)

    The positive search shows all the files.  Apache can access all the files in the docroot for this VH.

    Lastly, I have put the simple "phpinfo" page/script inplace of index.php for testing and it works.  Typical apache/php5 is correct.
    <html>
     <head>
      <title>PHP Test</title>
     </head>
     <body>
     <?php echo '<p>Hello World</p>'; phpinfo(); ?>
     </body>
    </html>
     
    Based on what I have already posted, I "THINK" is have checked everything you have suggested.

    Can you please provide some more suggestions to the cause of this problem?
  • Issue Solved-

    The download bundle is like build on a non-*nix host.  As such, when unzipping the download bundle, the file do not have any attributes.  Although the sub directories get attributes, the files do not.

    A simple 'chmod' will do the trick:

    find <unzip_root> -type -f -exec chmod -u+r -g+r {} \;
    or
    chmod -R -u+r -g+r <unzip_root>

    Developers: please update if the attributes are not as desired.
  • Great, I'm glad that you solved your problem.  :)

    I'll mark this thread resolved and close it.  If you have any other issues, questions, concerns, queries, etc please do not hesitate to start a new thread.
This discussion has been closed.