Php+mysql+apache a series of configuration issues that are encountered when a project is running

Source: Internet
Author: User

When I run a PHP project today, I suddenly find that I can't access it. The cause should be a Mac system upgrade, which causes the Apache configuration file to be fully restored to its default state, all zeroed out. As an experience is still owed to the front-end, these background configuration is completely ignorant, hurriedly contacted the small fat. Finally through the small fat in the distance patiently help and guidance, the perfect solution to run the project encountered in the chain pit, tossing the afternoon until eight o'clock more than a night. Maybe it was a piece of cake for the back end, and it was a disaster for me as a layman. Think or hands good, before others to me with server environment when never remember the ins and outs, after today this crazy operation and toss, presumably later encounter this kind of problem will not have to go to big cost belabour.

Hurry up and record the hang of the pit today, in case of trouble.

Unfold it in the form of a dialogue.

me: chubby, why all my PHP projects show only "it works" through the localhost access page.

Chubby: If the configuration file is not changed, localhost only accesses the default directory. It works is the default page on which services are opened. You send me the configuration file to see. The file name is httpd.conf, below/etc/apache2/.

me:httpd.conf file

Chubby: From the httpd.conf file, the project portal file directory should be/library/webserver/documents. DocumentRoot is to set the PHP Project Access path, that is to say you should put the project in/library/webserver/documents, and documents under a index.php or index.html file

me: but my previous PHP default project path has been/project/rorohtml5/php, how has changed? (Suddenly realize that it might be a system upgrade, even the server configuration file is initialized) is not my system upgrade initialized the configuration file? (a face is crazy.) )

Chubby :/library/webserver/documents must have changed after the upgrade.

me: Then I will change these two places in the httpd.conf to/project/rorohtml5/php is not OK? No other place to change?

Chubby: nn Remember to restart the server.

me: OK. After modifying, sudo/usr/sbin/apachectl restart this reboot?

Chubby : Um, yes.

I: changed, also restarted, but there seems to be a problem.

The page shows Forbidden you donnot has permission to access/on the This server

Chubby: No permissions, folder permissions. Could it be that the server configuration rewrite did not open. Go to httpd.conf to find #loadmodule rewrite_module libexec/apache2/mod_rewrite.so, remove #, and restart the server.

me: It's not as if it's not working.

Chubby : I'll look at the configuration file again. That one

<ifmodule dir_module>

DirectoryIndex index.html

</IfModule>

index.html, add a index.php to the back of the bar.

me: directly output the source code, no parsing.

Small Fat: AddType application/x-httpd-php. PHP, add this to the config file.

Put it in AddType application/x-compress. Z AddType application/x-gzip. gz. TG below

me: put it in the back.

It still seems to be not working.

Chubby:#LoadModule php5_module libexec/apache2/libphp5.so This # also to be removed. There are many modules that need to be turned on.

I : After the removal, it seems to have a effect, but there are errors.

Chubby : Did you start the database?

me : MySQL started up.

chubby: not PHP configuration also to change it, you look at etc under the php.ini file.

me: two php.ini files which one is?

Chubby: You use the editor to open the project's index.php file, plus echo phpinfo ();d ie; I'll see which php.ini file is used.

I:

chubby: See/ etc does not have to load PHP configuration. Php.ini.default this file changed to PHP.ini. Go to MySQL console via terminal, enter status, get the value of UNIX socket, assign this value to php.ini inside pdo_mysql.default_socket,mysql.default_ Socket, Mysqli.default_socket three variables can be.

me : Mysql-uroot-p does not work, switch to console mode? What's up, before it can be. (no need to add content after-p)

Chubby:MySQL is not added to the environment variable. The terminal input Export Path=${path}:/usr/local/mysql/bin instructions can be added.

Me: Ok. The UNIX socket was acquired, and three variables were assigned, but there were still errors.

Chubby: caching issues. Go to the runtime folder to clear all the contents, and then set permissions for runtime. in the app directory Chmod-r 777./runtime

me: I can finally visit. But, and encountered a small problem, can only access the home page other pages error. It was a wave of unravelling.

Chubby: This is a rewrite question. Change this inside allowoverride none,none to all on restart server

<directory"/project/rorohtml5/php"># # Possible Values forThe Options directive are"None"," All", # or any combination of: # Indexes includes followsymlinks symlinksifownermatch execcgi multiviews # # Note that"MultiViews"Must be named *explicitly*---"Options All"# doesn'T give it to you.# # The Options directive isboth complicated and important. Please see # http://httpd.apache.org/docs/2.4/mod/core.html#options# forMore information. # Options FollowSymLinks multiviews multiviewsmatch Any # # AllowOverride controls what directives could be plac Edinch. htaccess files. # It can be" All","None", or any combination of the keywords: # allowoverride FileInfo authconfig Limit # allowoverride None # # Controls who canGetStuff from  Thisserver. # Require All granted</Directory>

me: wow, my God, finally good.

Pay will always be rewarded, God is fair.

Php+mysql+apache a series of configuration issues that are encountered when a project is running

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.