Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
content:apache_phpfpm [2022/11/22 20:17] – [Install MariaDB (MySql)] Danielcontent:apache_phpfpm [2023/10/01 10:24] (aktuell) – [Apache PHP- FPM- Serverguide] Daniel
Zeile 1: Zeile 1:
 ====== Apache PHP- FPM- Serverguide ====== ====== Apache PHP- FPM- Serverguide ======
 +
 +Note: The here explained way of setting up a webserver is very performant plus very slim and basic and may still be a very good way if your machine is old and/or your ressources are low and you want to deliver solid, fast and small services based on native distribution- liked builds. But it needs some manual maintanance and a well working, full featured Linux- Distribution, delivering all those Services (Apache, php, fpm, mysql) as binary build packages. As complexity raises and more services are build up on that server, you may run into high maintainance loads and the need to spend a lot of time to configure more and more services always having the complexity in mind.
 +
 +For example: if you want to make those Services available on the internet, you should definitively want to make webservices SSL- secured. Getting automatic SSL- Certificates and renew them in a good way, will work if you know how to set it up, but the setup is just another thing to care about.
 +
 +So nowadays there are solutions to make complexity for that more handy which would be e.g. using Docker or Podman - which would be another, very different approach for large system, delivering a full, extremly powerful service- infrastructure in a pre- build way (it also delivers apache with php-fpm and automatic ssl-acme-challanges out of the box in many packages!).
 +
 +So if you plan to set up a new fully flagged Server which will have many needed services, don't use this setup. Just after installation go straight into installing and setting up e.g. Docker and go on and use it for all services you can find there.
 +
 +So this for me is deprecated as i bought a new server here. I won't spend any time here. If you wann know more about nowadays setups, feel free and write a mail to me, maybe i will deliver docs to this than. HF and GL obel1x
 +
  
 ===== Howto setup a LAMP-Server in 2018 - 2020+ ===== ===== Howto setup a LAMP-Server in 2018 - 2020+ =====
Zeile 59: Zeile 70:
  
 In OpenSuSE MariaDB is available and working out of the Box. Check with: In OpenSuSE MariaDB is available and working out of the Box. Check with:
- 
 <code> <code>
 +
 sudo zypper install mariadb sudo zypper install mariadb
  
Zeile 96: Zeile 107:
  
 To setup passwords, run /usr/bin/mysql_secure_installation as root on the system. To setup passwords, run /usr/bin/mysql_secure_installation as root on the system.
- 
  
 ==== Install Apache ==== ==== Install Apache ====
Zeile 150: Zeile 160:
  
 </code> </code>
 +
 If thats fine, please stop apache once again to configure php-fpm first. If thats fine, please stop apache once again to configure php-fpm first.
  
Zeile 230: Zeile 241:
 ==== About PHP- Modules ==== ==== About PHP- Modules ====
  
-many modules for PHP are offered in the Distrubution. I **would not recommend using those**  - as all php-modules need to be compiled against your php. If you update PHP and your modules are the same, they may brake your PHP!+many modules for PHP are offered in the Distrubution. I **would not recommend using those**  - as all php-modules need to be compiled against your php. If you update PHP and your modules are not copiled to that version, they may brake your PHP!
  
 Better use pearl / pecl and install modules with it! Here, i have found no other way, than to search for php-pear and php-pecl in the distribution and use them. Better use pearl / pecl and install modules with it! Here, i have found no other way, than to search for php-pear and php-pecl in the distribution and use them.
