Comments (10)
Can you try changing to this options in you virtual host configuration please? And then restore the .htaccess to its original.
<VirtualHost *:80>
ServerName restapi.local
DocumentRoot "c:/wamp/www/restapi"
<Directory "c:/wamp/www/restapi/">
Allow From All
AllowOverride All
Options +Indexes
Require all granted
</Directory>
</VirtualHost>
from phalcon-micro-rest-api-skeleton.
@davellanedam I tried the commands you mentioned. It didn't help.
Its working now with all commands. I had to enable the headers_module
in Apache. It wasn't enabled.
Now to the second step, how to get a model to show up as API.
from phalcon-micro-rest-api-skeleton.
Hello Amal, no worries, thank you for trying this! Will you please check if you have at least PhalconPHP 3.2+ installed? You can do that by checking phpinfo() function. Also you should set a virtual host for testing, for example: my http://project.local point it to the root of the project, it will make you life easy. Please restore .htaccess file, every line is mandatory to make this work. If you are still getting error 500, please attach a screenshot of the browser.
from phalcon-micro-rest-api-skeleton.
Sorry I missed out mentioning the versions:
Phalcon 3.4
Apache 2.4.23
PHP 7,0.10
MySQL 5.7.14
I have setup a virtual host http://restapi.local but it still gave the 500 error. Image attached.
If I add the below line in .htaccess as mentioned in your setup guidelines then I get error shown below in Apache error log.
SetEnv APPLICATION_ENV "development"
[Mon Aug 06 11:27:35.040683 2018] [core:alert] [pid 4492:tid 932] [client 127.0.0.1:51846] C:/Wamp/www/restapi/public/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration
from phalcon-micro-rest-api-skeleton.
Are you able to run phpinfo() function and get info? You should do it in a different project just to check if it runs, you should see phalconPHP installed like this. Also the virtual host project must point to the root of the project, not the public folder.
from phalcon-micro-rest-api-skeleton.
Yes, I can see phpinfo() output as you mentioned. I have another project in Phalcon which works fine. My C:\Wamp\bin\apache\apache2.4.23\conf\extra\httpd-vhosts.conf
file has an entry for each virtual host. It points to the root folder.
<VirtualHost *:80>
ServerName restapi.local
DocumentRoot "c:/wamp/www/restapi"
<Directory "c:/wamp/www/restapi/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
from phalcon-micro-rest-api-skeleton.
Ok, it worked. I can see the first API page now. I have commented out below lines in C:\Wamp\www\restapi\public\.htaccess
. This is the .htaccess in public folder. It was giving the same "Header" error I mentioned above.
#AddDefaultCharset UTF-8
#SetEnv APPLICATION_ENV "development"
#CORS
#Header always set Access-Control-Allow-Origin: "*"
#Header always set Access-Control-Allow-Headers: "Origin, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Authorization, Accept, X-Accept-Charset, X-Accept, Client-Security-Token"
#Header always set Access-Control-Allow-Methods: "POST, GET, PUT, OPTIONS, PATCH, DELETE"
#Header always set Access-Control-Allow-Credentials: "true"
#Header always set Access-Control-Max-Age: "1000"
Are these lines essential for its functioning?
from phalcon-micro-rest-api-skeleton.
Yes, those are essential, without them it won't work. First line is for character encoding, second to set environment, and the other are for making requests to the API from anywhere and enabling requests with token. Looks like the problem is in your Apache somewhere. I think you have to search the Internet for problems with .htaccess and "Header" in apache to see what's going on. Please keep me posted.
from phalcon-micro-rest-api-skeleton.
Oh great news! From now on its just to follow up the guide and you are done. Thank you trying this again. If you need any help please open another issue. Enjoy.
from phalcon-micro-rest-api-skeleton.
Thanks for you prompt help @davellanedam and its great that you are so keen to help. Its very nice of you. I will probably trouble you again with my queries.
from phalcon-micro-rest-api-skeleton.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phalcon-micro-rest-api-skeleton.