You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Marc Chamberlin <ma...@marcchamberlin.com> on 2019/04/16 22:28:15 UTC

[users@httpd] Need help getting php7 working..

Hello - I guess I need to appeal to some kind gurus for help, I've been
racking my brains out trying to get PHP scripts working under Apache2
and just not getting any traction... I am running the following Apache2
server -

> httpd -v
> Server version: Apache/2.4.33 (Linux/SUSE)
> Server built:   2019-03-25 13:11:14.000000000 +0000

which supports a number of virtual hosts. I need to be able to get the
server to support PHP scripts so as to run applications like WordPress
and phpMyAdmin amongst others. Towards this goal I am trying to setup
php-fpm and I have been trying to follow the instructions at

> https://wiki.apache.org/httpd/PHP-FPM
At the moment I do have the php-fpm service up an running. I did not
change any of the configuration files for the service, I just left them
in the default setup as distributed by OpenSuSE. (I didn't see anything
that needed to be changed, but I can post them if that will be helpful.)
The log files for php-fpm does not seem to show much -

> quasar:/var/log # more php-fpm.log
> [16-Apr-2019 09:40:45] NOTICE: fpm is running, pid 15415
> [16-Apr-2019 09:40:45] NOTICE: ready to handle connections
> [16-Apr-2019 09:40:45] NOTICE: systemd monitor interval set to 10000ms

As for Apache2, these are the modules I have loaded -

> quasar:/srv/apache # apachectl -M
> Loaded Modules:
>  core_module (static)
>  so_module (static)
>  http_module (static)
>  mpm_prefork_module (static)
>  unixd_module (static)
>  systemd_module (static)
>  actions_module (shared)
>  alias_module (shared)
>  auth_basic_module (shared)
>  authn_core_module (shared)
>  authn_file_module (shared)
>  authz_host_module (shared)
>  authz_groupfile_module (shared)
>  authz_core_module (shared)
>  authz_user_module (shared)
>  autoindex_module (shared)
>  cgi_module (shared)
>  dir_module (shared)
>  env_module (shared)
>  expires_module (shared)
>  include_module (shared)
>  log_config_module (shared)
>  mime_module (shared)
>  negotiation_module (shared)
>  proxy_module (shared)
>  proxy_html_module (shared)
>  proxy_http_module (shared)
>  setenvif_module (shared)
>  ssl_module (shared)
>  socache_shmcb_module (shared)
>  userdir_module (shared)
>  reqtimeout_module (shared)
>  jk_module (shared)
>  rewrite_module (shared)
>  headers_module (shared)
>  substitute_module (shared)
>  filter_module (shared)
>  xml2enc_module (shared)
>  version_module (shared)
>  php7_module (shared)
>  proxy_fcgi_module (shared)

My vhost.conf file looks something like this -

> <VirtualHost *:80>
>     ServerAdmin user@mydomain.com
>     ServerName www.mydomain.com
>     ServerAlias mydomain.com
>
>     DocumentRoot "/websites/home/user/mydomain.com"
>     ErrorLog "/var/log/apache2/mydomain.com-error_log"
>     TransferLog "/var/log/apache2/mydomain.com-access_log"
>     HostnameLookups Off
>     UseCanonicalName Off
>     ServerSignature On
>     Include /etc/apache2/conf.d/*.conf
>     Alias / /websites/home/user/mydomain.com/
>
>     ProxyPassMatch ^/(.*\.php(/.*)?)$
> fcgi://127.0.0.1:9000/websites/home/user/mydomain.com/$1
>
>     <IfModule mod_jk.c>
>       JkAutoAlias /websites/home/user/mydomain.com
>       JkMount / tomcatWorker1
>       JkMount /* tomcatWorker1
>       JkUnMount /*.html tomcatWorker1
>       JkUnMount /*.css tomcatWorker1
>       JkUnMount /*.js tomcatWorker1
>       JkUnMount /*.jpg  tomcatWorker1
>       JkUnMount /*.png  tomcatWorker1
>       JkUnMount /*.gif  tomcatWorker1
>       JkUnMount /*.php  tomcatWorker1
>     </IfModule>
>
>     ScriptAlias /cgi-bin/ "/websites/home/user/mydomain.com/cgi-bin/"
>     <Directory "/websites/home/user/mydomain.com/cgi-bin">
>     AllowOverride None
>     Options +ExecCGI -Includes
>         <IfModule !mod_access_compat.c>
>               Require all granted
>         </IfModule>
>         <IfModule mod_access_compat.c>
>         Order allow,deny
>         Allow from all
>     </IfModule>
>     </Directory>
>
>     <IfModule mod_userdir.c>
>     UserDir public_html
>     Include /etc/apache2/mod_userdir.conf
>     </IfModule>
>
>     <Directory "/websites/home/user/mydomain.com">
>     Options Indexes FollowSymLinks
>         DirectoryIndex /index.php index.php index.html
>     AllowOverride None
>     <IfModule !mod_access_compat.c>
>         Require all granted
>     </IfModule>
>     <IfModule mod_access_compat.c>
>         Order allow,deny
>         Allow from all
>     </IfModule>
>     </Directory>
>
> </VirtualHost>
>
This is some extra info (for example I am linked to a Tomcat server to
handle JSP documents.) but I am striving to be complete and clear. If I
try an invoke a url directly on a php file, for example
http://mydomain.com/test.php I will get a "File not found" error. If I
try an invoke a url on a directory containing an index.php file, I get a
listing of the directory. When I try to access a .php file directly the
vhost log file displays this error message -

> mydomain.com-error_log
> [Tue Apr 16 15:21:28.961374 2019] [proxy_fcgi:error] [pid 6651]
> [client 192.168.10.10:39940] AH01071: Got error 'Primary script unknown\n'

I will be more than happy to share any additional information, just tell
me what to do and how... Much appreciate any help getting PHP files
working, I fear my Googling research is getting close to exhaustion! ;-)

    Marc...


-- 
<b>Computers: the final frontier. These are the voyages of the user Marc.<br> 
His mission: to explore strange new hardware. To seek out new software and new applications.<br> 
To boldly go where no Marc has gone before!<br></b>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org