Zeile 238: Zeile 249:
 Which can be found in the Repo: [[https://build.opensuse.org/project/show/devel:languages:php|https://build.opensuse.org/project/show/devel:languages:php]] Which can be found in the Repo: [[https://build.opensuse.org/project/show/devel:languages:php|https://build.opensuse.org/project/show/devel:languages:php]]
  
-After that, modules can be installed by e.g. "pecl install imagick". They also need to be loaded in php.conf. I would make an new config named /etc/php8/conf.d/pear_pecl.ini and include the modules there. E.g. "extension=imagick.so"+After that, modules can be installed by e.g. "pecl install imagick". They also need to be loaded in php.conf. I would make an new config named e.g. /etc/php8/conf.d/pear_pecl.ini and include the modules there. E.g. "extension=imagick.so" 
 + 
 +To make pecl/paer alter the ini automagically, use e.g. 
 +<code> 
 + 
 +pear config-set php_ini /etc/php8/conf.d/pear_pecl.ini 
 +pecl config-set php_ini /etc/php8/conf.d/pear_pecl.ini 
 + 
 +</code>
  
 Restart php-fpm for the changes and check the log of php-fpm (usually in /var/log/php-fpm.log) for errors when loading modules. Restart php-fpm for the changes and check the log of php-fpm (usually in /var/log/php-fpm.log) for errors when loading modules.
Zeile 249: Zeile 268:
  
   * To enable this and all its dependencies, use   * To enable this and all its dependencies, use
-<code> 
  
 +<code>
 sudo a2enmod setenvif sudo a2enmod setenvif
 sudo a2enmod rewrite sudo a2enmod rewrite
Zeile 324: Zeile 343:
 This should give you the complete Info of your php-configuration. If something fails, check if the above services are started an/or the logfiles. This should give you the complete Info of your php-configuration. If something fails, check if the above services are started an/or the logfiles.
  
-If you get Permission denied even if your file is world- readable and the user wwwrun can access the content, in Leap 15.4 there are strict permissions in AppArmor. So check Yast / AppArmor and Check the Protocols. You will most likely find entries that needs to be changed. After that, Access should work.+If you get Permission denied even if your file is world- readable and the user wwwrun can access the content, in Leap 15.4 there are strict permissions in AppArmor. So check Yast / AppArmor and Check the Protocols. You will most likely find entries that needs to be changed (affects also: executing programs with proc_open() in php). After that, Access should work.
  
 In Production, you should not run a plain http-server, but switch to SSL. Therefore, you can get ssl-certificates from let's encrypt and follow the instructions there to switch to ssl. You need some internet Name like [[http://www.myname.com|www.myname.com]] registered for your server to get this (e.g. via Dyndns). The process to make your server visible is something to be explained a bit more, but thats basically what you need to do (official internet-name/DNS- entry and ssl-encryption). as long as you don't want to make the server world-reachable and use it nly fr testing, your are also fine without DNS and SSL, but you should make sure, that your firewall blocks http(80) and https(443)-ports. In Production, you should not run a plain http-server, but switch to SSL. Therefore, you can get ssl-certificates from let's encrypt and follow the instructions there to switch to ssl. You need some internet Name like [[http://www.myname.com|www.myname.com]] registered for your server to get this (e.g. via Dyndns). The process to make your server visible is something to be explained a bit more, but thats basically what you need to do (official internet-name/DNS- entry and ssl-encryption). as long as you don't want to make the server world-reachable and use it nly fr testing, your are also fine without DNS and SSL, but you should make sure, that your firewall blocks http(80) and https(443)-ports.
  
 Well: You are done. Now its up to you to fill Apache with content. Have fun! Well: You are done. Now its up to you to fill Apache with content. Have fun!
- 
  
 ==== Manage Database with phpMyAdmin ==== ==== Manage Database with phpMyAdmin ====
  
-To manage your local Database, it would be nice to have phpMyAdmin installed first (via Package-manager). After that, copy the config.sample.inc.php to config.inc.php under /srv/www/htdocs/phpMyAdmin to use the socket +To manage your local Database, it would be nice to have phpMyAdmin installed first (via Package-manager). After that, copy the config.sample.inc.php to config.inc.php under /srv/www/htdocs/phpMyAdmin to use the socket /run/mysql/mysql.sock you specified before for mysql.
- <font inherit/monospace;;inherit;;#000000background-color:#ffffff;>/run/mysql/mysql.sock</font>  you specified before for mysql.+
  
 You can finish the setup of your phpMyAdmin by visiting [[http://localhost/phpMyAdmin/index.php|http://localhost/phpMyAdmin/index.php]] You can finish the setup of your phpMyAdmin by visiting [[http://localhost/phpMyAdmin/index.php|http://localhost/phpMyAdmin/index.php]]
 +
 +Hint: phpMyAdmin in Opensuse seems to be reduced in functionality. For example generating config.inc.php with [[http://localhost/phpMyAdmin/setup/|http://localhost/phpMyAdmin/setup/]] will not work. I would recommend to delete contents of /usr/share/phpMyAdmin/ and download a full version here: [[https://www.phpmyadmin.net/downloads/|https://www.phpmyadmin.net/downloads/]]
  
 ==== About security of your WEB- Page (Scripts) ==== ==== About security of your WEB- Page (Scripts) ====
Zeile 389: Zeile 408:
 As Database you can create a new user (e.g. named ep3) with corresponid database and fill the configuration to fit. As Database you can create a new user (e.g. named ep3) with corresponid database and fill the configuration to fit.
  
-After that, your testinstallation should work already.+==== Using Eclipse to work on that Project ==== 
 + 
 +In Eclipse now add a project and use GIT smart import from that directory location - it should configure git and eclipse + php the right way and you should be ready to go programming! 
 + 
 +==== Setup Debugging of PHP ==== 
 + 
 +To setup Debugging of codeinstall xdebug for php via pecl: 
 +<code> 
 + 
 +pecl install xdebug 
 + 
 +</code> 
 + 
 +Now, also add 
 + 
 +<file> 
 +xdebug.mode=debug 
 + 
 +</file> 
 + 
 +Now restart php-fpm and check the php_info() if xdebug is enabled and if Step debugging is active. Otherwise check logs. 
 + 
 +Adjusting timeouts in apache fcgi: Add Timeouts to /etc/apache2/conf.d/mod_proxy_fcgi.conf of apache: 
 + 
 +<code> 
 +... 
 + Timeout 600 
 + ProxyTimeout 600 
 +... 
 + 
 +</code> 
 + 
 +And of course restart apache2. 
 + 
 +==== Setup of Eclipse ==== 
 + 
 +You need to add the PHP- Environement and the Debugger in Eclipse. 
 + 
 +{{.:apache_phpfpm_20221123-104346.png}} 
 + 
 +and 
 + 
 +{{.:apache_phpfpm_20221123-104629.png}} 
 + 
 +Mind to use the Port phpinfo tells you. Thats it start debugging with e.g. index.php of the project: 
 + 
 +{{.:apache_phpfpm_20221123-105037.png}} 
 + 
 +That should fire up the Browser, connect php in debugging to eclipse and break at the first line. 
 + 
 +You can walk through the code with F5 (dive into), F6 (step over) or just let the work go on with F8. 
 + 
 +You are done setting up webserver, php-fpm, mariadb and eclipse plus your new git- repositoryhafe fun!
  
  
  • content/apache_phpfpm.1669148236.txt.gz
  • Zuletzt geändert: 2022/11/22 20:17
  • von Daniel