Setting up LAMP with CentOS 6.x - php

I am having errors setting up my webserver on my vps. At the moment I have followed this tutorial: https://www.howtoforge.com/apache_php_mysql_on_centos_6.5_lamp
I am stuck on the /etc/init.d/httpd start part. When I run this command, I get the following output:
[root#localhost conf]# service httpd restart
Stopping httpd: [FAILED]
Starting httpd: [Mon Feb 23 21:27:02 2015] [warn] NameVirtualHost *:80 has no VirtualHosts
[FAILED]
And there is no more output. Prior to this I was getting this error:
[root#localhost etc]# /etc/init.d/httpd start
Starting httpd: httpd: Could not reliably determine the server's fully
qualified domain name, using localhost.localdomain for ServerName [FAILED]
I googled and managed to get this error to disappear by editting /etc/httpd/conf/httpd.conf - I simply uncommented the ServerName variable and changed the value to localhost. So it looks like:
ServerName localhost - In my mind this makes sense since localhost is the external ip server anyways. [NOTE]: Even if I change it to ServerName <external-ip> I still get the same output when restarting httpd.
Can anyone help me get past this step? I've been googling for about 1-2 hours. Can't find anything. Anyone had the same error and mind pointing me in the right direction?
UPDATE 1:
cat /var/log/httpd/error_log
The output is basically normally operation until it reaches this point at which it just spams the rest of the log with it
(2)No such file or directory: httpd: could not open error log file
/srv/www/java-applet/logs/error.log - Unable to open logs
So I guess the error occurs since it cannot find the specified log file? Where can I change this? Why is this even occurring if I have a default installation of httpd?
Update 2:
Nevermind, I just solved it by making the directory that it said it was missing. Lame...

Related

After restart of apache server, php script no longer works

after (just) restarting my apache server, which runs a php script,
the website no more works.
I can see the landing page, and that's it.
(cannot click buttons, no reaction, no backend entrance..)
I have checked log files of server:
Everything is ok & working.
I have checked log files of apache, and got these errors:
HTTPD
The timeout specified has expired:
[client 2.247.241.109:11131] AH01075: Error dispatching request to : (polling), referer: (ip of my server)
Do you know what is going on?
I guessed that apache won't execute php (script) any more, is that correct?
Or is it something different?
Big thanks to anyone who can help me out.
Try the following:
service httpd restart
systemctl restart httpd
Make sure no rerwite rules are added in the .htaccess file.

Apache / PHP-FPM with dedicated error log file per host

I'm running php7.2-fpm with apache 2.4.29 on Ubuntu Server 18.04 LTS.
I'm unable to set a specific php error log file per host (as I normally do with php with apache pre-fork).
On apache host conf file I set my custom error log path:
ErrorLog /var/www/server_logs/myhost_error.log
LogLevel warn
But that file is empty
Looking at /etc/php/7.2/fpm/php-fpm.conf I saw that error log file is set to /var/log/php7.2-fpm.log and error level is enable and set to notice.
On my php project base path I put .user.ini containing
display_errors=on
display_startup_errors=on
error_reporting=E_ALL
html_errors=on
On my php project I generate a WARNING: I see it on screen but never get logged in my apache custom log error file nor in /var/log/php7.2-fpm.log
In /var/log/php7.2-fpm.log I only see
[17-Oct-2019 16:01:44] NOTICE: fpm is running, pid 25328
[17-Oct-2019 16:01:44] NOTICE: ready to handle connections
[17-Oct-2019 16:01:44] NOTICE: systemd monitor interval set to 10000ms
but no errors logged!
I cannot understand what I missed!
Anyone could help me please?

Could not reliably determine the server's fully qualified domain name for MacBook

First time got a new MBP 2016. Trying to setup PHP,MySQL & Apache. Started Apache by using command
sudo apachectl restart
Then installed PHP by
brew install php71 --with-httpd24
Also did following changes...
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
DirectoryIndex index.html index.php
SetHandler application/x-httpd-php
ServerName dev-server
Also, updated the same in host file /etc/hosts/
But, whenever I'm trying to Stop/Restart my apache by using command sudo apachectl restart or sudo apachectl stop I'm getting following errors.
AH00557: httpd: apr_sockaddr_info_get() failed for Sureshs-MacBook-Pro.local
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
httpd not running, trying to start
But, strangely when I'm executing any PHP file from my browser http://localhost/index.php it's working fine. As in my index.php file I'm using code <?php phpinfo(); ?> It's showing PHP version PHP Version 7.1.4 loaded.
Tried a lot but no clude what's going wrong at where.
---UPDATE---
After updating 127.0.0.1 Sureshs-MacBook-Pro.local in my /private/etc/hosts file, one error solved. Now I'm getting only one below error.
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using Sureshs-MacBook-Pro.local. Set the 'ServerName' directive globally to suppress this message
Finally, I solved this by updating ServerName localhost:8080 on file /usr/local/etc/apache2/2.4/httpd.conf. It was a differnt httpd.conf file which I didn't knew about it.
Also, for Apache start/restart/stop following command sudo /usr/sbin/apachectl start works for me.
As per message:
Set the 'ServerName' directive globally to suppress this message.
You need to identify httpd.conf Apache configuration file by:
apachectl -t -D DUMP_INCLUDES
then edit it and uncomment the line with ServerName (make sure it has the valid server name). E.g.
ServerName localhost
open file httpd.conf
vi /etc/httpd/conf/httpd.conf
add to first line
ServerName localhost
systemctl restart httpd
I resolved this issue changing the port address in the httpd.conf file in windows.
This problem arises due to the port already listening, which we use in the conf file.
To view the port listening, use the command "netview /a"
if the port used in the conf file already listening, change to different one(e.g, 8080)
set servername to "localhost" or 127.0.0.1
Now start the apache server "httpd.exe -k start"
it will work fine.
On macOS Catalina...
Edit the Apache config file
sudo vi /etc/apache2/httpd.conf
Find the ServerName entry by typing a / followed by ServerName and hit enter
Press n to go to the next occurrence until you are on #ServerName www.example.com:80 (keep pressing n if you go past it)
Add a newline by typing an o
Type the following: ServerName localhost
Save and exit by typing !wq then hit enter (or type ZZ which is capital Z twice)
Restart Apache
sudo apachectl restart

PHPMyadmin HTTP 500 after PHP 5.6 upgrade

I am in need of assistance. I am unable to access phpMyAdmin on my DO VPS after just recently upgrading the system to PHP5.6. I have done a lot of research over the past few day but to no avail. I want to list out everything that I have to do to see if anybody has any words of wisdom. The most recent this I attempted I found in this SO Answer
Internal server error (HTTP Error 500) after installing phpmyadmin on a certain domain
I checked my Apache Logs and this line stood out
[Tue Nov 29 02:42:20.684526 2016] [:error] [pid 12443] [client 66.169.11.19:56234] PHP Fatal error: require_once(): Failed opening required './libraries/php-gettext/gettext.inc' (include_path='.') in /usr/share/phpmyadmin/libraries/select_lang.lib.php on line 395
So I did the following:
sudo apt-get install php5.6-gettext
And received the following response
Note, selecting 'php5.6-common' instead of 'php5.6-gettext'
php5.6-common is already the newest version.
php5.6-common set to manually installed.
I would like to point out an oddity that may assist.
Everytime I restart Apache I get this Warning:
[Tue Nov 29 02:42:11.553293 2016] [so:warn] [pid 12438] AH01574: module php5_module is already loaded, skipping
Can anybody assist me with this?
Here is my Vhost for phpMyAdmin
<VirtualHost *:80>
ServerAdmin admin#localhost
DocumentRoot "/usr/share/phpmyadmin"
ServerName pma.example.net
ErrorLog "/var/log/pma-error.log"
CustomLog "/var/log/pma-access.log" combined
<Directory "/usr/share/phpmyadmin">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Not only am I unable to access at the sub domain that I have set up I am also unable to access it from [Server IP Address]/phpmyadmin
I receive an HTTP 500.
Thank you.
One thing that may solve the problem is to remove PHPMyAdmin, and reinstall it.
sudo apt-get remove phpmyadmin
sudo apt-get install phpmyadmin
By doing this, you'll give Ubuntu a chance to install the appropriate dependencies for phpmyadmin. Chances are, this will configure your packages in further ways that just installing a newer PHP version doesn't.
I think you should run http://pma.example.net
And restarted Apache:
sudo service apache2 restart

Apache 2.4 Error: FCGI: attempt to connect to Unix domain socket /run/php/php7.0-fpm.sock (*) failed

I have updated my working Froxlor installation to PHP 7.
All my customer-sites work perfectly fine (with PHP 7 via FPM).
The only problem is, that if I want to access the Froxlor Backend, I get an Erorr 503.
The apache Error-Log says:
`[Tue Oct 11 10:01:04.067069 2016] [proxy:error] [pid 23949] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /run/php/php7.0-fpm.sock (*) failed`
`[Tue Oct 11 10:01:04.089648 2016] [proxy_fcgi:error] [pid 23949] [client xx.xx.xx.xx:1819] AH01079: failed to make connection to backend: httpd-UDS`
The Error-Log of PHP-FPM says nothing.
The same thing happens, if I try to access the server directly via IP.
System-Details:
Debian 8
Apache 2.4
PHP7
PHP7-FPM
Where I have to serach for the Problem? If needed, config-files can be provided.
If you are using PHP-FPM, the problem may also be that you need to start the PHP service.
Apache does not automatically stop the process, so you will either manually start it up or automatically on startup
For PHP 7.x (remember to include your version):
service php7.x-fpm start
For PHP 7:
service php7-fpm start
For PHP 5:
service php-fpm start
This will begin the FPM process for you.
Additionally, you may also want the process to startup on boot. To do that simply enter the following, of course considering your respective version.
systemctl enable php7.x-fpm
I had same issue, on New server having php7.4 and these virtual host configuration files(located in /etc/apache2/sites-available/ directory) i migrated from server having php7.2.
When checked in detail i found
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php7.2-fpm.sock|fcgi://localhost/"
</FilesMatch>
Which then i replaced with
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhost/"
</FilesMatch>
Basically updating php version and it worked fine after restarting apache2
Steps I made in order to make it work on my host:
in /etc/apt/sources.list - added non-free to debian repository
apt update
apt install libapache2-mod-fastcgi
a2enmod fastcgi
(That made the "Invalid command 'FastCgiExternalServer' error, I encountered on a new installation", go away).
In Froxlor - "Settings" - "Froxlor VirtualHost settings":
[X] Enable PHP-FPM for the Froxlor vHost If enabled, Froxlor will also be running under a local user.
I also removed all "Listen" entries from apache2's ports.conf

Categories