Apache configuration:
RewriteEngine on
RewriteLock /var/www/lib/rewrite.lock
RewriteMap sessionValid prg:/var/www/lib/allow.php
I fixed the obvious of setting the file executable, but now it is giving this:
[Fri Feb 12 01:55:31 2010] [error] (2)No such file or directory: exec
of '/var/www/lib/allow.php' failed
But the file clearly exists.
...Forgot to make allow.php executable for the apache user.
Related
The title describes the question.
I have PHP installed, Apache, MySQL and also phpMyAdmin in the htdocs folder of Apache. I installed them separately and do not use a compilation package. I did try to create a php file with phpinfo
<?php
phpinfo();
?>
Saved the file as phpinfo.php
When going to
http://localhost
I see the phpinfo.php file listed. When I click the phpinfo.php file
I get a 404 error. There are no other files listed in the root http folder except one (phpinfo.php)
PHP was installed and php short tags are enabled
short_open_tag = On
I am not sure if it's a capital On or on
Note: I used http://www.jesterwebster.com/setting-up-a-test-bench-web-server-with-apache-php-mysql-and-more-on-windows/26 as a guide for my Apache and PHP install
I opened the error log and I found something disturbing. Not sure how to fix it
[Fri Aug 03 13:07:34 2012] [error] [client 127.0.0.1] File does not exist: C:/website/example/online/Program Files, referer: http://localhost/
[Fri Aug 03 13:09:33 2012] [error] [client 127.0.0.1] File does not exist: C:/website/example/online/Program Files, referer: http://localhost/
Per your error logs, your DocumentRoot "C:/websites/example/online" is websiteS, your error log is looking for website without the s.
Have you confirmed from apache configuration file that PHP is enabled and is configured correctly to work with apache? And has the apache server been restarted after configuration? Also Try adding an html file in the htdocs directory to confirm if the directory is correct.
Edit: Also you mentioned that error log is looking for your file in this directory
C:/website/example/online/Program Files
But you mentioned that you placed phpinfo.php in htdocs folder for apache. There might be an issue related to difference between those two paths
Currently, I am setting my local environment for a project.
Project runs on production environment with nginx server. But in the local development, using apache server. I've installed LAMP stack on my ubuntu machine. There is already a virtual host file provided and I have setup it. So far I've created xxx.conf file under /etc/apache2/sites-available.
The file includes:
<VirtualHost *:80>
ServerName xxx
DocumentRoot /home/ubuntuser/Downloads/xxx-master/public
<Directory "/home/ubuntuser/Downloads/xxx-master/public">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride all
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/xxx-error.log
CustomLog ${APACHE_LOG_DIR}/xxx-access.log combined
SetEnv ENVIRONMENT "development"
</VirtualHost>
I also created .htaccess file under /home/ubuntuser/Downloads/xxx-master/public. The content of this file downloaded from production environment.
The content of .htaccess file is:
RewriteEngine On
RewriteBase /
location ~ ^/site { rewrite ^/site(.*)$ https://local.xxx.com/$1 redirect;}
So, when I type local.xxx.com in browser, it gives 500 Internal Error.
So, I was defined xxx-error.log in virtual host config file. I've opened it. The content is:
[Tue May 28 22:23:33.231851 2019] [core:alert] [pid 5677] [client 127.0.0.1:56504] /home/ubuntuser/Downloads/xxx-master/public/.htaccess: RewriteBase takes one argument, the base URL of the per-directory context
[Tue May 28 22:23:33.254608 2019] [core:alert] [pid 5678] [client 127.0.0.1:56506] /home/ubuntuser/Downloads/xxx-master/public/.htaccess: RewriteBase takes one argument, the base URL of the per-directory context, referer: http://local.xxx.com/
[Tue May 28 22:33:22.300863 2019] [core:alert] [pid 6326] [client 127.0.0.1:56740] /home/ubuntuser/Downloads/xxx-master/public/.htaccess: Invalid command 'location', perhaps misspelled or defined by a module not included in the server configuration
[Tue May 28 22:33:22.317420 2019] [core:alert] [pid 6327] [client 127.0.0.1:56742] /home/ubuntuser/Downloads/xxx-master/public/.htaccess: Invalid command 'location', perhaps misspelled or defined by a module not included in the server configuration, referer: http://local.xxx.com/
So, I understand there is problem in the .htaccess but i don't know how to solve it.
You are using apache and in your .htaccess using the convention of Nginx.
Refer to latest documentation of apache2.4
To me it seems like you want to redirect use this
RewriteRule ^/site(.*)$ https://local.xxx.com/$1 or maybe this
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
After some struggle, I finally installed Facebook HipHop Virtual Machine in Ubuntu. It is running under FastCGI (Apache 2.22). Below, the service status:
marcelo#marcelo-VirtualBox:~$ service apache2 status
Apache2 is running (pid 3330).
marcelo#marcelo-VirtualBox:~$ service hhvm status
* hhvm is running
marcelo#marcelo-VirtualBox:~$ sudo service hhvm restart
* Restarting HHVM FastCGI Daemon hhvm [ OK ]
marcelo#marcelo-VirtualBox:~$
The same machine has PHP5 module enabled and configured in Apache.
Question:
I want to make sure that I am really rendering PHP code using HHVM and NOT Zend Framework.
All my PHP scripts are running on the webserver. But, when I disable PHP5 module using sudo a2dismod php5 the web server starts to render Internal Server Error.
Does HHVM need PHP5 module enabled to run? Supposedly, since I am using FastCGI, my answer is no. On the other hand, I think that my pages are being rendered by Zend and not HHVM.
What am I missing here? How can I make sure that I am really running HHVM? (in my mind, a clear test is to disable PHP5 module, but, as I said, when I disable, php stops working in the web browser).
If .php is not running with PHP5 module disabled does it means that my HHVM is not properly configured?
P.S.: The script that I am testing is a default Hello World example: <?php echo 'Hello World.'; ?>.
And, It works when I run from command line:
marcelo#marcelo-VirtualBox:/var/www$ sudo hhvm hello_world.php
Hello World.
marcelo#marcelo-VirtualBox:/var/www$
EDIT
Apache error.log:
marcelo#marcelo-VirtualBox:/var/log/apache2$ cat error.log
[Wed May 07 14:02:10 2014] [notice] FastCGI: process manager initialized (pid 2627)
[Wed May 07 14:02:10 2014] [notice] Apache/2.2.22 (Ubuntu) mod_fastcgi/mod_fastcgi-SNAP-0910052141 configured -- resuming normal operations
[Wed May 07 14:04:52 2014] [error] [client 127.0.0.1] (2)No such file or directory: FastCGI: failed to connect to server "/var/www/fastcgi/hhvm.fastcgi": connect() failed
[Wed May 07 14:04:52 2014] [error] [client 127.0.0.1] FastCGI: incomplete headers (0 bytes) received from server "/var/www/fastcgi/hhvm.fastcgi"
[Wed May 07 14:04:53 2014] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico
marcelo#marcelo-VirtualBox:/var/log/apache2$
(Apparently, I should have 'hhvm.fastcgi' file. I only have the directory. Is anything wrong here?)
/var/www directory:
marcelo#marcelo-VirtualBox:~$ ls -l /var/www
total 20
drwxrwxrwx 2 root root 4096 May 6 23:45 fastcgi
-rw-r--r-- 1 root root 31 May 6 21:57 hello_world.php
-rw-r--r-- 1 root root 177 May 6 17:47 index.html
-rw-r--r-- 1 root root 21 May 6 17:50 info.php
-rw-r--r-- 1 root root 0 May 6 17:49 info.php~
drwxr-xr-x 13 997 1001 4096 May 6 18:13 mediawiki-1.22.6
marcelo#marcelo-VirtualBox:~$ ls -l /var/www/fastcgi/
total 0
marcelo#marcelo-VirtualBox:~$
- FastCGI configuration:
I added the lines below, as suggested here: https://github.com/facebook/hhvm/wiki/FastCGI, at the end of apache2.conf file. In other words, after all 'mods-enabled' were already loaded.
# fastcgi added by M. Sardelich
<IfModule mod_fastcgi.c>
Alias /hhvm.fastcgi /var/www/fastcgi/hhvm.fastcgi
FastCGIExternalServer /var/www/fastcgi/hhvm.fastcgi -socket /var/run/hhvm/socket -pass-header Authorization -idle-timeout 300
<Directory "/var/www/fastcgi">
<Files "hhvm.fastcgi">
Order deny,allow
</Files>
</Directory>
AddHandler hhvm-hack-extension .hh
AddHandler hhvm-php-extension .php
Action hhvm-hack-extension /hhvm.fastcgi virtual
Action hhvm-php-extension /hhvm.fastcgi virtual
</IfModule>
To make sure that you are in fact running HHVM, run the following command:
phpinfo();
It should produce HipHop as the output, instead of the normal php info.
To check for it programmatically, you can use the following (also mentioned here):
if (defined('HHVM_VERSION')) {
echo "ruuning HHVM";
}
As correctly noticed (thanks #Petah), my FastCGI config was wrong.
I changed it to the snippet below (from here: http://www.mediawiki.org/wiki/HHVM/Vagrant) and everything is working! (add it to your apache2.conf or httpd.conf file)
<IfModule mod_fastcgi.c>
Alias /hhvm.fastcgi /var/www/fastcgi/hhvm.fastcgi
FastCGIExternalServer /var/www/fastcgi/hhvm.fastcgi -host 127.0.0.1:9000 -pass-header Authorization -idle-timeout 300
<Directory "/var/www/fastcgi">
<Files "hhvm.fastcgi">
Order deny,allow
</Files>
</Directory>
AddHandler hhvm-hack-extension .hh
AddHandler hhvm-php-extension .php
Action hhvm-hack-extension /hhvm.fastcgi virtual
Action hhvm-php-extension /hhvm.fastcgi virtual
</IfModule>
The title describes the question.
I have PHP installed, Apache, MySQL and also phpMyAdmin in the htdocs folder of Apache. I installed them separately and do not use a compilation package. I did try to create a php file with phpinfo
<?php
phpinfo();
?>
Saved the file as phpinfo.php
When going to
http://localhost
I see the phpinfo.php file listed. When I click the phpinfo.php file
I get a 404 error. There are no other files listed in the root http folder except one (phpinfo.php)
PHP was installed and php short tags are enabled
short_open_tag = On
I am not sure if it's a capital On or on
Note: I used http://www.jesterwebster.com/setting-up-a-test-bench-web-server-with-apache-php-mysql-and-more-on-windows/26 as a guide for my Apache and PHP install
I opened the error log and I found something disturbing. Not sure how to fix it
[Fri Aug 03 13:07:34 2012] [error] [client 127.0.0.1] File does not exist: C:/website/example/online/Program Files, referer: http://localhost/
[Fri Aug 03 13:09:33 2012] [error] [client 127.0.0.1] File does not exist: C:/website/example/online/Program Files, referer: http://localhost/
Per your error logs, your DocumentRoot "C:/websites/example/online" is websiteS, your error log is looking for website without the s.
Have you confirmed from apache configuration file that PHP is enabled and is configured correctly to work with apache? And has the apache server been restarted after configuration? Also Try adding an html file in the htdocs directory to confirm if the directory is correct.
Edit: Also you mentioned that error log is looking for your file in this directory
C:/website/example/online/Program Files
But you mentioned that you placed phpinfo.php in htdocs folder for apache. There might be an issue related to difference between those two paths
If this is not posted in correct place, please migrate it
I kept a .htaccess file in my public_html folder inside the root. When I view the website it is giving server misconfiguration error.
my .htaccess file contains this only
php_value upload_max_filesize 100M
php_value post_max_size 100M
I wonder what may be wrong. Any Ideas
MY ERROR LOG
[Mon Jun 07 17:06:23 2010] [alert] [client 113.199.221.198] /home/wwwcomr/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Mon Jun 07 17:04:46 2010] [alert] [client 113.199.221.198] /home/wwwcomr/public_html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
What Col. Shrapnel says: The error log is the only place to get reliable information.
Re your update:
PHP needs to be running as an Apache module for php_value to work. Source
See web-server's error_log for the details.