Deploy Docker PHP-FPM with Apache on Host (Windows) Giving 404 - php

I have apache installed on my windows machine with locally installed PHP 8 on it. now for a single project I need 5.6 (don't blame me customer is not ready to move on). So I install a php-fpm-alpine docker on my machine and configure the .htaccess in my project folder to attach to that fpm.
It works in sense that I can see all request been logged in my Docker Log, but it is not finding the file. and hence cannnot execute it.
my apache configuration is simple.
<FilesMatch \.php$>
SetHandler "proxy:fcgi://localhost:9000/www/var/html$1"
</FilesMatch>
my docker gives 2 option to set /var/www/html to my windows folder that I configure correctly as I can go in command line of docker and can do ls /var/www/html and it shows all project file with www-data user fine. and port is working too.
I believe the PHP-fpm is not using the folder define by /var/www/html properly and looking somewhere else but I have no idea where to check.

Related

Sethandler fcgi proxy not working on Ubuntu 14.04/Apache 2.4.7 php7.2-fpm

I need to run PHP 5.6 with mod_php and PHP 7.2 with php-fpm/mod-fastcgi parallel on a Ubuntu 14.04 machine.
On a different machine with Ubuntu 16.04, Apache 2.4 and PHP 7.1/mod_php and PHP 7.2/php-fpm everything works as expected.
My steps:
apt install libapache2-mod-fastcgi php7.2-fpm php7.2 php7.2-common
a2enmod actions fastcgi alias proxy_fcgi
I set up an fpm conf file with a different pool name, username and group, socket file /var/run/php/php7.2-fpm-mysite.sock.
Service php7.2-fpm is started and the socket file is created.
Docroot owner for the virtual host is set to the username and group given in the fmp conf file.
I added the follwoing lines to the virtual host:
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php/php7.2-fpm-mysite.sock|fcgi://localhost/"
</FilesMatch>
On the Ubuntu 16.04 machine, everything works fine. The one virtual host is using php-fpm 7.2, all other sites are still using the php_mod 7.1.
Then I repeated all these steps on the Ubuntu 14.04 machine. I had no errors, but when browsing a web page, the PHP code is printed in plain.
The proxy is not working obviously, but I have no idea why. Socket file is created, no errors in php-fpm log.
All other pages on the Ubuntu 14.04 machine with mod_php 5.6 are working as expected.
Thanks in advance for any help. I can provide more config if needed.
Best regards
Matthias
I got it. Because Apache 2.4.7 does not support socket file, I had to use ProxyPassMatch

Vagrant phpmyadmin php show as plain text issue

I'm having some issues with phpmyadmin that i installed on a virtual machine using vagrant. I downloaded the vagrant file from puphpet it's a Centos with php, mysql, nodejs, and apache.
Default installation works fine, already edited my vhost file on my local machine to access centos /var/www folder and php it's working there, but phpmyadmin folder it's showing plain text rather than executing the php code of the index.php, the weird thing is that only phpmyadmin is not executing php code.
My local setup is Mac OS X el capitan, my vhost cents.dev point to /var/www folder.
Couldn't find any solution online.
I installed phpmyadmin using yum command, then made a link in my /var/www folder, that didn't work, the moved the phpmyadmin folder to /var/www and still doesn't work
phpinfo is:
Linux local.puphpet 2.6.32-504.8.1.el6.x86_64
Server API FPM/FastCGI
PHP 5.6.15 (cli)
PhpMyAdmin uses shorttags for php (<? instead of <?php).
Edit your php.ini to support that.
short_open_tag = On
And then restart your webserver
sudo service apache2 restart

Configure PHP bundled with MAC OS

I want to run my php applications using php bundled with MAC os. I have done some changes and after that i have started my apache server using
sudo apachectl
restart and running localhost now shows pages available at
/Library/WebServer/Documents/index.html.en
where should i keep my custom php application so that it can be viewable by browser on localhost.
Use a Symlink to have a more easily accessible path:
ln -s /Users/NewBee/Desktop/mycustomappinanaccessibleplace /Library/WebServer/Documents/my_app
You may run into permissions problems, make sure you account for that by ensuring the apache user can access the files and symlink.
Your other option is to change the DocumentRoot in your httpd.conf file.

How do I access phpMyAdmin?

I installed phpMyAdmin on my computer. I used Apache as my http server. However, every time I go to http://localhost/phpMyAdmin/, this screen appears:
How do I make it so that this login screen appears instead:
You may be better off to install an integrated suite, such as:
XAMPP - Linux/Windows/Apple
* store web pages in htdocs
WAMP - Windows
MAMP - Apple
Then, just going to the address localhost will give you a menu, with all components (apache, phpmyadmin, tomcat, etc etc)
They are all free, so why not?
Add this
DirectoryIndex index.php
to /etc/phpmyadmin/apache.conf (or wherever your apache.conf or httpd.conf or whatever is).
If you happen to be running on Windows, look for the Apache webserver directory.
XAMPP Users: If you have installed it as a service, changes to configuration files seem to take effect only when you restart the service through the Services panel and not via the XAMPP control panel.
Use http://localhost/phpMyAdmin/index.php
or
Check your host config, check the DirectoryIndex param.
I found that when I entered root in the username and left the password blank I got in
You need to edit your apache2 config file to include PHPmyadmin.
Do this:
gedit /etc/apache2/apache2.conf
OR nano /etc/apache2/apache2.conf
Add this to the end of your config file:
Include /etc/phpmyadmin/apache.conf
Save then restart Apache:
/etc/init.d/apache2 restart

Trouble setting up apache on vmware

I'm trying to set up a virtual machine (vmware workstation 8.0.2) running CentOS 6.2 (i386) to mirror my live server so I can work locally. I'm running Windows 7 64bit. I have installed CentOS, PHP & MySQL they all seem to be running fine.
I now need to get it to access my files on the windows machine. I've installed the VMware tools and can now see the shared folder in /mnt/hgfs/Work/. I now need to point apache to the files here so it can use them, to do this I edited httpd.conf from:
DocumentRoot "/var/www/html"
to
DocumentRoot "/mnt/hgfs" (also tried DocumentRoot "/mnt/hgfs/Work")
when I restart apache it fails and I get:
Starting httpd: Syntax error on line 293 of /etc/httpd/conf/httpd.conf:
DocumentRoot must be a directory
I've used Linux, but not very often so it's probably something obvious I've missed, I'd really appreciate any help on this.
Check that you are not having trouble with SELinux, which is enforcing by default on CentOS 6.
You can either disable it by editing /etc/selinux/config or read up on it here
http://rackerhacker.com/2012/01/25/getting-started-with-selinux/

Categories