Imprimer
 ionic cordova build browser

ionic serve --cordova --platform browser

For OSX 10.10 Apache 2.4
Then add the content below swapping in your username:

<Directory "/Users/username/Sites/">
AllowOverride All
Options Indexes MultiViews FollowSymLinks
Require all granted
</Directory>
Permissions on the file should be:

-rw-r--r-- 1 root wheel 298 Jun 28 16:47 username.conf
This is documented at Apple.

Restart apache
sudo apachectl restart
Then all should be good.

Changing The Apache Web User
One of the frustrations of using the Users/username/Sites folder is the permissions issues with things like updates and authentication.

This is because the default webserver user which runs httpd is known as _www, which will not be the user in your local account. If your machine is only in use by you and the webserver will run only under your account then you can change the user.

Change this back in /etc/apache2/httpd.conf

 

osx-yosemite-webserveruser

Just change it to your username and group, group will be staff and restart Apache

sudo apachectl restart
Cats: macOS, Tech

 

 sudo nano /etc/apache2/httpd.conf

 

1. Open your terminal.
Image for post
Figure 1 — PHP 7 on macOS High Sierra
2. Type the following command into the terminal to open the httpd.conf file:
sudo nano /etc/apache2/httpd.conf
3. Press control-w and type php then hit enter. You will see the following line :
#LoadModule php7_module libexec/apache2/libphp7.so
4. Delete the # from the line above, then press control-o to save the changes and control-x to exit (See the picture below)
Image for post
Figure 2— PHP 7 on macOS High Sierra
5. Now type the command below to restart your apache server and press enter:
sudo apachectl restart
Image for post
Figure 3— PHP 7 on macOS High Sierra
Congrats’ ! You just turned PHP7 on your Mac.
6. Now you need to create the Sites folder where you can store locally your webpages :
Open your home folder.
Create a new folder and name it Sites.
or
Type the following command into the terminal:
$ mkdir ~/Sites
macOS will automatically add the compass icon to your folder.
Image for post
Figure 4 — PHP 7 on macOS High Sierra
A document root is a folder designated for holding web pages. When you look up your webpages from your web browser, this is the location you will be accessing.
Now, you will make the ‘Sites’ folder that you just created as a document root for your webpages.
7. Go back to the terminal and type the following command:
sudo nano /etc/apache2/httpd.conf
8. Press control+w and look for DocumentRoot
Image for post
Figure 5— PHP 7 on macOS High Sierra
9. Replace the line below:
DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">
with:
DocumentRoot "/Users/YourUserName/Sites"
<Directory "/Users/YourUserName/Sites">
Make sure your put your actual username -> “/Users/YourUserName/Sites”
10. Press control-o to save the changes and control-x to exit.
Image for post
Figure 6— PHP 7 on macOS High Sierra
11. Restart your apache server:
sudo apachectl restart
Let’s test it by creating a new php page:
12. Open your Text Editor, copy/paste the code below :

13. Name the file ‘index.php’ and save it under to your ‘Sites’ folder.
14. Now open your web browser and type localhost/index.php
Image for post

Affichages : 104