Run both HHVM and Normal Apache Server - php

This morning I started using HHVM as my default local server. Most things are fine, but I still have applications that HHVM doesn't fully support yet.
Rather than changing my configuration and restarting services, it would be much easier if I could just switch ports or directories.
My Question: Is it possible to run a normal Apache server on one port (80) and a HHVM powered server on another port (8080)? Alternatively, is it possible to only run HHVM in a specific directory (and its' sub-directories)?
In scenario 1 switching to HHVM application would look like this:
localhost/my-project/index.php
localhost:8080/my-project/index.php
In scenario 2 switching to HHVM application would look like this:
localhost/my-project/index.php
localhost/hhvm/my-project/index.php
I would guess that this can be achieved via Apache's config file, but I don't know enough about how the config files work to do it myself, please help!?
OS: Ubuntu 14.04
Apache Version: 2.4.7
HHVM Version: 3.2.0

To /etc/apache2/ports.conf add...
Listen 8080
Then, to your vhost configuration (since using localhost as your domain, probably /etc/apache2/sites-available/default.conf), copy everything in there and paste it right below so you have a second VirtualHost instance. To the second instance, change the *:80 to *:8080, then add your ProxyPassMatch to tell it you're wanting to use HHVM for hh and php file extensions (don't forget to update to correct directory).
It should look something like...
<VirtualHost *:80>
... keep the same ...
</VirtualHost>
<VirtualHost *:8080>
... keep the same ...
ProxyPassMatch ^/(.+\.(hh|php)(/.*)?)$ fcgi://127.0.0.1:9000/var/www/$1
</VirtualHost>
Go into /etc/apache2/mods-available/hhvm_proxy_fcgi.conf and comment out what's in there. Otherwise everything will be headed toward HHVM.
Finally, restart apache
sudo service apache2 restart
I tested this quickly on an existing local site and it was redirecting back to 80 from 8080 which it should have done. If this doesn't work out, let me know.
UPDATE: Tested a bit more, and it looks like this should work out for you. After adding the following, jumping between local.site.com/hhvm.php and local.site.com:8080/hhvm.php flipped the echo correctly.
<?php if (defined('HHVM_VERSION')) {
echo "golden!";
} else {
echo "doh...";
}

Yes. You can have Apache listen on both port 80 and port 8080 (just add in additional listen configurations), then add a virtual host for localhost:8080 that passes requests off to HHVM through FastCGI.

Related

No input file Specified. Laravel 5.5 CentOs

Hie, I am trying to host a Laravel project on a VPS server with Cpanel. I am getting the No input file Specified error when I access the site.
Things I did so far>
Got Managed VPS hosting from inmotionhosting.
Got into root and downloaded the laravel project on var/www/html.
Got a domain name point at the server's Ip address using A.
Changed the virtual host file servername and alias to the domain name keeping the ip address on the top as shown below:
<VirtualHost ipaddress:80>
ServerName mydomain.com
ServerAlias www.domain.com
DocumentRoot var/www/html/laravel/public
</virtualhost>
Now when I access the domain it returns No input file Specified error. I am not sure how to change the .htaccess to get this working, I believe it is something to do with the server .htaccess. I did fiddle around for quite a bit but a no vain so I had to turn to stackoverflow.
Adittionaly I changed my html folder permission and ownership to apache, tested with 755 777, tested with different user name no luck.
Not using vagrant or homestead or forge , Any suggestions
I had a similar issue. While I also edited the Apache configuration and it didn't work, since for me it was PHP-FPM.
For some reason the document root was not changed in /opt/cpanel/ea-php72/root/etc/php-fpm.d/{my-domain-name-here}.conf.
Correcting the document root here is what did the trick. So if you have a PHP-FPM configuration.
Check the document root specified there as well and then restart the FPM service.
You might run this command to restart FPM service:
/scripts/restartsrv_apache_php_fpm
Also don't forget to restart php-fpm service after changing document root,.
In my using in my case was:
systemctl restart ea-php72-php-fpm.service

Vhost and Debugging with 127.0.0.1:8888

