kasparsd / php-7-debian

Install PHP 7 on Debian/Ubuntu
349 stars 103 forks source link

How to set this up with apache #65

Closed b3wii closed 5 years ago

b3wii commented 6 years ago

I have apache2 running, build and installed php7 cli and fpm. When i open a php page apache renders the code as text. How do i tell apache to use the newly installed php7? I'm on Wheezy btw.

Ken-vdE commented 5 years ago

I have apache2 running, build and installed php7 cli and fpm. When i open a php page apache renders the code as text. How do i tell apache to use the newly installed php7? I'm on Wheezy btw.

Same issue here, using Debian 7 Wheezy. Did you, or anyone, ever resolve this?

kasparsd commented 5 years ago

@b3wii, @Ken-vdE See #9 and #49 for links and suggestions.

Ken-vdE commented 5 years ago

@b3wii, @Ken-vdE See #9 and #49 for links and suggestions.

Unfortunately not, everything seems installed and working... I've restarted all the important services and apache2 is still serving out php files as plain text. I already checked if I was using <?php instead of <?. Furthermore I am able to php -v, everything should work, it just doesn't...

kasparsd commented 5 years ago

apache2 is still serving out php files as plain text

It probably means that Apache isn't passing the file through the FPM processing.

Did you adjust the listen directive in /usr/local/php7/etc/php-fpm.d/www.conf to use an FPM socket listen = /run/php/php-fpm.sock instead of a network port per this comment?

Ken-vdE commented 5 years ago

apache2 is still serving out php files as plain text

It probably means that Apache isn't passing the file through the FPM processing.

Did you adjust the listen directive in /usr/local/php7/etc/php-fpm.d/www.conf to use an FPM socket listen = /run/php/php-fpm.sock instead of a network port per this comment?

I did now, it does not seem to work. If you want to reproduce the issue you can take the following steps:

  1. Install Vagrant & VirtualBox
  2. Run vagrant box add debian/wheezy64 in console
  3. vagrant init debian/wheezy64 in a folder with a php file
  4. set the Vagrantfile to contain

    • config.vm.box = "debian/wheezy64"
    • config.vm.network "forwarded_port", guest: 80, host: 8080
    • and:
      
      config.vm.provision "shell", inline: <<-SHELL
      set -x
      # use the google dns because of error when resolving domain security.debian.org
      echo -e "domain nice.lan\nsearch nice.lan\nnameserver 8.8.8.8\nnameserver 8.8.4.4\nnamerserver 10.0.2.3" > /etc/resolv.conf
      apt-get install -y git apache2 curl
      cd /tmp
      git clone https://github.com/kasparsd/php-7-debian.git
      cd php-7-debian/
      ./build.sh
      ./install.sh

    apt-get -y update && apt-get -y upgrade if ! [ -L /var/www ]; then rm -rf /var/www ln -fs /vagrant /var/www fi SHELL

  5. Visit localhost:8080 or localhost:8080/your-php-file.php and it serves the php content as plain text