Hide PHP and apache version when inspecting - php

In a website made with Wordpress, I'm trying to find out how I hide the version of PHP and Apache2 when I inspect the site.
I think that should be in 000-default.conf?
I tried to use
expose_php = Off
in php.ini, but it doesn't work

Apache have /etc/apache2/conf-available/security.conf file for these configurations
You need to edit it and set
ServerTokens from OS to Prod
and
ServerSignature from On to Off
Thats the best way to do that, since this applies to all server configuration
If security conf was not enabled yet, just run ( as super user / root ) on terminal:
a2enconf secutiry; service apache2 restart

To hide the version of apache, you should add in the server configuration file:
ServerTokens Prod
ServerSignature Off

Related

XAMPP Apache Won't Start after PHP Upgrade

Apache won't start on Mac with XAMPP. I tried updating PHP from 5.5.6 to PHP 5.6.8, and since that update XAMPP wouldn't start Apache. I tried completely re-installing XAMPP, but same issue.
Help would be appreciated, I'm more than happy to post any information that is necessary, not sure where to start. I've done a lot of looking around and haven't been able to find anything that points me in the right direction - I checked the Apache error_logs and there aren't any.
Try this -
Solution#1
This solution worked perfectly fine for me..
1) Close XAMPP control
2) Open Activity Monitor(Launchpad->Other->Activity Monitor)
3) Select filter for All processes (default is My processes)
4) In fulltext search type: httpd
5) Kill all httpd items
6) Relaunch XAMPP control and launch apache again
OR, Solution#2
sudo apachectl stop
This command kills Apache server that was pre-installed on MAC OS X.
OR, Solution#3
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
This will disable OSX's built-in Apache server and allows XAMPP to start on 80.
Now once Apache starts successfully modify the .htaccess file
Apache needs to be configured to recognize index.php as an index file. While adding 'DirectoryIndex index.php' to a .htaccess file may work,
NOTE:
In general, you should never use .htaccess files
This is quoted from http://httpd.apache.org/docs/1.3/howto/htaccess.html
Although this refers to an older version of apache, I believe the principle still applies.
Adding the following to your httpd.conf (if you have access to it) is considered better form, causes less server overhead and has the exact same effect:
<Directory /myapp>
DirectoryIndex index.php
</Directory>
I've updated PHP to 8.0 in xampp by renaming old PHP folder to PHP_7.4
and new pasted new php8 folder as php folder, it gave me same error,
SOLUTION
Step1: backup old php folder,
Step2: Paste php8 files in to old PHP folder and overwrite existing files,
Done: Restart Apache it should start

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

Do I need to restart Apache after changing the php.ini file?

If I make a change to a setting in the php.ini file - do I need to restart Apache in order for it to take effect?
Depends, actually. Depends on how you use php inside that webserver:
using php as module inside the http server: you have to restart the http server process
using php as cgi backend: you do not have to restart the http server process or anything else
using php fastcgi: you have to restart the fastcgi daemon, not the http server
using php-fpm: you have to restart the fpm server process, not the http server process
On Debian 8 I had to restart PHP-FPM (and Apache)
The above answers are correct, but here are the commands so you won't have to googling them.
Restart Apache :
/etc/init.d/apache2 restart
Restart php5-fpm :
sudo service php5-fpm restart
That depends on the SAPI you're using. If you're using PHP as an Apache module for example, you need to restart apache so that the php.ini values take effect.
If you're using FCGI, you need to restart the FCGI daemon for the PHP script that you want to see the values changed. Compare with
Trouble changing upload_max_filesize on nginx
It depends on what OS and version you are running.
I am running Apache/2.4.29 under Ubuntu.
PHP Version 7.2.24.
I restart apache with the following command and the restart is needed after modifying the php.ini file:
sudo service apache2 restart
Not sure about Apache but on Windows with IIS a restart is not required.
Either way, considering the myriad of different configurations out there with PHP, an easy way to check is to load your phpinfo.php file in a browser and confirm the value of a setting, then change that setting in php.ini and reload phpinfo.php to see if it's picking up your change.
If you don't know what I mean by "phpinfo.php" check this page: https://blogtimenow.com/knowledge-base/create-phpinfo-php-file-page/

How do I disable suphp on ubuntu 10.04 server

I have put together a small ubuntu 10.04 server with apache2 and php for use only for testing purposes. I am finding suphp keeps getting in my way. Doubtless this is a useful tool for security etc, but right now, as this is only a local testing ground I would like to disable it to prevent it continually throwing errors relating to file ownership etc.
So, as the title says: How do I disable suphp on ubuntu server 10.04.
Thanks
a2dismod suphp -> to disable su php mod
instead of disabling all use virtual hosts conf file or http.conf and add
<VirtualHost ..>
suPHP_Engine off
...

Categories