I have a Drupal application that runs using the following command "drush runserver"
When I run this command, I get the following message: "HTTP server listening on 127.0.0.1, port 8888 (see http://127.0.0.1:8888/)"
If I visit that url, I see the application I am supposed to see, so that is good.
However, I am trying to create a vhost to this url as well as do some debugging on the application.
I've created vhosts many times before, but never for an application that lives on another port. After doing some google searches, I have placed the following in my httpd-vhosts.conf file:
NameVirtualHost *:8888
<VirtualHost *:8888>
DocumentRoot "/Users/justin/Sites/drupal/"
ServerName myproject.dev
ServerAlias www.myproject.dev
ErrorLog "/private/var/log/apache2/myproject.dev-error_log"
CustomLog "/private/var/log/apache2/myproject.dev-access_log" common
</VirtualHost>
I've also placed the following in my /etc/hosts file.
127.0.0.1 myproject.dev www.myproject.dev
And even after restarting my server, if I visit myproject.dev in my browser window, the browser just hangs. Like I said, I've never had problems doing this before, but I'm guessing it has something to do with the 8888. Any solutions for this?
Secondly, I am trying to set up debugging for my application in PHPStorm. Again, I have a feeling the reason I am having so much trouble is because of the 8888 port. I must be missing something that I usually do not have to set when I debug normally (port 80).
Here are my current xdebug settings in my php.ini file:
[xdebug]
zend_extension="/usr/local/Cellar/php55-xdebug/2.4.0/xdebug.so"
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host="127.0.0.1:8888"
xdebug.remote_port=9001
xdebug.remote_autostart=1
xdebug.idekey="phpstorm"
xdebug.max_nesting_level=1000
And I should mention that my debugger works with any random PHP file I make outside of the project. Again, I must be missing something with this 8888 port.
You are dealing with three different things here. First is the built in PHP web server that is spinning up with Drush. It listens on port 8888 unless you specify differently on the command line. Second is Apache and a vhost configuration. You can leave the vhost listening on port 80. The port is selected by the server not the application. You can run the server on port 16421 and your app will work just fine. Third is your xdebug config.
The only real problem I see is your xdebug config. You only need the remote host IP/hostname not the additional port. The port you have added there is the port used by PHP's built in web server. Xdebug runs on a different port which is defined in the xdebug config xdebug.remote_port setting. PHPStorm is going to be configured to connect to xdebug on that specific port, . Make sure the ports in PHPStorm and your xdebug config match.
If you have it configured correctly, it won't matter if you are using the built in web server or Apache, you will be able to debug.

Post request not working Drupal and Ubuntu 14.04

In my ubuntu 14.04 OS machine for drupal 7 login not working, may be it is not only login but all post request not working here. For the same filesystem and codebase it works fine in windows 7 machine.
Here is my apache server configuration:
<VirtualHost *:80>
ServerName somedomain.local
DocumentRoot "/home/mycompany/Development/Projects/Drupal/cbb"
<Directory "/home/mycompany/Development/Projects/Drupal/cbb/">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
for above configuration when i try to submit data for login it showing..
"NetworkError: 404 Not Found - http://somedomain.local/user".
#UPDATE:
I just find out that login not working only from www.domainname.local/user path but if this login form in homepage sidebar it works fine, for all of drupal sire in ubuntu machine. With this no error message also not display.
I am in trouble for two of my drupal site in Ubuntu machine. Any help will be appreciated.
Check if .htaccess file present in drupal root directory.
Check if you've added your domain to /etc/hosts file
127.0.0.1 domain.name
Domains with 'www' and without it are totally different. Add both to /etc/hosts and to apache's config file to avoid problems.
Clear cache to avoid previous domain name which could be stored in cache.
drush cc all
If you've just added new site to apache's configuration be sure to run:
sudo service apache2 graceful
Your Apache vhost file looks like it has the key components set and I'm assuming that the .htaccess file exists in your document root and hasn't been modified from the Drupal default.
When you click on the login link in the sidebar, does it take you to http://somedomain.local?q=user/login ?
Your #update suggests that even though your Apache environment may be set up for "clean URLs", the feature is not enabled in Drupal at Administer > Configuration > Search and metadata > Clean URLs.
If modifying this compromises your access to Drupal, you can apply/disable this change via Drush (drush vset clean_url 0 --yes) or directly through MySQL (UPDATE variable SET value = 's:1:"0";' WHERE name = 'clean_url';) as per https://www.drupal.org/node/5590.
Also worth mentioning, seeing it on this related question (Very strange Drupal 7 404 behaviour): make sure that Apache modules mod_rewrite and mod_headers are enabled:
sudo a2enmod rewrite
sudo service apache2 restart

