Softaculous start symfony app - php

So i have downloaded Softaculous (ampps), and from their dashboard I installed the symfony framework, and it created a symfony3 folder with all of the files in the www directory (with an index.php file in the root directory of symfony that only prints a welcome message).
When I access it through http://localhost/symfony3/ it shows the index.php (if i remove the index.php it just shows the tree of the symfony3 directory)
Is it possible to set my localhost to launch the app? If I run php bin/console server:start it launches my app on localhost with port 8000. Is it possible to set up Ampps to launch my app when it is accessed through localhost/symfony3/ ? Thanks in advance!
EDIT: So turns out I could do this just by editing the httpd70.conf file (ampps>conf>httpd70.conf)
find the <VirtualHost 127.0.0.1:80> block and change the <Directory "{$path}/www"> to the web folder in your app (in my case it was <Directory "{$path}/www/symfony3/web"> and do the same thing for DocumentRoot "{$path}/www" in the same block. Restart your Apache. You should now see your app when you just go to http://localhost/ (http://localhost/app_dev.php/)

If I understood your question, you need to set up you web server with correct configuration file and to change permissions for Symfony project.
It might be helpful (documentation for Symfony 2.8.*):
Web server configuration.
Symfony project file permissions.

Related

Running a local Yii2 server with WAMP

I am a frontend JS dev and I've begun working on a project that has a PHP backend running with Yii2 framework. The project came with no setup instructions so I'm trying to figure it out as I go, but coming from Node.js... it's pretty confusing.
I downloaded and installed WAMP, created the MySQL DB for the API using MyPHPAdmin, and imported the data from a dump. That worked and I can see the tables and data. Now when I go to localhost I see that WAMP is running. I tried the sample Yii project and that also runs at localhost/yii-test/web.
According to Yii I am to serve this API by moving this entire API directory to the /www directory of the WAMP install. Now if I go to localhost/fania-api I see the directory listing for my server. To me this says that the API is accessible locally.
I have configured the .env of my frontend to point to localhost/fania-api, but when I send any request I get a CORS error, which I am assuming is masking some 404 or 500 error. Now the funny thing is the .env I was given comes with the URL http://fanintelligence.localhost, not the Yii given localhost/fania-api.
So my question is how do these two things fit together? I installed WAMP and setup the MySQL DB at the default port, but how does my API know it's there? How can I know if it's the right port? And what about these two different URLs, how do they match up?
Also the API does not contain a /web folder, not sure if that is an issue or not but I couldn't serve it with php yii serve either. If this was a Node.js server I'd clone, npm install and npm run start which would probably do something like build and serve. I can't believe this is so difficult to setup in comparison.
Any advice or help is greatly appreciated!
EDIT: When I try to reach my server from the frontend at either address I get:
Access to fetch at 'http://localhost/fania-api/oauth2/token?accessToken=undefined' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
/fania-api/oauth2/token?accessToken=undefined:1 Failed to load resource: net::ERR_FAILED
However I do not believe this is an actual CORS error as the previous developer also used the local to test, so the CORS policy will allow for this. My guess is the address I'm pointing to is incorrect or the server is not actually live.
If I try to run php yii serve:
Document root "C:\Users\hesel\dev\repo\eartotheground\fania-api\console/web" doe
s not exist.
But the crux of the erroneous behaviour is the inability to connect to a supposedly live local server (is it even live? how can I tell?).
If yii is installed via composer, go to the project,open the terminal and run ./yii serve
If yii has been downloaded as an archive file:
open terminal/cmd prompt in the folder of the project and
type composer install to ensure all packages in vendor are installed.
got to config/web.php
'request' => [
'cookieValidationKey' => 'put your random generated string',
],
Access the application via http://localhost/basic/web/
NB: try xammp for php local development you wont regret
I got it working. For hosting with WAMP:
Place entire server code folder in www/ (in WAMP install dir)
Edit wamp64\bin\apache\apache{version}\conf\httpd.conf:
DocumentRoot "${INSTALL_DIR}/www/{your project}/{optional public folder}"
<Directory "${INSTALL_DIR}/www/{your project}/{optional public folder}">
Edit wamp64\bin\apache\apache{version}\conf\extra\httpd-vhosts.conf:
<VirtualHost {project name}:80>
ServerName {project name}.localhost
ServerAlias {project name}.localhost
DocumentRoot "${INSTALL_DIR}/www/{your project}/{optional pub"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
Your server should now be live at {project name}.localhost.

Laravel in Xampp

Recently I have installed laravel 5.2 but my home page is not showing at 'localhost' address. It is showing at 'localhost/public' address. I have installed the all files in htdocs folder.Why this 'Public' thing showing up?
Assuming you installed xampp in the default location, a httpd.conf file should be available here:
C:\xampp\apache\conf\httpd.conf
Look for 2 adjacent lines:
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
And change them to point to laravel's public folder:
DocumentRoot "C:/xampp/htdocs/public"
<Directory "C:/xampp/htdocs/public">
I find this tutorial helpful.
https://www.youtube.com/watch?v=ybJYyU5FPv4
Just set up a vhost for your page with the right Document Root like mentioned above. But you dont need to handle Laravel Projects like a default web project. Use php artisan serve via console inside your project folder and the page will run at localhost:8000 default.

Move Laravel Project in Production Stage

I converted my project to a Laravel Project. And i created a new website. And it is working fine.
My real application is on .com domain. My Laravel project is on .net domain Two applications are in same server. (Server is centos)
i created and old directory and i moved my httpdocs folder on .com domain to old directory.
mv example.com/httpdocs example.com/old/httpdocs
and i moved my laravel project from .net domain to .com domain
mv example.net/httpdocs example.com/httpdocs
And i get in .com domain i'm recieving an error.
"No input file specified"
What should i do ?
Make sure you've pointed your web server to a public directory of your Laravel app. If you're using Apache, you should use something like this:
<VirtualHost *:80>
ServerName myapp.localhost.com
DocumentRoot "/home/vagrant/projects/myapp/public"
<Directory "/home/vagrant/projects/myapp/public">
AllowOverride all
</Directory>
</VirtualHost>
Then restart your web server.
Also, make sure all subdirectories and files were moved to a new directory.
If you own both domains and planning on keeping them, you can just add a cname record to point to the .net domain.
That way both domains will point to the same instance.
Or you can do the change on your /etc/nginx/sites-available/example.com.conf and do a sudo service nginx restart

Point to a virtual directory

I deployed an application on Heroku and I used a folder to place all my files inside thus now my application is only accesible from:
http://myapp.heroku.com/app/
Is it possible to create a virtual root to point
http://myapp.heroku.com -> http://myapp.heroku.com/app/ ?
Something similar to Apache VirtualHost?:
<VirtualHost 10.1.2.3>
ServerAdmin webmaster#host.foo.com
DocumentRoot /www/docs/host.foo.com
ServerName host.foo.com
ErrorLog logs/host.foo.com-error_log
TransferLog logs/host.foo.com-access_log
</VirtualHost>
Thanks in advance.
Yes you can configure the apache as well, however, this needs some changes on your system.
I've compiled a blog post recently that shows this (as the last part), it also shows how you can compile your own PHP extensions for heroku:
PHP on Heroku, again (by hakre; 20 May 2012)
It basically works by extending the standard configuration with your additional settings in another file. Look for the Configure the Webroot section, that's where it starts:
Now comes the next tricky part that is specifying the webroot. Specifying the webroot needs a little bit more work and background information. The CVBacklogs applications webroot in the git-tree is src/app/public. For Heroku, by default, the webroot is the root of the git-tree. That directory is internally mapped to /app/www btw. So what this needs is to create a so called Procfile that starts a sh-script each time the Heroku app web-node starts. That script then modifies the Apache configuration and includes your own config which is setting the webroot to /app/www/src/app/public. So we create the procfile, a config directory, the script and the Apache configuration. Ready?
You can't do anything with Apache / Nginx configuration on Heroku - these are all beyond your control. You could do some kind of php based redirect in the root folder to the /app folder or alternatively rejig the repo so app is the top level.

Creating website using Zend Framework

I have installed zend server on my local system.I created one project folder using this command line argument
zf create project quickstart
The project folder is created on C:\Program Files\Zend.
How i can run the project in browser.
http://localhost/zend/
I suggest not to use a subfolder or you'll have problems with URLs. Create a virtual host on you local apache ! it's by far the best solution !
look here
http://akrabat.com/zend-framework-tutorial/
download the PDF, at the end of page 3 there is the guide to configure the virtualhost
Briefly,
add this to apache conf file
<VirtualHost *:80>
ServerName zf-tutorial.localhost
DocumentRoot /var/www/html/zf-tutorial/public
<Directory "/var/www/html/zf-tutorial/public">
AllowOverride All
</Directory>
</VirtualHost>
where
/var/www/html/zf-tutorial/public
is the path to the index.php (inside public folder of the zend project)
If you are using windows, use c:/www/etc...
then edit hosts file (linux: /etc/hosts)
and add the line
127.1.0.1 zf-tutorial
restart apache and point the browser to
http://zf-tutorial
if you create a simple zend framework with zend studio (it creates all necessary files).
put it in your server folder (htdocs) und run it with localhost/project/public/index.php
You don't need the zend server to build/run zend Projects.
Just Download mix or max Zend Framework package and you can start.

Categories