I need to run some scripts written in PHP in a Rails application through some ajax JS calls. I have a problem with cross domains where my scripts are active on localhost / scripts and my application is active on localhost: 3000 / myapplication. Ajax requests to localhost return a cross-domain error.
I managed to implement the jsonp workaround and it works fine, but I would ideally want to access the php file from the rails folders. I read that you can configure the Apache server to include PHP in the folder within the framework. I am running Apache2 on Linux.
Attempted solution I am not 100% sure where to find the .htaccess file, so I just made it in the directory (public / php-scripts). Not sure if this works though ...
Attempt 2: I cannot configure my server correctly: I installed all the components for passengers and changed my file like this: / etc / apache2 / sites-available / default
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.1.3/ext/apache2/mod_passenger.so PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.1.3 PassengerRuby /usr/bin/ruby1.8 <VirtualHost *:80> ServerName myservername DocumentRoot /var/www/myapp/public <Directory /var/www/myapp/public> Allow from all Options -MultiViews </Directory> </VirtualHost> <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/ <Directory /var/www/> Options FollowSymLinks AllowOverride None </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> </VirtualHost>
And I restarted the server. What am I missing? I go to myservername / and myservername / myapp and get a forbidden message
source share