Configuring HHVM 3.7 with Apache 2.4 gives me a 404?

I can't seem to configure HHVM and Apache, it keeps giving me a 404 file not found error. My configuration file for the website is saved as www.example.com.conf, it contains:
<VirtualHost *:80>
ServerName website.com
ServerAdmin mail#website.com
DocumentRoot /var/www/website.com/public_html/
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/website.com.com/public_html/$1
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Note that I've removed my actual website name, but it's for a subdomain so it's this: subdomain.xyz.com. I've tried looking up how to fix this, but whatever I've tried doesn't seem to work; even the GitHub issues people have posted on the official repository don't seem to work. I also haven't changed the default apache configuration, the only thing I have changed is the root directory of my website which does much up to the directory in the configuration file above.
Any ideas? Thanks.
I know it's been two months already, but maybe it helps someone else (I had a similar issue occur many times when configuring HHVM + Apache2).
Try to enable the vhost if you haven't yet done so. Issue sudo a2ensite www.example.com and reload apache afterwards with sudo service apache2 reload.
If the vhost is ok and you have your browser requests visible in the vhost access log, then it means that it's not Apache2 that's the culprit there.
So if you're still with me and the first two steps didn't help, try the following, although in HHVM 3.7 it shoulnd't be the case anymore (but it might, I just follow the try-and-check method when it comes to configuring HHVM, and it usually works). Open /etc/hhvm/server.ini and append the following line to that file:
hhvm.server.fix_path_info = true
After changing the HHVM's configuration, issue sudo service hhvm restart. Then try to refresh your website. It should be all good.
I had similar issues and back then it was the most common fix on all webservers I configured to work with HHVM. But, after the latest updates, I had to comment that line out of my hhvm server.ini in order for my code to work - I read that they have somehow changed the parameters of the server and this parameter does no good anymore, AFAIK.
I have also tried to put that line in /etc/hhvm/php.ini but as far as I remember, it should go to server.ini because it's a server parameter.
So. Try it and let me know if that helped. If not then please issue the following commands on your webserver and paste the output here, so I can see if you have the necessary modules installed
ls /etc/apache2/mods-available | grep -E 'proxy|alias|fcgi|hhvm'
ls /etc/apache2/mods-enabled | grep -E 'proxy|alias|fcgi|hhvm'
Oh, and please include your full HHVM and Apache2 version output:
hhvm --version
apache2 -v

Ubuntu Xampp access localhost from other pc

I am trying to access my localhost from another computer using the local IP(192.168...)
The problem is that I get access forbidden.
I changed the httpd-xampp-conf and it looks like the following:
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-st$ver- status|server-info))">
Order deny,allow
Allow from all
Allow from ::1 127.0.0.0/8 \
fc00::/7 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 \
fe80::/10 169.254.0.0/16
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>
But still no luck...Any ideas..??
Whenever people on a linux system mention pre-packaged development environments I scream "ARRRRGHHHHHHH" at them and tell them that their computer is capable of running the same environment as production. Why are you running anything else?
sudo apt-get install php5 apache2 mysql
XAMPP is pretty terrible for dev environments. Set up an actual environment for your code; the experience is worth it.
Regardless, your issue is that XAMPP is bound to localhost, or 127.0.0.1. Change Listen 127.0.0.1:80 to Listen 80.
You could also try forwarding traffic, but that is a little bit overkill.
Also, your internal network (192.168.0.0/16) is only as secure as your router. If you feel comfortable allowing it, just bind XAMPP to your internal network address instead of 127.0.0.1 and allow everything globally. It'll save you a headache if you use different machines regularly.

Categories